import { AppState } from '@/ui_models/app_state'; import { useState } from 'preact/hooks'; import { WebApplication } from '@/ui_models/application'; import { observer } from 'mobx-react-lite'; type Props = { application: WebApplication; appState: AppState; }; const Footer = observer(({ application, appState }: Props) => { const { showSignIn, showRegister, setShowSignIn, setShowRegister, setSigningOut, } = appState.accountMenu; const { showBetaWarning, disableBetaWarning: disableAppStateBetaWarning } = appState; const [appVersion] = useState( () => `v${(window as any).electronAppVersion || application.bridge.appVersion}` ); const disableBetaWarning = () => { disableAppStateBetaWarning(); }; const signOut = () => { setSigningOut(true); }; const hidePasswordForm = () => { setShowSignIn(false); setShowRegister(false); }; return (
{appVersion} {showBetaWarning && ( ( Hide beta warning ) )}
{(showSignIn || showRegister) && ( Cancel )} {!showSignIn && !showRegister && ( {application.hasAccount() ? 'Sign out' : 'Clear session data'} )}
); }); export default Footer;