From 7469e7306cd8bc148c6a926daa2378c1fb858d88 Mon Sep 17 00:00:00 2001 From: Chenyu <10610892+BinaryFiddler@users.noreply.github.com> Date: Wed, 27 Aug 2025 17:55:18 -0700 Subject: Update birthday setting dialog (#8910) * update birthday setting dialog * Update src/components/dialogs/BirthDateSettings.tsx Co-authored-by: Eric Bailey --------- Co-authored-by: Eric Bailey --- src/components/dialogs/BirthDateSettings.tsx | 91 +++++++++++++++++++--------- 1 file changed, 63 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/components/dialogs/BirthDateSettings.tsx b/src/components/dialogs/BirthDateSettings.tsx index fecfc43bc..0b8dfb540 100644 --- a/src/components/dialogs/BirthDateSettings.tsx +++ b/src/components/dialogs/BirthDateSettings.tsx @@ -4,21 +4,23 @@ import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {cleanError} from '#/lib/strings/errors' -import {getDateAgo} from '#/lib/strings/time' +import {getAge, getDateAgo} from '#/lib/strings/time' import {logger} from '#/logger' import {isIOS, isWeb} from '#/platform/detection' import { usePreferencesQuery, - UsePreferencesQueryResponse, + type UsePreferencesQueryResponse, usePreferencesSetBirthDateMutation, } from '#/state/queries/preferences' import {ErrorMessage} from '#/view/com/util/error/ErrorMessage' -import {atoms as a, useTheme} from '#/alf' +import {atoms as a, useTheme, web} from '#/alf' +import {Admonition} from '#/components/Admonition' +import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {DateField} from '#/components/forms/DateField' +import {InlineLinkText} from '#/components/Link' import {Loader} from '#/components/Loader' import {Text} from '#/components/Typography' -import {Button, ButtonIcon, ButtonText} from '../Button' export function BirthDateSettingsDialog({ control, @@ -32,31 +34,35 @@ export function BirthDateSettingsDialog({ return ( - - - + + + My Birthday - - This information is not shared with other users. + + + This information is private and not shared with other users. + - - {isLoading ? ( - - ) : error || !preferences ? ( - - ) : ( - - )} + {isLoading ? ( + + ) : error || !preferences ? ( + + ) : ( + + )} + @@ -72,7 +78,9 @@ function BirthdayInner({ preferences: UsePreferencesQueryResponse }) { const {_} = useLingui() - const [date, setDate] = React.useState(preferences.birthDate || new Date()) + const [date, setDate] = React.useState( + preferences.birthDate || getDateAgo(18), + ) const { isPending, isError, @@ -81,6 +89,10 @@ function BirthdayInner({ } = usePreferencesSetBirthDateMutation() const hasChanged = date !== preferences.birthDate + const age = getAge(new Date(date)) + const isUnder13 = age < 13 + const isUnder18 = age >= 13 && age < 18 + const onSave = React.useCallback(async () => { try { // skip if date is the same @@ -102,10 +114,32 @@ function BirthdayInner({ onChangeDate={newDate => setDate(new Date(newDate))} label={_(msg`Birthday`)} accessibilityHint={_(msg`Enter your birth date`)} - maximumDate={getDateAgo(13)} /> + {isUnder18 && hasChanged && ( + + + The birthdate you've entered means you are under 18 years old. + Certain content and features may be unavailable to you. + + + )} + + {isUnder13 && ( + + + You must be at least 13 years old to use Bluesky. Read our{' '} + + Terms of Service + {' '} + for more information. + + + )} + {isError ? ( ) : undefined} @@ -116,7 +150,8 @@ function BirthdayInner({ size="large" onPress={onSave} variant="solid" - color="primary"> + color="primary" + disabled={isUnder13}> {hasChanged ? Save : Done} -- cgit 1.4.1