From 46a48df6c9c96ce05f19d3918a74b38e0354584c Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 19 Mar 2026 13:24:42 +0200 Subject: [PATCH] create simple redirect template for support redirects --- src/App.native.tsx | 5 +- src/Navigation.tsx | 11 ++- src/screens/Support/CommunityGuidelines.tsx | 22 ++++++ src/screens/Support/CopyrightPolicy.tsx | 19 ++++++ src/screens/Support/PrivacyPolicy.tsx | 17 +++++ src/screens/Support/Support.tsx | 67 +++++++++++++++++++ src/screens/Support/TermsOfService.tsx | 19 ++++++ .../Support/components/RedirectTemplate.tsx | 63 +++++++++++++++++ src/view/screens/CommunityGuidelines.tsx | 56 ---------------- src/view/screens/CopyrightPolicy.tsx | 53 --------------- src/view/screens/PrivacyPolicy.tsx | 53 --------------- src/view/screens/Support.tsx | 54 --------------- src/view/screens/TermsOfService.tsx | 51 -------------- 13 files changed, 214 insertions(+), 276 deletions(-) create mode 100644 src/screens/Support/CommunityGuidelines.tsx create mode 100644 src/screens/Support/CopyrightPolicy.tsx create mode 100644 src/screens/Support/PrivacyPolicy.tsx create mode 100644 src/screens/Support/Support.tsx create mode 100644 src/screens/Support/TermsOfService.tsx create mode 100644 src/screens/Support/components/RedirectTemplate.tsx delete mode 100644 src/view/screens/CommunityGuidelines.tsx delete mode 100644 src/view/screens/CopyrightPolicy.tsx delete mode 100644 src/view/screens/PrivacyPolicy.tsx delete mode 100644 src/view/screens/Support.tsx delete mode 100644 src/view/screens/TermsOfService.tsx diff --git a/src/App.native.tsx b/src/App.native.tsx index 6f6a2220c9..05aab65093 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -17,7 +17,6 @@ import * as Sentry from '@sentry/react-native' import {Provider as HideBottomBarBorderProvider} from '#/lib/hooks/useHideBottomBarBorder' import {QueryProvider} from '#/lib/react-query' -import {s} from '#/lib/styles' import {ThemeProvider} from '#/lib/ThemeContext' import {Provider as TranslateOnDeviceProvider} from '#/lib/translation' import I18nProvider from '#/locale/i18nProvider' @@ -59,7 +58,7 @@ import {Provider as StarterPackProvider} from '#/state/shell/starter-pack' import {Provider as HiddenRepliesProvider} from '#/state/threadgate-hidden-replies' import {TestCtrls} from '#/view/com/testing/TestCtrls' import {Shell} from '#/view/shell' -import {ThemeProvider as Alf} from '#/alf' +import {atoms as a, ThemeProvider as Alf} from '#/alf' import {useColorModeTheme} from '#/alf/util/useColorModeTheme' import {Provider as ContextMenuProvider} from '#/components/ContextMenu' import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry' @@ -176,7 +175,7 @@ function InnerApp() { + style={a.h_full}> diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 7ef150e9e5..0853415858 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -51,8 +51,6 @@ import { snoozeEmailConfirmationPrompt, } from '#/state/shell/reminders' import {useCloseAllActiveElements} from '#/state/util' -import {CommunityGuidelinesScreen} from '#/view/screens/CommunityGuidelines' -import {CopyrightPolicyScreen} from '#/view/screens/CopyrightPolicy' import {DebugModScreen} from '#/view/screens/DebugMod' import {FeedsScreen} from '#/view/screens/Feeds' import {HomeScreen} from '#/view/screens/Home' @@ -60,15 +58,11 @@ import {ListsScreen} from '#/view/screens/Lists' import {ModerationBlockedAccounts} from '#/view/screens/ModerationBlockedAccounts' import {ModerationModlistsScreen} from '#/view/screens/ModerationModlists' import {ModerationMutedAccounts} from '#/view/screens/ModerationMutedAccounts' -import {NotFoundScreen} from '#/view/screens/NotFound' import {NotificationsScreen} from '#/view/screens/Notifications' import {PostThreadScreen} from '#/view/screens/PostThread' -import {PrivacyPolicyScreen} from '#/view/screens/PrivacyPolicy' import {ProfileScreen} from '#/view/screens/Profile' import {ProfileFeedLikedByScreen} from '#/view/screens/ProfileFeedLikedBy' import {StorybookScreen} from '#/view/screens/Storybook' -import {SupportScreen} from '#/view/screens/Support' -import {TermsOfServiceScreen} from '#/view/screens/TermsOfService' import {BottomBar} from '#/view/shell/bottom-bar/BottomBar' import {createNativeStackNavigatorWithAuth} from '#/view/shell/createNativeStackNavigatorWithAuth' import {BookmarksScreen} from '#/screens/Bookmarks' @@ -130,6 +124,11 @@ import { StarterPackScreenShort, } from '#/screens/StarterPack/StarterPackScreen' import {Wizard} from '#/screens/StarterPack/Wizard' +import {CommunityGuidelinesScreen} from '#/screens/Support/CommunityGuidelines' +import {CopyrightPolicyScreen} from '#/screens/Support/CopyrightPolicy' +import {PrivacyPolicyScreen} from '#/screens/Support/PrivacyPolicy' +import {SupportScreen} from '#/screens/Support/Support' +import {TermsOfServiceScreen} from '#/screens/Support/TermsOfService' import TopicScreen from '#/screens/Topic' import {VideoFeed} from '#/screens/VideoFeed' import {type Theme, useTheme} from '#/alf' diff --git a/src/screens/Support/CommunityGuidelines.tsx b/src/screens/Support/CommunityGuidelines.tsx new file mode 100644 index 0000000000..90d1814476 --- /dev/null +++ b/src/screens/Support/CommunityGuidelines.tsx @@ -0,0 +1,22 @@ +import {useLingui} from '@lingui/react/macro' + +import {urls} from '#/lib/constants' +import { + type CommonNavigatorParams, + type NativeStackScreenProps, +} from '#/lib/routes/types' +import {RedirectTemplate} from './components/RedirectTemplate' + +type Props = NativeStackScreenProps< + CommonNavigatorParams, + 'CommunityGuidelines' +> +export const CommunityGuidelinesScreen = (_props: Props) => { + const {t: l} = useLingui() + return ( + + ) +} diff --git a/src/screens/Support/CopyrightPolicy.tsx b/src/screens/Support/CopyrightPolicy.tsx new file mode 100644 index 0000000000..cb7b1d31e1 --- /dev/null +++ b/src/screens/Support/CopyrightPolicy.tsx @@ -0,0 +1,19 @@ +import {useLingui} from '@lingui/react/macro' + +import {urls} from '#/lib/constants' +import { + type CommonNavigatorParams, + type NativeStackScreenProps, +} from '#/lib/routes/types' +import {RedirectTemplate} from './components/RedirectTemplate' + +type Props = NativeStackScreenProps +export const CopyrightPolicyScreen = (_props: Props) => { + const {t: l} = useLingui() + return ( + + ) +} diff --git a/src/screens/Support/PrivacyPolicy.tsx b/src/screens/Support/PrivacyPolicy.tsx new file mode 100644 index 0000000000..25640af55b --- /dev/null +++ b/src/screens/Support/PrivacyPolicy.tsx @@ -0,0 +1,17 @@ +import {useLingui} from '@lingui/react/macro' +import {type NativeStackScreenProps} from '@react-navigation/native-stack' + +import {urls} from '#/lib/constants' +import {type CommonNavigatorParams} from '#/lib/routes/types' +import {RedirectTemplate} from './components/RedirectTemplate' + +type Props = NativeStackScreenProps +export const PrivacyPolicyScreen = (_props: Props) => { + const {t: l} = useLingui() + return ( + + ) +} diff --git a/src/screens/Support/Support.tsx b/src/screens/Support/Support.tsx new file mode 100644 index 0000000000..ca842d8748 --- /dev/null +++ b/src/screens/Support/Support.tsx @@ -0,0 +1,67 @@ +import {useCallback} from 'react' +import {View} from 'react-native' +import {Trans} from '@lingui/react/macro' +import {useFocusEffect} from '@react-navigation/native' +import {type NativeStackScreenProps} from '@react-navigation/native-stack' + +import {HELP_DESK_URL} from '#/lib/constants' +import {type CommonNavigatorParams} from '#/lib/routes/types' +import {useSetMinimalShellMode} from '#/state/shell' +import {atoms as a, native, useGutters, useTheme} from '#/alf' +import {ArrowTopRight_Stroke2_Corner0_Rounded as ExternalLinkIcon} from '#/components/icons/Arrow' +import * as Layout from '#/components/Layout' +import {InlineLinkText} from '#/components/Link' +import {Text} from '#/components/Typography' + +type Props = NativeStackScreenProps +export const SupportScreen = (_props: Props) => { + const setMinimalShellMode = useSetMinimalShellMode() + const gutters = useGutters(['wide', 'base']) + const t = useTheme() + + useFocusEffect( + useCallback(() => { + setMinimalShellMode(false) + }, [setMinimalShellMode]), + ) + + return ( + + + + + + Support + + + + + + + + + The support form has been moved. If you need help, please visit{' '} + + {HELP_DESK_URL} + + {' '} + to get in touch with us. + + + + + + ) +} diff --git a/src/screens/Support/TermsOfService.tsx b/src/screens/Support/TermsOfService.tsx new file mode 100644 index 0000000000..0b557021b3 --- /dev/null +++ b/src/screens/Support/TermsOfService.tsx @@ -0,0 +1,19 @@ +import {useLingui} from '@lingui/react/macro' + +import {urls} from '#/lib/constants' +import { + type CommonNavigatorParams, + type NativeStackScreenProps, +} from '#/lib/routes/types' +import {RedirectTemplate} from './components/RedirectTemplate' + +type Props = NativeStackScreenProps +export const TermsOfServiceScreen = (_props: Props) => { + const {t: l} = useLingui() + return ( + + ) +} diff --git a/src/screens/Support/components/RedirectTemplate.tsx b/src/screens/Support/components/RedirectTemplate.tsx new file mode 100644 index 0000000000..4409808c52 --- /dev/null +++ b/src/screens/Support/components/RedirectTemplate.tsx @@ -0,0 +1,63 @@ +import {useCallback} from 'react' +import {View} from 'react-native' +import {Trans} from '@lingui/react/macro' +import {useFocusEffect} from '@react-navigation/native' + +import {useSetMinimalShellMode} from '#/state/shell' +import {atoms as a, native, useGutters, useTheme} from '#/alf' +import {ArrowTopRight_Stroke2_Corner0_Rounded as ExternalLinkIcon} from '#/components/icons/Arrow' +import * as Layout from '#/components/Layout' +import {InlineLinkText} from '#/components/Link' +import {Text} from '#/components/Typography' + +/** + * Generic screen component for redirects. + */ +export function RedirectTemplate({title, link}: {title: string; link: string}) { + const setMinimalShellMode = useSetMinimalShellMode() + const gutters = useGutters(['wide', 'base']) + const t = useTheme() + + useFocusEffect( + useCallback(() => { + setMinimalShellMode(false) + }, [setMinimalShellMode]), + ) + + return ( + + + + + {title} + + + + + + + + The {title} has been moved to{' '} + + {link} + + + + + + + + ) +} diff --git a/src/view/screens/CommunityGuidelines.tsx b/src/view/screens/CommunityGuidelines.tsx deleted file mode 100644 index fa21b7b7f4..0000000000 --- a/src/view/screens/CommunityGuidelines.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import {useCallback} from 'react' -import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' -import {useFocusEffect} from '@react-navigation/native' - -import {usePalette} from '#/lib/hooks/usePalette' -import { - type CommonNavigatorParams, - type NativeStackScreenProps, -} from '#/lib/routes/types' -import {s} from '#/lib/styles' -import {useSetMinimalShellMode} from '#/state/shell' -import {TextLink} from '#/view/com/util/Link' -import {Text} from '#/view/com/util/text/Text' -import {ScrollView} from '#/view/com/util/Views' -import * as Layout from '#/components/Layout' -import {ViewHeader} from '../com/util/ViewHeader' - -type Props = NativeStackScreenProps< - CommonNavigatorParams, - 'CommunityGuidelines' -> -export const CommunityGuidelinesScreen = (_props: Props) => { - const pal = usePalette('default') - const {_} = useLingui() - const setMinimalShellMode = useSetMinimalShellMode() - - useFocusEffect( - useCallback(() => { - setMinimalShellMode(false) - }, [setMinimalShellMode]), - ) - - return ( - - - - - - - The Community Guidelines have been moved to{' '} - - - - - - - - ) -} diff --git a/src/view/screens/CopyrightPolicy.tsx b/src/view/screens/CopyrightPolicy.tsx deleted file mode 100644 index dcaf7fb951..0000000000 --- a/src/view/screens/CopyrightPolicy.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import {useCallback} from 'react' -import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' -import {useFocusEffect} from '@react-navigation/native' - -import {usePalette} from '#/lib/hooks/usePalette' -import { - type CommonNavigatorParams, - type NativeStackScreenProps, -} from '#/lib/routes/types' -import {s} from '#/lib/styles' -import {useSetMinimalShellMode} from '#/state/shell' -import {TextLink} from '#/view/com/util/Link' -import {Text} from '#/view/com/util/text/Text' -import {ScrollView} from '#/view/com/util/Views' -import * as Layout from '#/components/Layout' -import {ViewHeader} from '../com/util/ViewHeader' - -type Props = NativeStackScreenProps -export const CopyrightPolicyScreen = (_props: Props) => { - const pal = usePalette('default') - const {_} = useLingui() - const setMinimalShellMode = useSetMinimalShellMode() - - useFocusEffect( - useCallback(() => { - setMinimalShellMode(false) - }, [setMinimalShellMode]), - ) - - return ( - - - - - - - The Copyright Policy has been moved to{' '} - - - - - - - - ) -} diff --git a/src/view/screens/PrivacyPolicy.tsx b/src/view/screens/PrivacyPolicy.tsx deleted file mode 100644 index b5ce4ca31a..0000000000 --- a/src/view/screens/PrivacyPolicy.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import {useCallback} from 'react' -import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' -import {useFocusEffect} from '@react-navigation/native' - -import {usePalette} from '#/lib/hooks/usePalette' -import { - type CommonNavigatorParams, - type NativeStackScreenProps, -} from '#/lib/routes/types' -import {s} from '#/lib/styles' -import {useSetMinimalShellMode} from '#/state/shell' -import {TextLink} from '#/view/com/util/Link' -import {Text} from '#/view/com/util/text/Text' -import {ScrollView} from '#/view/com/util/Views' -import * as Layout from '#/components/Layout' -import {ViewHeader} from '../com/util/ViewHeader' - -type Props = NativeStackScreenProps -export const PrivacyPolicyScreen = (_props: Props) => { - const pal = usePalette('default') - const {_} = useLingui() - const setMinimalShellMode = useSetMinimalShellMode() - - useFocusEffect( - useCallback(() => { - setMinimalShellMode(false) - }, [setMinimalShellMode]), - ) - - return ( - - - - - - - The Privacy Policy has been moved to{' '} - - - - - - - - ) -} diff --git a/src/view/screens/Support.tsx b/src/view/screens/Support.tsx deleted file mode 100644 index 31f0a75cb6..0000000000 --- a/src/view/screens/Support.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import {useCallback} from 'react' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' -import {useFocusEffect} from '@react-navigation/native' - -import {HELP_DESK_URL} from '#/lib/constants' -import {usePalette} from '#/lib/hooks/usePalette' -import { - type CommonNavigatorParams, - type NativeStackScreenProps, -} from '#/lib/routes/types' -import {s} from '#/lib/styles' -import {useSetMinimalShellMode} from '#/state/shell' -import {TextLink} from '#/view/com/util/Link' -import {Text} from '#/view/com/util/text/Text' -import {ViewHeader} from '#/view/com/util/ViewHeader' -import {CenteredView} from '#/view/com/util/Views' -import * as Layout from '#/components/Layout' - -type Props = NativeStackScreenProps -export const SupportScreen = (_props: Props) => { - const pal = usePalette('default') - const setMinimalShellMode = useSetMinimalShellMode() - const {_} = useLingui() - - useFocusEffect( - useCallback(() => { - setMinimalShellMode(false) - }, [setMinimalShellMode]), - ) - - return ( - - - - - Support - - - - The support form has been moved. If you need help, please{' '} - {' '} - or visit {HELP_DESK_URL} to get in touch with us. - - - - - ) -} diff --git a/src/view/screens/TermsOfService.tsx b/src/view/screens/TermsOfService.tsx deleted file mode 100644 index ffdb05c2af..0000000000 --- a/src/view/screens/TermsOfService.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import {useCallback} from 'react' -import {View} from 'react-native' -import {msg} from '@lingui/core/macro' -import {useLingui} from '@lingui/react' -import {Trans} from '@lingui/react/macro' -import {useFocusEffect} from '@react-navigation/native' - -import {usePalette} from '#/lib/hooks/usePalette' -import { - type CommonNavigatorParams, - type NativeStackScreenProps, -} from '#/lib/routes/types' -import {s} from '#/lib/styles' -import {useSetMinimalShellMode} from '#/state/shell' -import {TextLink} from '#/view/com/util/Link' -import {Text} from '#/view/com/util/text/Text' -import {ScrollView} from '#/view/com/util/Views' -import * as Layout from '#/components/Layout' -import {ViewHeader} from '../com/util/ViewHeader' - -type Props = NativeStackScreenProps -export const TermsOfServiceScreen = (_props: Props) => { - const pal = usePalette('default') - const setMinimalShellMode = useSetMinimalShellMode() - const {_} = useLingui() - - useFocusEffect( - useCallback(() => { - setMinimalShellMode(false) - }, [setMinimalShellMode]), - ) - - return ( - - - - - - The Terms of Service have been moved to{' '} - - - - - - - ) -}