diff --git a/src/app/components/DialogHost.tsx b/src/app/components/DialogHost.tsx
new file mode 100644
index 00000000..0120f9fb
--- /dev/null
+++ b/src/app/components/DialogHost.tsx
@@ -0,0 +1,49 @@
+import FocusTrap from 'focus-trap-react';
+import { useAtom } from 'jotai';
+import { Box, Button, Dialog, Overlay, OverlayBackdrop, OverlayCenter, config, Text } from 'folds';
+import { dialogAtom } from '../state/dialog';
+import { stopPropagation } from '../utils/keyboard';
+
+export function DialogHost() {
+ const [dialog, setDialog] = useAtom(dialogAtom);
+
+ if (!dialog) return null;
+
+ const close = (answer: boolean) => {
+ setDialog(null);
+ dialog.resolve(answer);
+ };
+
+ return (
+ }>
+
+ close(false),
+ clickOutsideDeactivates: true,
+ escapeDeactivates: stopPropagation,
+ }}
+ >
+
+
+
+
+ );
+}
diff --git a/src/app/pages/App.tsx b/src/app/pages/App.tsx
index e920a991..aa60ede6 100644
--- a/src/app/pages/App.tsx
+++ b/src/app/pages/App.tsx
@@ -4,6 +4,7 @@ import { OverlayContainerProvider, PopOutContainerProvider, TooltipContainerProv
import { RouterProvider } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { dialogStore } from '../state/dialog';
import { ClientConfigLoader } from '../components/ClientConfigLoader';
import { ClientConfigProvider } from '../hooks/useClientConfig';
import { ConfigConfigError, ConfigConfigLoading } from './ConfigConfig';
@@ -35,7 +36,7 @@ function App() {
{(clientConfig) => (
-
+
diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx
index c2d78804..7bb9002e 100644
--- a/src/app/pages/client/ClientNonUIFeatures.tsx
+++ b/src/app/pages/client/ClientNonUIFeatures.tsx
@@ -61,6 +61,7 @@ import {
materializeSharedFile,
} from '../../utils/androidShare';
import { UpdatesDialogHost } from '../../components/updates-dialog';
+import { DialogHost } from '../../components/DialogHost';
/**
* Applies the selected emoji style font to the document.
@@ -701,6 +702,7 @@ export function ClientNonUIFeatures({ children }: ClientNonUIFeaturesProps) {
{children}
+
>
);
}
diff --git a/src/app/state/dialog.ts b/src/app/state/dialog.ts
new file mode 100644
index 00000000..57afd09f
--- /dev/null
+++ b/src/app/state/dialog.ts
@@ -0,0 +1,19 @@
+import { atom, createStore } from 'jotai';
+
+export type Dialog = {
+ message: string;
+ // Confirm needs an affirmative answer; information-only dialogs just close.
+ confirm: boolean;
+ resolve: (answer: boolean) => void;
+};
+
+// Non-React callers (client init, background sync) must write the store the app renders
+// with, so App.tsx passes this one to JotaiProvider.
+export const dialogStore = createStore();
+
+export const dialogAtom = atom