From f2d164ec23247d878f7f019d568a3073a5ae94c4 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 24 Nov 2023 22:31:33 +0000 Subject: PWI: Refactor Shell (#1989) * Vendor createNativeStackNavigator for further tweaks * Completely disable withAuthRequired * Render LoggedOut for protected routes * Move web shell into the navigator * Simplify the logic * Add login modal * Delete withAuthRequired * Reset app state on session change * Move TS suppression --- src/view/screens/ModerationModlists.tsx | 125 ++++++++++++++++---------------- 1 file changed, 61 insertions(+), 64 deletions(-) (limited to 'src/view/screens/ModerationModlists.tsx') diff --git a/src/view/screens/ModerationModlists.tsx b/src/view/screens/ModerationModlists.tsx index be0eb3850..145b35a42 100644 --- a/src/view/screens/ModerationModlists.tsx +++ b/src/view/screens/ModerationModlists.tsx @@ -4,7 +4,6 @@ import {useFocusEffect, useNavigation} from '@react-navigation/native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {AtUri} from '@atproto/api' import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types' -import {withAuthRequired} from 'view/com/auth/withAuthRequired' import {MyLists} from '#/view/com/lists/MyLists' import {Text} from 'view/com/util/text/Text' import {Button} from 'view/com/util/forms/Button' @@ -17,70 +16,68 @@ import {useSetMinimalShellMode} from '#/state/shell' import {useModalControls} from '#/state/modals' type Props = NativeStackScreenProps -export const ModerationModlistsScreen = withAuthRequired( - function ModerationModlistsScreenImpl({}: Props) { - const pal = usePalette('default') - const setMinimalShellMode = useSetMinimalShellMode() - const {isMobile} = useWebMediaQueries() - const navigation = useNavigation() - const {openModal} = useModalControls() +export function ModerationModlistsScreen({}: Props) { + const pal = usePalette('default') + const setMinimalShellMode = useSetMinimalShellMode() + const {isMobile} = useWebMediaQueries() + const navigation = useNavigation() + const {openModal} = useModalControls() - useFocusEffect( - React.useCallback(() => { - setMinimalShellMode(false) - }, [setMinimalShellMode]), - ) + useFocusEffect( + React.useCallback(() => { + setMinimalShellMode(false) + }, [setMinimalShellMode]), + ) - const onPressNewList = React.useCallback(() => { - openModal({ - name: 'create-or-edit-list', - purpose: 'app.bsky.graph.defs#modlist', - onSave: (uri: string) => { - try { - const urip = new AtUri(uri) - navigation.navigate('ProfileList', { - name: urip.hostname, - rkey: urip.rkey, - }) - } catch {} - }, - }) - }, [openModal, navigation]) + const onPressNewList = React.useCallback(() => { + openModal({ + name: 'create-or-edit-list', + purpose: 'app.bsky.graph.defs#modlist', + onSave: (uri: string) => { + try { + const urip = new AtUri(uri) + navigation.navigate('ProfileList', { + name: urip.hostname, + rkey: urip.rkey, + }) + } catch {} + }, + }) + }, [openModal, navigation]) - return ( - - - - - Moderation Lists + return ( + + + + + Moderation Lists + + + Public, shareable lists of users to mute or block in bulk. + + + + - - - - - ) - }, -) + + + + + + ) +} -- cgit 1.4.1