Revert "feat: handle unprotected session expiration (#747)"

This reverts commit 8db549f6f6.
This commit is contained in:
Karol Sójko
2021-12-15 15:26:31 +01:00
parent 0e4757d426
commit 2e168df929
26 changed files with 755 additions and 418 deletions

View File

@@ -1,41 +1,27 @@
import { AppState } from '@/ui_models/app_state';
import { toDirective } from './utils';
type Props = {
appState: AppState;
onViewNote: () => void;
requireAuthenticationForProtectedNote: boolean;
};
function NoProtectionsNoteWarning({
appState,
onViewNote,
requireAuthenticationForProtectedNote,
}: Props) {
const instructionText = requireAuthenticationForProtectedNote
? 'Authenticate to view this note.'
: 'Add a passcode or create an account to require authentication to view this note.';
type Props = { appState: AppState; onViewNote: () => void };
function NoProtectionsNoteWarning({ appState, onViewNote }: Props) {
return (
<div className="flex flex-col items-center justify-center text-center max-w-md">
<h1 className="text-2xl m-0 w-full">This note is protected</h1>
<p className="text-lg mt-2 w-full">{instructionText}</p>
<p className="text-lg mt-2 w-full">
Add a passcode or create an account to require authentication to view
this note.
</p>
<div className="mt-4 flex gap-3">
{!requireAuthenticationForProtectedNote && (
<button
className="sn-button small info"
onClick={() => {
appState.accountMenu.setShow(true);
}}
>
Open account menu
</button>
)}
<button
className="sn-button small outlined normal-focus-brightness"
onClick={onViewNote}
className="sn-button small info"
onClick={() => {
appState.accountMenu.setShow(true);
}}
>
{requireAuthenticationForProtectedNote ? 'Authenticate' : 'View Note'}
Open account menu
</button>
<button className="sn-button small outlined" onClick={onViewNote}>
View note
</button>
</div>
</div>
@@ -46,6 +32,5 @@ export const NoProtectionsdNoteWarningDirective = toDirective<Props>(
NoProtectionsNoteWarning,
{
onViewNote: '&',
requireAuthenticationForProtectedNote: '=',
}
);