From cca344a3d1cdca3d4e63806a9bd5f7867f8961d4 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 9 Oct 2024 21:30:42 +0300 Subject: Allow nested sheets without boilerplate (#5660) Co-authored-by: Hailey --- src/components/dialogs/MutedWords.tsx | 528 ++++++++++++++++------------------ 1 file changed, 241 insertions(+), 287 deletions(-) (limited to 'src/components/dialogs/MutedWords.tsx') diff --git a/src/components/dialogs/MutedWords.tsx b/src/components/dialogs/MutedWords.tsx index c3aae8f0d..81a614103 100644 --- a/src/components/dialogs/MutedWords.tsx +++ b/src/components/dialogs/MutedWords.tsx @@ -30,14 +30,11 @@ 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 ( @@ -108,349 +105,307 @@ 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. + + + + + { + if (error) { + setError('') + } + setField(value) + }} + onSubmitEditing={submit} + /> + - - - - Duration: - + + + + Duration: + + - - - - - - - Forever - - - - - - - - - - - 24 hours - - - - - + + + + + + Forever + + + + - - - - - - - 7 days - - - - - - - - - - - 30 days - - - - - + + + + + + 24 hours + + + + - - - - Mute in: - - - - Text & tags + 7 days - - Tags only + 30 days - - + + - - - Options: - + + + Mute in: + + + + label={_(msg`Mute this word in post text and tags`)} + name="content" + style={[a.flex_1]}> - + - Exclude users you follow + Text & tags + - - - + + + + + + Tags only + + + + + + - {error && ( - - - {error} - - - )} - - - - - + - Your muted words + Options: + + + + + + Exclude users you follow + + + + + - {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) => ( - - )) - ) : ( - + + + + {error && ( + + - - You haven't muted any words or tags yet - - - )} - + {error} + + + )} + + + - {isNative && } + + + Your muted words + + + {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 && } + - - + + ) } @@ -482,7 +437,6 @@ function MutedWordRow({ onConfirm={remove} confirmButtonCta={_(msg`Remove`)} confirmButtonColor="negative" - Portal={Portal.Portal} />