diff options
author | Eric Bailey <git@esb.lol> | 2025-02-06 11:51:40 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-06 11:51:40 -0600 |
commit | 9cd4f92027774029234e38980fac3a12f136166f (patch) | |
tree | 52805dd7ba11a128bc0cf582c984d89d9a7c390d /src/components/dialogs/PostInteractionSettingsDialog.tsx | |
parent | 1db2668a96208046ffe316114f65d432e57db994 (diff) | |
download | voidsky-9cd4f92027774029234e38980fac3a12f136166f.tar.zst |
[APP-1013] Configure and apply default post interaction settings from user preferences (#7664)
* Add interaction settings screen * Move header out of interaction settings form * WIP hook it up * Thread through default settings into composer * Update copy pasta * Handle edited state * Copy feedback * Sentence case Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Update copy * Bump SDK * Fix new type error * Less in your face * Remove new dep * Add slot * Copy edit --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
Diffstat (limited to 'src/components/dialogs/PostInteractionSettingsDialog.tsx')
-rw-r--r-- | src/components/dialogs/PostInteractionSettingsDialog.tsx | 82 |
1 files changed, 56 insertions, 26 deletions
diff --git a/src/components/dialogs/PostInteractionSettingsDialog.tsx b/src/components/dialogs/PostInteractionSettingsDialog.tsx index a698574a4..b443d59f2 100644 --- a/src/components/dialogs/PostInteractionSettingsDialog.tsx +++ b/src/components/dialogs/PostInteractionSettingsDialog.tsx @@ -40,6 +40,7 @@ import {Loader} from '#/components/Loader' import {Text} from '#/components/Typography' export type PostInteractionSettingsFormProps = { + canSave?: boolean onSave: () => void isSaving?: boolean @@ -58,20 +59,53 @@ export function PostInteractionSettingsControlledDialog({ }: PostInteractionSettingsFormProps & { control: Dialog.DialogControlProps }) { + const t = useTheme() const {_} = useLingui() + return ( <Dialog.Outer control={control}> <Dialog.Handle /> <Dialog.ScrollableInner label={_(msg`Edit post interaction settings`)} style={[{maxWidth: 500}, a.w_full]}> - <PostInteractionSettingsForm {...rest} /> + <View style={[a.gap_md]}> + <Header /> + <PostInteractionSettingsForm {...rest} /> + <Text + style={[ + a.pt_sm, + a.text_sm, + a.leading_snug, + t.atoms.text_contrast_medium, + ]}> + <Trans> + You can set default interaction settings in{' '} + <Text style={[a.font_bold, t.atoms.text_contrast_medium]}> + Settings → Moderation → Interaction settings. + </Text> + </Trans> + </Text> + </View> <Dialog.Close /> </Dialog.ScrollableInner> </Dialog.Outer> ) } +export function Header() { + return ( + <View style={[a.gap_md, a.pb_sm]}> + <Text style={[a.text_2xl, a.font_bold]}> + <Trans>Post interaction settings</Trans> + </Text> + <Text style={[a.text_md, a.pb_xs]}> + <Trans>Customize who can interact with this post.</Trans> + </Text> + <Divider /> + </View> + ) +} + export type PostInteractionSettingsDialogProps = { control: Dialog.DialogControlProps /** @@ -203,26 +237,31 @@ export function PostInteractionSettingsDialogControlledInner( <Dialog.ScrollableInner label={_(msg`Edit post interaction settings`)} style={[{maxWidth: 500}, a.w_full]}> - {isLoading ? ( - <View style={[a.flex_1, a.py_4xl, a.align_center, a.justify_center]}> - <Loader size="xl" /> - </View> - ) : ( - <PostInteractionSettingsForm - replySettingsDisabled={!isThreadgateOwnedByViewer} - isSaving={isSaving} - onSave={onSave} - postgate={postgateValue} - onChangePostgate={setEditedPostgate} - threadgateAllowUISettings={allowUIValue} - onChangeThreadgateAllowUISettings={setEditedAllowUISettings} - /> - )} + <View style={[a.gap_md]}> + <Header /> + + {isLoading ? ( + <View style={[a.flex_1, a.py_4xl, a.align_center, a.justify_center]}> + <Loader size="xl" /> + </View> + ) : ( + <PostInteractionSettingsForm + replySettingsDisabled={!isThreadgateOwnedByViewer} + isSaving={isSaving} + onSave={onSave} + postgate={postgateValue} + onChangePostgate={setEditedPostgate} + threadgateAllowUISettings={allowUIValue} + onChangeThreadgateAllowUISettings={setEditedAllowUISettings} + /> + )} + </View> </Dialog.ScrollableInner> ) } export function PostInteractionSettingsForm({ + canSave = true, onSave, isSaving, postgate, @@ -283,17 +322,7 @@ export function PostInteractionSettingsForm({ return ( <View> <View style={[a.flex_1, a.gap_md]}> - <Text style={[a.text_2xl, a.font_bold]}> - <Trans>Post interaction settings</Trans> - </Text> - <View style={[a.gap_lg]}> - <Text style={[a.text_md]}> - <Trans>Customize who can interact with this post.</Trans> - </Text> - - <Divider /> - <View style={[a.gap_sm]}> <Text style={[a.font_bold, a.text_lg]}> <Trans>Quote settings</Trans> @@ -435,6 +464,7 @@ export function PostInteractionSettingsForm({ </View> <Button + disabled={!canSave || isSaving} label={_(msg`Save`)} onPress={onSave} color="primary" |