* refactor: menuRow directive to MenuRow component * refactor: migrate footer to react * refactor: migrate actions menu to react * refactor: migrate history menu to react * fix: click outside handler use capture to trigger event before re-render occurs which would otherwise cause node.contains to return incorrect result (specifically for the account menu) * refactor: migrate revision preview modal to react * refactor: migrate permissions modal to react * refactor: migrate password wizard to react * refactor: remove unused input modal directive * refactor: remove unused delay hide component * refactor: remove unused filechange directive * refactor: remove unused elemReady directive * refactor: remove unused sn-enter directive * refactor: remove unused lowercase directive * refactor: remove unused autofocus directive * refactor(wip): note view to react * refactor: use mutation observer to deinit textarea listeners * refactor: migrate challenge modal to react * refactor: migrate note group view to react * refactor(wip): migrate remaining classes * fix: navigation parent ref * refactor: fully remove angular assets * fix: account switcher * fix: application view state * refactor: remove unused password wizard type * fix: revision preview and permissions modal * fix: remove angular comment * refactor: react panel resizers for editor * feat: simple panel resizer * fix: use simple panel resizer everywhere * fix: simplify panel resizer state * chore: rename simple panel resizer to panel resizer * refactor: simplify column layout * fix: editor mount safety check * fix: use inline onLoad callback for iframe, as setting onload after it loads will never call it * chore: fix note view test * chore(deps): upgrade snjs
103 lines
3.1 KiB
TypeScript
103 lines
3.1 KiB
TypeScript
import { Button } from '@/components/Button';
|
|
import { ConfirmSignoutContainer } from '@/components/ConfirmSignoutModal';
|
|
import { OtherSessionsSignOutContainer } from '@/components/OtherSessionsSignOut';
|
|
import {
|
|
PreferencesGroup,
|
|
PreferencesSegment,
|
|
Subtitle,
|
|
Text,
|
|
Title,
|
|
} from '@/preferences/components';
|
|
import { WebApplication } from '@/ui_models/application';
|
|
import { AppState } from '@/ui_models/app_state';
|
|
import { observer } from 'mobx-react-lite';
|
|
import { FunctionComponent } from 'preact';
|
|
|
|
const SignOutView: FunctionComponent<{
|
|
application: WebApplication;
|
|
appState: AppState;
|
|
}> = observer(({ application, appState }) => {
|
|
return (
|
|
<>
|
|
<PreferencesGroup>
|
|
<PreferencesSegment>
|
|
<Title>Sign out</Title>
|
|
<Subtitle>Other devices</Subtitle>
|
|
<Text>Want to sign out on all devices except this one?</Text>
|
|
<div className="min-h-3" />
|
|
<div className="flex flex-row">
|
|
<Button
|
|
className="mr-3"
|
|
type="normal"
|
|
label="Sign out other sessions"
|
|
onClick={() => {
|
|
appState.accountMenu.setOtherSessionsSignOut(true);
|
|
}}
|
|
/>
|
|
<Button
|
|
type="normal"
|
|
label="Manage sessions"
|
|
onClick={() => appState.openSessionsModal()}
|
|
/>
|
|
</div>
|
|
</PreferencesSegment>
|
|
<PreferencesSegment>
|
|
<Subtitle>This device</Subtitle>
|
|
<Text>This will delete all local items and preferences.</Text>
|
|
<div className="min-h-3" />
|
|
<Button
|
|
type="danger"
|
|
label="Sign out and clear local data"
|
|
onClick={() => {
|
|
appState.accountMenu.setSigningOut(true);
|
|
}}
|
|
/>
|
|
</PreferencesSegment>
|
|
</PreferencesGroup>
|
|
<OtherSessionsSignOutContainer
|
|
appState={appState}
|
|
application={application}
|
|
/>
|
|
|
|
<ConfirmSignoutContainer appState={appState} application={application} />
|
|
</>
|
|
);
|
|
});
|
|
|
|
const ClearSessionDataView: FunctionComponent<{
|
|
application: WebApplication;
|
|
appState: AppState;
|
|
}> = observer(({ application, appState }) => {
|
|
return (
|
|
<>
|
|
<PreferencesGroup>
|
|
<PreferencesSegment>
|
|
<Title>Clear session data</Title>
|
|
<Text>This will delete all local items and preferences.</Text>
|
|
<div className="min-h-3" />
|
|
<Button
|
|
type="danger"
|
|
label="Clear Session Data"
|
|
onClick={() => {
|
|
appState.accountMenu.setSigningOut(true);
|
|
}}
|
|
/>
|
|
</PreferencesSegment>
|
|
</PreferencesGroup>
|
|
|
|
<ConfirmSignoutContainer appState={appState} application={application} />
|
|
</>
|
|
);
|
|
});
|
|
|
|
export const SignOutWrapper: FunctionComponent<{
|
|
application: WebApplication;
|
|
appState: AppState;
|
|
}> = observer(({ application, appState }) => {
|
|
if (!application.hasAccount())
|
|
return (
|
|
<ClearSessionDataView appState={appState} application={application} />
|
|
);
|
|
return <SignOutView appState={appState} application={application} />;
|
|
});
|