import { useEffect, useRef, useState } from 'preact/hooks'; import { AlertDialog, AlertDialogDescription, AlertDialogLabel, } from '@reach/alert-dialog'; import { STRING_SIGN_OUT_CONFIRMATION } from '@/strings'; import { WebApplication } from '@/ui_models/application'; import { AppState } from '@/ui_models/app_state'; import { observer } from 'mobx-react-lite'; type Props = { application: WebApplication; appState: AppState; }; export const ConfirmSignoutContainer = observer((props: Props) => { if (!props.appState.accountMenu.signingOut) { return null; } return ; }); export const ConfirmSignoutModal = observer( ({ application, appState }: Props) => { const [deleteLocalBackups, setDeleteLocalBackups] = useState(false); const cancelRef = useRef(null); function closeDialog() { appState.accountMenu.setSigningOut(false); } const [localBackupsCount, setLocalBackupsCount] = useState(0); useEffect(() => { application.bridge.localBackupsCount().then(setLocalBackupsCount); }, [appState.accountMenu.signingOut, application.bridge]); return (
Sign out workspace?

{STRING_SIGN_OUT_CONFIRMATION}

{localBackupsCount > 0 && (
)}
); } );