isUnderage -> isDeclaredUnderage

This commit is contained in:
Eric Bailey
2025-07-15 17:08:19 -05:00
parent 6ac8b47b57
commit 97a056fbeb
5 changed files with 13 additions and 12 deletions
@@ -20,10 +20,10 @@ import {createStaticClick, InlineLinkText} from '#/components/Link'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
export function AgeAssuranceAccountCard({style}: ViewStyleProp & {}) { export function AgeAssuranceAccountCard({style}: ViewStyleProp & {}) {
const {isReady, isAgeRestricted, isUnderage} = useAgeAssurance() const {isReady, isAgeRestricted, isDeclaredUnderage} = useAgeAssurance()
if (!isReady) return null if (!isReady) return null
if (isUnderage) return null if (isDeclaredUnderage) return null
if (!isAgeRestricted) return null if (!isAgeRestricted) return null
return <Inner style={style} /> return <Inner style={style} />
@@ -15,10 +15,10 @@ export function AgeAssuranceAdmonition({
style, style,
}: ViewStyleProp & {children: React.ReactNode}) { }: ViewStyleProp & {children: React.ReactNode}) {
const control = useDialogControl() const control = useDialogControl()
const {isReady, isUnderage, isAgeRestricted} = useAgeAssurance() const {isReady, isDeclaredUnderage, isAgeRestricted} = useAgeAssurance()
if (!isReady) return null if (!isReady) return null
if (isUnderage) return null if (isDeclaredUnderage) return null
if (!isAgeRestricted) return null if (!isAgeRestricted) return null
return ( return (
@@ -12,14 +12,15 @@ import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times'
export function AgeAssuranceDismissableNotice({style}: ViewStyleProp & {}) { export function AgeAssuranceDismissableNotice({style}: ViewStyleProp & {}) {
const {_} = useLingui() const {_} = useLingui()
const {isReady, isUnderage, isAgeRestricted, assurance} = useAgeAssurance() const {isReady, isDeclaredUnderage, isAgeRestricted, assurance} =
useAgeAssurance()
const {nux} = useNux(Nux.AgeAssuranceDismissableNotice) const {nux} = useNux(Nux.AgeAssuranceDismissableNotice)
const copy = useAgeAssuranceCopy() const copy = useAgeAssuranceCopy()
const {mutate: save, variables} = useSaveNux() const {mutate: save, variables} = useSaveNux()
const hidden = !!variables const hidden = !!variables
if (!isReady) return null if (!isReady) return null
if (isUnderage) return null if (isDeclaredUnderage) return null
if (!isAgeRestricted) return null if (!isAgeRestricted) return null
if (assurance.lastInitiatedAt) return null if (assurance.lastInitiatedAt) return null
if (hidden) return null if (hidden) return null
+3 -3
View File
@@ -160,7 +160,7 @@ export function ModerationScreenInner({
data: labelers, data: labelers,
error: labelersError, error: labelersError,
} = useMyLabelersQuery() } = useMyLabelersQuery()
const {declaredAge, isUnderage, isAgeRestricted} = useAgeAssurance() const {declaredAge, isDeclaredUnderage, isAgeRestricted} = useAgeAssurance()
useFocusEffect( useFocusEffect(
useCallback(() => { useCallback(() => {
@@ -345,7 +345,7 @@ export function ModerationScreenInner({
a.overflow_hidden, a.overflow_hidden,
t.atoms.bg_contrast_25, t.atoms.bg_contrast_25,
]}> ]}>
{!isUnderage && !isAgeRestricted && ( {!isDeclaredUnderage && !isAgeRestricted && (
<> <>
<View <View
style={[ style={[
@@ -414,7 +414,7 @@ export function ModerationScreenInner({
</> </>
)} )}
<GlobalLabelPreference <GlobalLabelPreference
disabled={isUnderage || isAgeRestricted} disabled={isDeclaredUnderage || isAgeRestricted}
labelDefinition={LABELS.nudity} labelDefinition={LABELS.nudity}
/> />
</View> </View>
+3 -3
View File
@@ -10,7 +10,7 @@ const logger = Logger.create(Logger.Context.AgeAssurance)
type AgeAssurance = { type AgeAssurance = {
isReady: boolean isReady: boolean
declaredAge: number | undefined declaredAge: number | undefined
isUnderage: boolean isDeclaredUnderage: boolean
isAgeRestricted: boolean isAgeRestricted: boolean
assurance: ReturnType<typeof useAgeAssuranceContext> assurance: ReturnType<typeof useAgeAssuranceContext>
} }
@@ -29,11 +29,11 @@ export function useAgeAssurance(): AgeAssurance {
return useMemo(() => { return useMemo(() => {
const isReady = ctx.isReady && preferencesLoaded const isReady = ctx.isReady && preferencesLoaded
const isUnderage = (declaredAge || 0) < 18 const isDeclaredUnderage = (declaredAge || 0) < 18
const state: AgeAssurance = { const state: AgeAssurance = {
isReady, isReady,
declaredAge, declaredAge,
isUnderage, isDeclaredUnderage,
isAgeRestricted, isAgeRestricted,
assurance: ctx, assurance: ctx,