22 * Copyright (c) 2026 Interop Alliance. All rights reserved.
33 */
44/**
5- * The clear-data confirmation dialog (local mode). A dumb presentational
6- * component over the store's `clearLocalData` action: it confirms the
7- * destructive reset -- deleting the local replica and minting a brand-new
8- * anonymous identity -- and nudges the user to export their data first, since a
9- * local-only, unsynced app has no server copy to recover from. Dismissing the
10- * dialog (backdrop / escape / Cancel) leaves the data untouched.
5+ * The clear-data confirmation dialog. A dumb presentational component over the
6+ * store's `clearLocalData` action: it confirms the destructive reset --
7+ * deleting the local replica and minting a brand-new anonymous identity. The
8+ * warning text is mode-aware: in `local` mode the device copy is the ONLY copy,
9+ * so it nudges the user to export first; once connected, the copy already
10+ * synced to the Web Space survives the reset, so the text says so instead of
11+ * threatening total loss. Dismissing the dialog (backdrop / escape / Cancel)
12+ * leaves the data untouched.
1113 */
1214import {
1315 Button ,
@@ -17,7 +19,7 @@ import {
1719 DialogContentText ,
1820 DialogTitle
1921} from '@mui/material'
20- import { useClearData } from '../react/hooks.js'
22+ import { useClearData , useSession } from '../react/hooks.js'
2123
2224/**
2325 * @param props {object}
@@ -34,6 +36,8 @@ export function ClearDataDialog({
3436 onClose : ( ) => void
3537} ) {
3638 const clearData = useClearData ( )
39+ const { status } = useSession ( )
40+ const connected = status === 'connected' || status === 'reconnect'
3741
3842 async function handleClear ( ) : Promise < void > {
3943 await clearData ( )
@@ -45,9 +49,15 @@ export function ClearDataDialog({
4549 < DialogTitle > Clear data</ DialogTitle >
4650 < DialogContent >
4751 < DialogContentText >
48- This permanently erases everything stored on this device and starts
49- you over fresh. Your data lives only on this device, so once cleared
50- it cannot be recovered -- export a copy first if you want to keep it.
52+ { connected
53+ ? 'This erases the copy stored on this device and disconnects it ' +
54+ 'from your Web Space. The data already saved to your Web Space ' +
55+ 'stays there -- reconnect with your wallet to bring it back ' +
56+ 'onto this device.'
57+ : 'This permanently erases everything stored on this device and ' +
58+ 'starts you over fresh. Your data lives only on this device, ' +
59+ 'so once cleared it cannot be recovered -- export a copy first ' +
60+ 'if you want to keep it.' }
5161 </ DialogContentText >
5262 </ DialogContent >
5363 < DialogActions >
0 commit comments