From c1e7b93688df26444f50a77254bd7d331ece1cfb Mon Sep 17 00:00:00 2001 From: ekzyis Date: Tue, 5 Dec 2023 05:11:14 +0100 Subject: [PATCH] Use click on nym to switch --- components/switch-account.js | 7 ++++--- components/user-list.js | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/components/switch-account.js b/components/switch-account.js index af8808f4..cb7563b9 100644 --- a/components/switch-account.js +++ b/components/switch-account.js @@ -79,7 +79,9 @@ const AccountListRow = ({ account, ...props }) => { } ) - const onClick = async () => { + const onClick = async (e) => { + // prevent navigation + e.preventDefault() document.cookie = `multi_auth.user-id=${anonRow ? 'anonymous' : account.id}; Path=/; Secure` if (anonRow) { // order is important to prevent flashes of no session @@ -94,8 +96,7 @@ const AccountListRow = ({ account, ...props }) => { // can't show hat since we don't have access to the streak from the data available in the cookies return (
- -
switch
+ {selected &&
selected
}
) diff --git a/components/user-list.js b/components/user-list.js index a2dc44f9..b4fa7c3f 100644 --- a/components/user-list.js +++ b/components/user-list.js @@ -36,7 +36,7 @@ function seperate (arr, seperator) { return arr.flatMap((x, i) => i < arr.length - 1 ? [x, seperator] : [x]) } -export const UserListRow = ({ user, stats, className, showHat = true }) => { +export const UserListRow = ({ user, stats, className, onNymClick, showHat = true }) => { return (
@@ -46,7 +46,9 @@ export const UserListRow = ({ user, stats, className, showHat = true }) => { />
- + @{user.name}{showHat && } {stats && (