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 '@/UIModels/Application' import { AppState } from '@/UIModels/AppState' 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.desktopDevice?.localBackupsCount().then(setLocalBackupsCount).catch(console.error) }, [appState.accountMenu.signingOut, application.desktopDevice]) return (
Sign out workspace?

{STRING_SIGN_OUT_CONFIRMATION}

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