From bfe7c2ff385e5d06184237e8d460c8a5ba4d1bdb Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 15 Feb 2024 21:13:46 -0600 Subject: [PATCH] Mod screen design --- src/components/forms/ToggleButton.tsx | 4 +- src/screens/Moderation/index.tsx | 413 ++++++++++++++++---------- 2 files changed, 260 insertions(+), 157 deletions(-) diff --git a/src/components/forms/ToggleButton.tsx b/src/components/forms/ToggleButton.tsx index 7e1bd70b99..3e599b1cfe 100644 --- a/src/components/forms/ToggleButton.tsx +++ b/src/components/forms/ToggleButton.tsx @@ -8,7 +8,9 @@ import * as Toggle from '#/components/forms/Toggle' export type ItemProps = Omit & AccessibilityProps & - React.PropsWithChildren<{testID?: string}> + React.PropsWithChildren<{ + testID?: string + }> export type GroupProps = Omit & { multiple?: boolean diff --git a/src/screens/Moderation/index.tsx b/src/screens/Moderation/index.tsx index 8ed51dd5cb..4ab23465bc 100644 --- a/src/screens/Moderation/index.tsx +++ b/src/screens/Moderation/index.tsx @@ -31,7 +31,8 @@ import {Divider} from '#/components/Divider' import {CircleBanSign_Stroke2_Corner0_Rounded as CircleBanSign} from '#/components/icons/CircleBanSign' import {Group3_Stroke2_Corner0_Rounded as Group} from '#/components/icons/Group' import {Person_Stroke2_Corner0_Rounded as Person} from '#/components/icons/Person' -import {SquareBehindSquare4_Stroke2_Corner0_Rounded as SquareBehindSquare} from '#/components/icons/SquareBehindSquare4' +import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRight} from '#/components/icons/Chevron' +import {ChevronBottom_Stroke2_Corner0_Rounded as ChevronDown} from '#/components/icons/Chevron' import {Text} from '#/components/Typography' import * as Toggle from '#/components/forms/Toggle' import * as ToggleButton from '#/components/forms/ToggleButton' @@ -39,12 +40,13 @@ import {InlineLink, Link} from '#/components/Link' import {Loader} from '#/components/Loader' import {useLabelGroupStrings} from '#/lib/moderation/useLabelGroupStrings' import * as Dialog from '#/components/Dialog' -import {Button, ButtonText, ButtonIcon} from '#/components/Button' +import {Button} from '#/components/Button' import { getModerationServiceTitle, useConfigurableLabelGroups, getLabelGroupToLabelerMap, } from '#/lib/moderation' +import * as ModerationServiceCard from '#/components/ModerationServiceCard' import { SettingsDialog, @@ -109,7 +111,6 @@ export function ModerationScreen( ({ @@ -186,77 +187,145 @@ export function ModerationScreenInner({ - - {!gtTablet && } + + + Moderation tools + - - + - - - - Moderation lists - - - - - - - + + + + Moderation lists + + + + + + - - - - Muted accounts - - - - - - - + + + + Muted accounts + + + + + + - - - - Blocked accounts - - + a.justify_between, + a.p_lg, + a.gap_sm, + ]} + to="/moderation/blocked-accounts"> + + + + Blocked accounts + + + + + - + + Labeler subscriptions + - - - Content filtering settings - + + {modservices.map(mod => { + return ( + + + + + + + ) + })} + + + Content filtering + + + {groups.map((def, i) => { const labelers = labelGroupToLabelerMap[def.id] || [] return ( @@ -273,11 +342,17 @@ export function ModerationScreenInner({ })} - - - + Logged-out visibility + @@ -290,8 +365,8 @@ function LabelGroup({ labelGroup, labelers: mods, preferences, - openModSettingsDialog, -}: { +}: // openModSettingsDialog, +{ labelGroup: LabelGroupDefinition['id'] labelers: AppBskyModerationDefs.ModServiceViewDetailed[] preferences: UsePreferencesQueryResponse @@ -299,9 +374,11 @@ function LabelGroup({ }) { const t = useTheme() const {_} = useLingui() + const {gtMobile} = useBreakpoints() const labelGroupStrings = useLabelGroupStrings() const {mutateAsync: setContentLabelPref, variables: optimisticContentLabel} = useSetContentLabelMutation() + const [settingsOpen, setSettingsOpen] = React.useState(false) const onChangeVisibility = React.useCallback( async (values: string[]) => { @@ -329,7 +406,7 @@ function LabelGroup({ } return ( - + - + {name} {description} @@ -366,91 +443,115 @@ function LabelGroup({ {!!mods.length && ( - - - {mods.map(mod => { - const modservicePreferences = - preferences.moderationOpts.mods.find( - ({did}) => did === mod.creator.did, - ) - const labelGroupEnabled = - !modservicePreferences?.disabledLabelGroups?.includes( - labelGroup, - ) - const isLabelerEnabled = modservicePreferences?.enabled - const enabled = labelGroupEnabled && isLabelerEnabled - return ( - - - - {getModerationServiceTitle({ - displayName: mod.creator.displayName, - handle: mod.creator.handle, - })} - - - ) - })} - - + + + {settingsOpen && ( + + + + {mods.map((mod, i) => { + return ( + <> + {i !== 0 && } + + {}}> + + + {getModerationServiceTitle({ + displayName: mod.creator.displayName, + handle: mod.creator.handle, + })} + + + + + + ) + })} + + )} )} @@ -514,7 +615,7 @@ function PwiOptOut() { }, [updateProfile, profile]) return ( - +