fix: sign out dialog disappearing when account menu is unfocused (#863)

This commit is contained in:
Aman Harwara
2022-02-12 20:53:49 +05:30
committed by GitHub
parent 65b0e254c9
commit 0e1b94b5cd
3 changed files with 24 additions and 32 deletions

View File

@@ -1,5 +1,4 @@
import { Button } from '@/components/Button';
import { ConfirmSignoutContainer } from '@/components/ConfirmSignoutModal';
import { OtherSessionsSignOutContainer } from '@/components/OtherSessionsSignOut';
import {
PreferencesGroup,
@@ -58,35 +57,28 @@ const SignOutView: FunctionComponent<{
appState={appState}
application={application}
/>
<ConfirmSignoutContainer appState={appState} application={application} />
</>
);
});
const ClearSessionDataView: FunctionComponent<{
application: WebApplication;
appState: AppState;
}> = observer(({ application, appState }) => {
}> = observer(({ 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} />
</>
<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>
);
});
@@ -94,9 +86,8 @@ export const SignOutWrapper: FunctionComponent<{
application: WebApplication;
appState: AppState;
}> = observer(({ application, appState }) => {
if (!application.hasAccount())
return (
<ClearSessionDataView appState={appState} application={application} />
);
if (!application.hasAccount()) {
return <ClearSessionDataView appState={appState} />;
}
return <SignOutView appState={appState} application={application} />;
});