From 00486e94991f344353ffb083dd631283a84c3ad3 Mon Sep 17 00:00:00 2001 From: Hailey Date: Fri, 4 Oct 2024 13:24:12 -0700 Subject: [Sheets] [Pt. 1] Root PR (#5557) Co-authored-by: Samuel Newman Co-authored-by: Eric Bailey Co-authored-by: dan Co-authored-by: Hailey --- src/components/dialogs/MutedWords.tsx | 528 ++++++++++++++++++---------------- 1 file changed, 287 insertions(+), 241 deletions(-) (limited to 'src/components/dialogs/MutedWords.tsx') diff --git a/src/components/dialogs/MutedWords.tsx b/src/components/dialogs/MutedWords.tsx index 81a614103..c3aae8f0d 100644 --- a/src/components/dialogs/MutedWords.tsx +++ b/src/components/dialogs/MutedWords.tsx @@ -30,11 +30,14 @@ import {PageText_Stroke2_Corner0_Rounded as PageText} from '#/components/icons/P import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' import {Loader} from '#/components/Loader' +import {createPortalGroup} from '#/components/Portal' import * as Prompt from '#/components/Prompt' import {Text} from '#/components/Typography' const ONE_DAY = 24 * 60 * 60 * 1000 +const Portal = createPortalGroup() + export function MutedWordsDialog() { const {mutedWordsDialogControl: control} = useGlobalDialogsControlContext() return ( @@ -105,307 +108,349 @@ function MutedWordsInner() { }, [_, field, targets, addMutedWord, setField, durations, excludeFollowing]) return ( - - - - Add muted words and tags - - - - Posts can be muted based on their text, their tags, or both. We - recommend avoiding common words that appear in many posts, since it - can result in no posts being shown. - - - - - { - if (error) { - setError('') - } - setField(value) - }} - onSubmitEditing={submit} - /> - + + + + + Add muted words and tags + + + + Posts can be muted based on their text, their tags, or both. We + recommend avoiding common words that appear in many posts, since + it can result in no posts being shown. + + - - - - Duration: - + + { + if (error) { + setError('') + } + setField(value) + }} + onSubmitEditing={submit} + /> + + + + + + Duration: + - - - - - - - Forever - - - - + + + + + + + Forever + + + + + + + + + + + 24 hours + + + + + - - - - - - 24 hours - - - - + + + + + + + 7 days + + + + + + + + + + + 30 days + + + + + + - + + Mute in: + + + - 7 days + Text & tags + - 30 days + Tags only + - - + - - - Mute in: - - - + + + Options: + + label={_(msg`Do not apply this mute word to users you follow`)} + name="exclude_following" + style={[a.flex_row, a.justify_between]} + value={excludeFollowing} + onChange={setExcludeFollowing}> - + - Text & tags + Exclude users you follow - + - - - - - - Tags only - - - - - + + - - + {error && ( + + + {error} + + + )} + + + + + - Options: + Your muted words - - - - - - Exclude users you follow - - - - - - - - - - {error && ( - - + ) : preferencesError || !preferences ? ( + - {error} - - - )} - - - - - - - Your muted words - + + + We're sorry, but we weren't able to load your muted words at + this time. Please try again. + + + + ) : preferences.moderationPrefs.mutedWords.length ? ( + [...preferences.moderationPrefs.mutedWords] + .reverse() + .map((word, i) => ( + + )) + ) : ( + + + You haven't muted any words or tags yet + + + )} + - {isPreferencesLoading ? ( - - ) : preferencesError || !preferences ? ( - - - - We're sorry, but we weren't able to load your muted words at - this time. Please try again. - - - - ) : preferences.moderationPrefs.mutedWords.length ? ( - [...preferences.moderationPrefs.mutedWords] - .reverse() - .map((word, i) => ( - - )) - ) : ( - - - You haven't muted any words or tags yet - - - )} + {isNative && } - {isNative && } - + + - - + + ) } @@ -437,6 +482,7 @@ function MutedWordRow({ onConfirm={remove} confirmButtonCta={_(msg`Remove`)} confirmButtonColor="negative" + Portal={Portal.Portal} />