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