Cull unused files (#11029)

This commit is contained in:
Samuel Newman
2026-06-30 19:41:35 +03:00
committed by GitHub
parent bb20f234f3
commit ade5d2b783
17 changed files with 8 additions and 1495 deletions
@@ -14,13 +14,13 @@ import {
useNavigation,
} from '@react-navigation/native'
import {useCleanError} from '#/lib/hooks/useCleanError'
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
import {usePostViewTracking} from '#/lib/hooks/usePostViewTracking'
import {
type CommonNavigatorParams,
type NativeStackScreenProps,
} from '#/lib/routes/types'
import {cleanError} from '#/lib/strings/errors'
import {useBookmarkMutation} from '#/state/queries/bookmarks/useBookmarkMutation'
import {useBookmarksQuery} from '#/state/queries/bookmarks/useBookmarksQuery'
import {Post} from '#/view/com/post/Post'
@@ -92,7 +92,6 @@ type ListItem =
function BookmarksInner() {
const initialNumToRender = useInitialNumToRender()
const cleanError = useCleanError()
const [isPTRing, setIsPTRing] = useState(false)
const trackPostView = usePostViewTracking('Bookmarks')
const {
@@ -104,10 +103,6 @@ function BookmarksInner() {
error,
refetch,
} = useBookmarksQuery()
const cleanedError = useMemo(() => {
const {raw, clean} = cleanError(error)
return clean || raw
}, [error, cleanError])
const onRefresh = useCallback(async () => {
setIsPTRing(true)
@@ -174,10 +169,10 @@ function BookmarksInner() {
renderItem={renderItem}
keyExtractor={keyExtractor}
refreshing={isPTRing}
onRefresh={onRefresh}
onEndReached={onEndReached}
onRefresh={() => void onRefresh()}
onEndReached={() => void onEndReached()}
onEndReachedThreshold={4}
onItemSeen={item => {
onItemSeen={(item: ListItem) => {
if (item.type === 'bookmark') {
trackPostView(item.bookmark.item)
}
@@ -185,7 +180,7 @@ function BookmarksInner() {
ListFooterComponent={
<ListFooter
isFetchingNextPage={isFetchingNextPage}
error={cleanedError}
error={cleanError(error)}
onRetry={fetchNextPage}
style={[isEmpty && a.border_t_0]}
/>
@@ -209,7 +204,6 @@ function BookmarkNotFound({
const t = useTheme()
const {_} = useLingui()
const {mutateAsync: bookmark} = useBookmarkMutation()
const cleanError = useCleanError()
const remove = async () => {
try {
@@ -217,9 +211,8 @@ function BookmarkNotFound({
toast.show(_(msg`Removed from saved posts`), {
type: 'info',
})
} catch (e: any) {
const {raw, clean} = cleanError(e)
toast.show(clean || raw || e, {
} catch (err) {
toast.show(cleanError(err), {
type: 'error',
})
}
@@ -259,7 +252,7 @@ function BookmarkNotFound({
label={_(msg`Remove from saved posts`)}
size="tiny"
color="secondary"
onPress={remove}>
onPress={() => void remove()}>
<ButtonIcon icon={BookmarkFilled} />
<ButtonText>
<Trans>Remove</Trans>
@@ -1,60 +0,0 @@
import {View} from 'react-native'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
import {atoms as a, useTheme} from '#/alf'
import {ButtonText} from '#/components/Button'
import {BookmarkDeleteLarge} from '#/components/icons/Bookmark'
import {Link} from '#/components/Link'
import {Text} from '#/components/Typography'
export function EmptyState() {
const t = useTheme()
const {_} = useLingui()
return (
<View
style={[
a.align_center,
{
paddingVertical: 64,
},
]}>
<BookmarkDeleteLarge
width={64}
fill={t.atoms.text_contrast_medium.color}
/>
<View style={[a.pt_sm]}>
<Text
style={[
a.text_lg,
a.font_medium,
a.text_center,
t.atoms.text_contrast_medium,
]}>
<Trans>Nothing saved yet</Trans>
</Text>
</View>
<View style={[a.pt_2xl]}>
<Link
to="/"
action="navigate"
label={_(
msg({
message: `Go home`,
context: `Button to go back to the home timeline`,
}),
)}
size="small"
color="secondary">
<ButtonText>
<Trans context="Button to go back to the home timeline">
Go home
</Trans>
</ButtonText>
</Link>
</View>
</View>
)
}