diff --git a/src/alf/index.tsx b/src/alf/index.tsx index 27738e91..f0a0ede7 100644 --- a/src/alf/index.tsx +++ b/src/alf/index.tsx @@ -16,6 +16,7 @@ type BreakpointName = keyof typeof breakpoints const breakpoints: { [key: string]: number } = { + gtPhone: 500, gtMobile: 800, gtTablet: 1300, } @@ -26,6 +27,7 @@ function getActiveBreakpoints({width}: {width: number}) { return { active: active[active.length - 1], + gtPhone: active.includes('gtPhone'), gtMobile: active.includes('gtMobile'), gtTablet: active.includes('gtTablet'), } @@ -39,6 +41,7 @@ export const Context = React.createContext<{ theme: themes.Theme breakpoints: { active: BreakpointName | undefined + gtPhone: boolean gtMobile: boolean gtTablet: boolean } @@ -47,6 +50,7 @@ export const Context = React.createContext<{ theme: themes.light, breakpoints: { active: undefined, + gtPhone: false, gtMobile: false, gtTablet: false, }, diff --git a/src/components/moderation/ModerationLabelPref.tsx b/src/components/moderation/ModerationLabelPref.tsx index f1455048..b16c2485 100644 --- a/src/components/moderation/ModerationLabelPref.tsx +++ b/src/components/moderation/ModerationLabelPref.tsx @@ -12,7 +12,7 @@ import { } from '#/state/queries/preferences' import {getLabelStrings} from '#/lib/moderation/useLabelInfo' -import {useTheme, atoms as a} from '#/alf' +import {useTheme, atoms as a, useBreakpoints} from '#/alf' import {Text} from '#/components/Typography' import {InlineLink} from '#/components/Link' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '../icons/CircleInfo' @@ -29,6 +29,7 @@ export function ModerationLabelPref({ }) { const {_, i18n} = useLingui() const t = useTheme() + const {gtPhone} = useBreakpoints() const isGlobalLabel = !labelValueDefinition.definedBy const {identifier} = labelValueDefinition @@ -57,6 +58,7 @@ export function ModerationLabelPref({ adultOnly && !preferences?.moderationPrefs.adultContentEnabled // are there any reasons we cant configure this label here? const cantConfigure = isGlobalLabel || adultDisabled + const showConfig = !disabled && (gtPhone || !cantConfigure) // adjust the pref based on whether warn is available let prefAdjusted = pref @@ -85,9 +87,19 @@ export function ModerationLabelPref({ ) return ( - + - {labelStrings.name} + + {labelStrings.name} + {labelStrings.description} @@ -113,40 +125,51 @@ export function ModerationLabelPref({ )} - {disabled ? ( - <> - ) : cantConfigure ? ( - - - {currentPrefLabel} - - - ) : ( - - - mutate({ - label: identifier, - visibility: newPref[0] as LabelPreference, - labelerDid, - }) - }> - - {ignoreLabel} - - {canWarn && ( - - {warnLabel} - - )} - - {hideLabel} - - + + {showConfig && ( + + {cantConfigure ? ( + + + {currentPrefLabel} + + + ) : ( + + + mutate({ + label: identifier, + visibility: newPref[0] as LabelPreference, + labelerDid, + }) + }> + + {ignoreLabel} + + {canWarn && ( + + {warnLabel} + + )} + + {hideLabel} + + + + )} )}