diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-03-20 15:37:14 +0000 |
---|---|---|
committer | Samuel Newman <mozzius@protonmail.com> | 2024-03-20 15:37:14 +0000 |
commit | d24ffba01d7aa5a505b4e3d319dfecffc3d039ca (patch) | |
tree | 4e860ca6a6dd038f41bba1839d180177b70c877b /src/lib/hooks | |
parent | 2fa26ceedc1c7f6f3c4a1bdeab621b34c24bcb17 (diff) | |
parent | 023e12bb4ec1dade373c810a13d8bba6d96a22be (diff) | |
download | voidsky-d24ffba01d7aa5a505b4e3d319dfecffc3d039ca.tar.zst |
Merge remote-tracking branch 'origin/main' into samuel/alf-login
Diffstat (limited to 'src/lib/hooks')
-rw-r--r-- | src/lib/hooks/useAccountSwitcher.ts | 8 | ||||
-rw-r--r-- | src/lib/hooks/useWebBodyScrollLock.ts | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts index 74b5674d5..eb1685a0a 100644 --- a/src/lib/hooks/useAccountSwitcher.ts +++ b/src/lib/hooks/useAccountSwitcher.ts @@ -6,6 +6,7 @@ import {useSessionApi, SessionAccount} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {useCloseAllActiveElements} from '#/state/util' import {useLoggedOutViewControls} from '#/state/shell/logged-out' +import {LogEvents} from '../statsig/statsig' export function useAccountSwitcher() { const {track} = useAnalytics() @@ -14,7 +15,10 @@ export function useAccountSwitcher() { const {requestSwitchToAccount} = useLoggedOutViewControls() const onPressSwitchAccount = useCallback( - async (account: SessionAccount) => { + async ( + account: SessionAccount, + logContext: LogEvents['account:loggedIn']['logContext'], + ) => { track('Settings:SwitchAccountButtonClicked') try { @@ -28,7 +32,7 @@ export function useAccountSwitcher() { // So we change the URL ourselves. The navigator will pick it up on remount. history.pushState(null, '', '/') } - await selectAccount(account) + await selectAccount(account, logContext) setTimeout(() => { Toast.show(`Signed in as @${account.handle}`) }, 100) diff --git a/src/lib/hooks/useWebBodyScrollLock.ts b/src/lib/hooks/useWebBodyScrollLock.ts index 585f193f1..0dcf911fe 100644 --- a/src/lib/hooks/useWebBodyScrollLock.ts +++ b/src/lib/hooks/useWebBodyScrollLock.ts @@ -6,6 +6,7 @@ let refCount = 0 function incrementRefCount() { if (refCount === 0) { document.body.style.overflow = 'hidden' + document.documentElement.style.scrollbarGutter = 'auto' } refCount++ } @@ -14,6 +15,7 @@ function decrementRefCount() { refCount-- if (refCount === 0) { document.body.style.overflow = '' + document.documentElement.style.scrollbarGutter = '' } } |