fix(webui): make browser notification failures actionable

This commit is contained in:
Xubin Ren authored and chengyongru committed 2026-10-20 13:45:04 +08:00
1 parent 909b277e7a
commit 7b2af031c0
30 files changed
+919 -96

No files matched your search

@@ -11,6 +11,7 @@ import { HostNavigationContext, HostSwitcher, RemoteHostMenu, type HostPicker }
import { useSidebarHostBridge } from "./useSidebarHostBridge";
import { readPairReturn, subscribePairReturn } from "@/lib/remote-pair-return";
import { RemoteContext, type HostConnectionState } from "./remote-context";
import { NOTIFICATION_OPEN_EVENT } from "@/lib/browser-notifications";
/** Keep host views alive; navigation belongs in each view's sidebar, not a second header. */
export function RemoteInstances({ children }: { children: ReactNode }) {
@@ -34,7 +35,16 @@ export function RemoteInstances({ children }: { children: ReactNode }) {
if (lastLocalFocus.current?.isConnected) lastLocalFocus.current.focus({ preventScroll: true });
};
const message = error ? t(`remote.errors.${error}`, { defaultValue: t("remote.errors.unknown") }) : "";
const bridge = useSidebarHostBridge(frames, selected?.id, frameNodes, restoreLocalFocus, { pendingName: pending?.name, error: message }, managing, () => changeManagement(false));
const bridge = useSidebarHostBridge(frames, selected?.id, frameNodes, restoreLocalFocus, { pendingName: pending?.name, error: message }, managing, () => changeManagement(false), (id) => {
if (hosts.reveal(id)) changeManagement(false);
});
useEffect(() => {
const revealLocal = () => {
if (window.parent === window) { returnLocal(); setManaging(false); }
};
window.addEventListener(NOTIFICATION_OPEN_EVENT, revealLocal);
return () => window.removeEventListener(NOTIFICATION_OPEN_EVENT, revealLocal);
}, [returnLocal]);
useEffect(() => {
if (!managing || !selected || !bridge.surface?.theme) return;
// Management is drawn by the local shell, beside this host's sidebar.