From a355eedf85b557f49eeb8722aac4fbddf40a0afc Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 18 Dec 2025 11:05:39 -0600 Subject: [PATCH] Improve instructions on NoAccessScreen and bday dialog (#9571) --- .../components/NoAccessScreen.tsx | 78 ++++++++----------- src/components/dialogs/BirthDateSettings.tsx | 15 +++- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/src/ageAssurance/components/NoAccessScreen.tsx b/src/ageAssurance/components/NoAccessScreen.tsx index 8b2a44c267..3aa69dc789 100644 --- a/src/ageAssurance/components/NoAccessScreen.tsx +++ b/src/ageAssurance/components/NoAccessScreen.tsx @@ -9,12 +9,11 @@ import { useCreateSupportLink, } from '#/lib/hooks/useCreateSupportLink' import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo' -import {isAppPassword} from '#/lib/jwt' import {logger} from '#/logger' import {isWeb} from '#/platform/detection' import {isNative} from '#/platform/detection' import {useIsBirthdateUpdateAllowed} from '#/state/birthdate' -import {useSession, useSessionApi} from '#/state/session' +import {useSessionApi} from '#/state/session' import {atoms as a, useBreakpoints, useTheme, web} from '#/alf' import {Admonition} from '#/components/Admonition' import {AgeAssuranceAppealDialog} from '#/components/ageAssurance/AgeAssuranceAppealDialog' @@ -30,7 +29,7 @@ import {ShieldCheck_Stroke2_Corner0_Rounded as ShieldIcon} from '#/components/ic import {createStaticClick, SimpleInlineLinkText} from '#/components/Link' import {Outlet as PortalOutlet} from '#/components/Portal' import * as Toast from '#/components/Toast' -import {Span, Text} from '#/components/Typography' +import {Text} from '#/components/Typography' import {BottomSheetOutlet} from '#/../modules/bottom-sheet' import {useAgeAssurance} from '#/ageAssurance' import {useAgeAssuranceDataContext} from '#/ageAssurance/data' @@ -55,9 +54,6 @@ export function NoAccessScreen() { const {logoutCurrentAccount} = useSessionApi() const createSupportLink = useCreateSupportLink() - const {currentAccount} = useSession() - const isUsingAppPassword = isAppPassword(currentAccount?.accessJwt || '') - const aa = useAgeAssurance() const isBlocked = aa.state.status === aa.Status.Blocked const isAARegion = !!region @@ -89,22 +85,38 @@ export function NoAccessScreen() { logoutCurrentAccount('AgeAssuranceNoAccessScreen') }, [logoutCurrentAccount]) - const birthdateUpdateText = canUpdateBirthday ? ( - + const orgAdmonition = ( + - If you believe your birthdate is incorrect, you can update it by{' '} - { - logger.metric('ageAssurance:noAccessScreen:openBirthdateDialog', {}) - birthdateControl.open() - })}> - clicking here - - . + For organizational accounts, use the birthdate of the person who is + responsible for the account. - + + ) + + const birthdateUpdateText = canUpdateBirthday ? ( + <> + + + If you believe your birthdate is incorrect, you can update it by{' '} + { + logger.metric( + 'ageAssurance:noAccessScreen:openBirthdateDialog', + {}, + ) + birthdateControl.open() + })}> + clicking here + + . + + + + {orgAdmonition} + ) : ( @@ -120,15 +132,6 @@ export function NoAccessScreen() { ) - const orgAdmonition = ( - - - For organizational accounts, use the birthdate of the person who is - responsible for the account. - - - ) - return ( <> @@ -175,8 +178,6 @@ export function NoAccessScreen() { {!isBlocked && birthdateUpdateText} - - {orgAdmonition} @@ -191,8 +192,6 @@ export function NoAccessScreen() { {birthdateUpdateText} - - {orgAdmonition} )} @@ -224,18 +223,7 @@ export function NoAccessScreen() { - {isUsingAppPassword ? ( - - - Hmm, it looks like you're logged in with an{' '} - App Password. To set your - birthdate, you'll need to log in with your main account - password, or ask whomever controls this account to do so. - - - ) : ( - orgAdmonition - )} + {orgAdmonition} )} diff --git a/src/components/dialogs/BirthDateSettings.tsx b/src/components/dialogs/BirthDateSettings.tsx index c5205bf71f..f258824a91 100644 --- a/src/components/dialogs/BirthDateSettings.tsx +++ b/src/components/dialogs/BirthDateSettings.tsx @@ -4,6 +4,7 @@ import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useCleanError} from '#/lib/hooks/useCleanError' +import {isAppPassword} from '#/lib/jwt' import {getAge, getDateAgo} from '#/lib/strings/time' import {logger} from '#/logger' import {isIOS, isWeb} from '#/platform/detection' @@ -15,6 +16,7 @@ import { usePreferencesQuery, type UsePreferencesQueryResponse, } from '#/state/queries/preferences' +import {useSession} from '#/state/session' import {ErrorMessage} from '#/view/com/util/error/ErrorMessage' import {atoms as a, useTheme, web} from '#/alf' import {Admonition} from '#/components/Admonition' @@ -23,7 +25,7 @@ import * as Dialog from '#/components/Dialog' import {DateField} from '#/components/forms/DateField' import {SimpleInlineLinkText} from '#/components/Link' import {Loader} from '#/components/Loader' -import {Text} from '#/components/Typography' +import {Span, Text} from '#/components/Typography' export function BirthDateSettingsDialog({ control, @@ -34,6 +36,8 @@ export function BirthDateSettingsDialog({ const {_} = useLingui() const {isLoading, error, data: preferences} = usePreferencesQuery() const isBirthdateUpdateAllowed = useIsBirthdateUpdateAllowed() + const {currentAccount} = useSession() + const isUsingAppPassword = isAppPassword(currentAccount?.accessJwt || '') return ( @@ -65,6 +69,15 @@ export function BirthDateSettingsDialog({ } style={[a.rounded_sm]} /> + ) : isUsingAppPassword ? ( + + + Hmm, it looks like you're logged in with an{' '} + App Password. To set your + birthdate, you'll need to log in with your main account + password, or ask whomever controls this account to do so. + + ) : ( )}