diff --git a/src/components/moderation/Hider.tsx b/src/components/moderation/Hider.tsx index f4dafcf065..b020a6a58c 100644 --- a/src/components/moderation/Hider.tsx +++ b/src/components/moderation/Hider.tsx @@ -23,7 +23,7 @@ type Context = { const Context = React.createContext({} as Context) -export const useScreenHider = () => React.useContext(Context) +export const useHider = () => React.useContext(Context) export function Outer({ modui, @@ -73,11 +73,11 @@ export function Outer({ } export function Content({children}: {children: React.ReactNode}) { - const ctx = useScreenHider() + const ctx = useHider() return ctx.isContentVisible ? children : null } export function Mask({children}: {children: React.ReactNode}) { - const ctx = useScreenHider() + const ctx = useHider() return ctx.isContentVisible ? null : children } diff --git a/src/screens/List/ListHiddenScreen.tsx b/src/screens/List/ListHiddenScreen.tsx index 25089509c7..c93a6cc4e1 100644 --- a/src/screens/List/ListHiddenScreen.tsx +++ b/src/screens/List/ListHiddenScreen.tsx @@ -6,11 +6,8 @@ import {useLingui} from '@lingui/react' import {logger} from '#/logger' import {useGoBack} from 'lib/hooks/useGoBack' -import { - useListBlockMutation, - useListDeleteMutation, - useListMuteMutation, -} from 'state/queries/list' +import {sanitizeHandle} from 'lib/strings/handles' +import {useListBlockMutation, useListMuteMutation} from 'state/queries/list' import { UsePreferencesQueryResponse, useRemoveFeedMutation, @@ -21,6 +18,7 @@ import {CenteredView} from 'view/com/util/Views' import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' import {EyeSlash_Stroke2_Corner0_Rounded as EyeSlash} from '#/components/icons/EyeSlash' +import {useHider} from '#/components/moderation/Hider' import {Text} from '#/components/Typography' export function ListHiddenScreen({ @@ -42,9 +40,10 @@ export function ListHiddenScreen({ const [isProcessing, setIsProcessing] = React.useState(false) const listBlockMutation = useListBlockMutation() const listMuteMutation = useListMuteMutation() - const listDeleteMutation = useListDeleteMutation() const {mutateAsync: removeSavedFeed} = useRemoveFeedMutation() + const {setIsContentVisible} = useHider() + const savedFeedConfig = preferences.savedFeeds.find(f => f.value === list.uri) const onUnsubscribe = async () => { @@ -81,24 +80,6 @@ export function ListHiddenScreen({ setIsProcessing(false) } - const onDeleteList = async () => { - setIsProcessing(true) - try { - await listDeleteMutation.mutateAsync({uri: list.uri}) - Toast.show(_(msg`List deleted`)) - } catch (e) { - logger.error('Failed to delete list from saved feeds', {message: e}) - Toast.show( - _( - msg`There was an issue. Please check your internet connection and try again.`, - ), - ) - } finally { - setIsProcessing(false) - goBack() - } - } - const onRemoveList = async () => { if (!savedFeedConfig) return try { @@ -135,7 +116,7 @@ export function ListHiddenScreen({ /> - List hidden + List has been hidden - {isOwner ? ( - - The list you are trying to view ( - {list.name}) has - been hidden. - - ) : ( - The list you are trying to view has been hidden. - )} + + This list - created by{' '} + + {isOwner + ? _(msg`you`) + : sanitizeHandle(list.creator.handle, '@')} + {' '} + - contains possible violations of Bluesky's community guidelines + in its name or description. + @@ -177,15 +159,14 @@ export function ListHiddenScreen({ variant="solid" color="secondary" size="medium" - label={_(msg`Delete List`)} - onPress={onDeleteList} + label={_(msg`Show list anyway`)} + onPress={() => setIsContentVisible(true)} disabled={isProcessing}> - Delete list + Show anyway - ) : null} - {list.viewer?.muted || list.viewer?.blocked ? ( + ) : list.viewer?.muted || list.viewer?.blocked ? (