From b8243f8a87333fc6dae9e348fd6746179ad145ec Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 19 Nov 2023 05:48:35 +0100 Subject: [PATCH] Update lurker corner to switch back to session --- components/header.js | 21 ++++++++++++++++++++- components/switch-account.js | 12 +++++++++--- middleware.js | 9 +++++++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/components/header.js b/components/header.js index 05a41335..876b0d91 100644 --- a/components/header.js +++ b/components/header.js @@ -28,7 +28,7 @@ import { clearNotifications } from '../lib/badge' import { useServiceWorker } from './serviceworker' import SubSelect from './sub-select' import { useShowModal } from './modal' -import SwitchAccountDialog from './switch-account' +import SwitchAccountDialog, { useAccounts } from './switch-account' function WalletSummary ({ me }) { if (!me) return null @@ -177,6 +177,8 @@ function StackerCorner ({ dropNavKey }) { function LurkerCorner ({ path }) { const router = useRouter() const strike = useLightning() + const { isAnon } = useAccounts() + const showModal = useShowModal() useEffect(() => { if (!window.localStorage.getItem('striked')) { @@ -193,6 +195,23 @@ function LurkerCorner ({ path }) { query: { callbackUrl: window.location.origin + router.asPath } }), [router]) + if (isAnon) { + return ( +
+ + + + @anon + + + + showModal(onClose => )}>switch account + + +
+ ) + } + return path !== '/login' && path !== '/signup' && !path.startsWith('/invites') &&