diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-10-31 20:45:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-31 20:45:34 +0000 |
commit | aa6aad652e8091ea6039af82f41d4de3669a5944 (patch) | |
tree | bb9b51ebc38728aaf38b3f0c4318ff702bcebd5d /src/screens/Settings/FollowingFeedPreferences.tsx | |
parent | d85dcc3dd06b49fccee66bc9e16cd8d0938f5c82 (diff) | |
download | voidsky-aa6aad652e8091ea6039af82f41d4de3669a5944.tar.zst |
[Settings] Thread prefs revamp (#5772)
* thread preferences screen * minor tweaks * more spacing * replace gate with IS_INTERNAL * [Settings] Following feed prefs revamp (#5773) * gated new settings screen * Following feed prefs * Update src/screens/Settings/FollowingFeedPreferences.tsx Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * Update src/screens/Settings/FollowingFeedPreferences.tsx Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * replace pref following feed gate * Update src/screens/Settings/FollowingFeedPreferences.tsx Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * use "Experimental" as the header --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * [Settings] External media prefs revamp (#5774) * gated new settings screen * external media prefs revamp * replace gate ext media embeds * Update src/screens/Settings/ExternalMediaPreferences.tsx Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * add imports for translation * alternate list style on native --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * [Settings] Languages revamp (partial) (#5775) * language settings (lazy restyle) * replace gate * fix text determining flex space * [Settings] App passwords revamp (#5777) * rework app passwords screen * Apply surfdude's copy changes Thanks @surfdude29! Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * format * replace gate * use admonition for input error and animate --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * [Settings] Change handle dialog (#5781) * new change handle dialog * animations native only * overflow hidden on togglebutton animation * add a low-contrast border * extract out copybutton * finish change handle dialog * invalidate query on success * web fixes * error message for rate limit exceeded * typo * em dash! Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * another em dash Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * set maxwidth of suffixtext * Copy tweak Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com> * [Settings] Notifs settings revamp (#5884) * rename, move, and restyle notif settings * bold "experimental:" --------- Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
Diffstat (limited to 'src/screens/Settings/FollowingFeedPreferences.tsx')
-rw-r--r-- | src/screens/Settings/FollowingFeedPreferences.tsx | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/src/screens/Settings/FollowingFeedPreferences.tsx b/src/screens/Settings/FollowingFeedPreferences.tsx new file mode 100644 index 000000000..12de2a31a --- /dev/null +++ b/src/screens/Settings/FollowingFeedPreferences.tsx @@ -0,0 +1,143 @@ +import React from 'react' +import {msg, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' + +import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types' +import { + usePreferencesQuery, + useSetFeedViewPreferencesMutation, +} from '#/state/queries/preferences' +import {atoms as a} from '#/alf' +import {Admonition} from '#/components/Admonition' +import * as Toggle from '#/components/forms/Toggle' +import {Beaker_Stroke2_Corner2_Rounded as BeakerIcon} from '#/components/icons/Beaker' +import {Bubbles_Stroke2_Corner2_Rounded as BubblesIcon} from '#/components/icons/Bubble' +import {CloseQuote_Stroke2_Corner1_Rounded as QuoteIcon} from '#/components/icons/Quote' +import {Repost_Stroke2_Corner2_Rounded as RepostIcon} from '#/components/icons/Repost' +import * as Layout from '#/components/Layout' +import * as SettingsList from './components/SettingsList' + +type Props = NativeStackScreenProps< + CommonNavigatorParams, + 'PreferencesFollowingFeed' +> +export function FollowingFeedPreferencesScreen({}: Props) { + const {_} = useLingui() + + const {data: preferences} = usePreferencesQuery() + const {mutate: setFeedViewPref, variables} = + useSetFeedViewPreferencesMutation() + + const showReplies = !( + variables?.hideReplies ?? preferences?.feedViewPrefs?.hideReplies + ) + + const showReposts = !( + variables?.hideReposts ?? preferences?.feedViewPrefs?.hideReposts + ) + + const showQuotePosts = !( + variables?.hideQuotePosts ?? preferences?.feedViewPrefs?.hideQuotePosts + ) + + const mergeFeedEnabled = Boolean( + variables?.lab_mergeFeedEnabled ?? + preferences?.feedViewPrefs?.lab_mergeFeedEnabled, + ) + + return ( + <Layout.Screen testID="followingFeedPreferencesScreen"> + <Layout.Header title={_(msg`Following Feed Preferences`)} /> + <Layout.Content> + <SettingsList.Container> + <SettingsList.Item> + <Admonition type="tip" style={[a.flex_1]}> + <Trans>These settings only apply to the Following feed.</Trans> + </Admonition> + </SettingsList.Item> + <Toggle.Item + type="checkbox" + name="show-replies" + label={_(msg`Show replies`)} + value={showReplies} + onChange={value => + setFeedViewPref({ + hideReplies: !value, + }) + }> + <SettingsList.Item> + <SettingsList.ItemIcon icon={BubblesIcon} /> + <SettingsList.ItemText> + <Trans>Show replies</Trans> + </SettingsList.ItemText> + <Toggle.Platform /> + </SettingsList.Item> + </Toggle.Item> + <Toggle.Item + type="checkbox" + name="show-reposts" + label={_(msg`Show reposts`)} + value={showReposts} + onChange={value => + setFeedViewPref({ + hideReposts: !value, + }) + }> + <SettingsList.Item> + <SettingsList.ItemIcon icon={RepostIcon} /> + <SettingsList.ItemText> + <Trans>Show reposts</Trans> + </SettingsList.ItemText> + <Toggle.Platform /> + </SettingsList.Item> + </Toggle.Item> + <Toggle.Item + type="checkbox" + name="show-quotes" + label={_(msg`Show quote posts`)} + value={showQuotePosts} + onChange={value => + setFeedViewPref({ + hideQuotePosts: !value, + }) + }> + <SettingsList.Item> + <SettingsList.ItemIcon icon={QuoteIcon} /> + <SettingsList.ItemText> + <Trans>Show quote posts</Trans> + </SettingsList.ItemText> + <Toggle.Platform /> + </SettingsList.Item> + </Toggle.Item> + <SettingsList.Divider /> + <SettingsList.Group> + <SettingsList.ItemIcon icon={BeakerIcon} /> + <SettingsList.ItemText> + <Trans>Experimental</Trans> + </SettingsList.ItemText> + <Toggle.Item + type="checkbox" + name="merge-feed" + label={_( + msg`Show samples of your saved feeds in your Following feed`, + )} + value={mergeFeedEnabled} + onChange={value => + setFeedViewPref({ + lab_mergeFeedEnabled: value, + }) + } + style={[a.w_full, a.gap_md]}> + <Toggle.LabelText style={[a.flex_1]}> + <Trans> + Show samples of your saved feeds in your Following feed + </Trans> + </Toggle.LabelText> + <Toggle.Platform /> + </Toggle.Item> + </SettingsList.Group> + </SettingsList.Container> + </Layout.Content> + </Layout.Screen> + ) +} |