Bluesky app fork with some witchin' additions 💫

Use handle instead of DID for more page titles

xan.lol 8b8ac942 6269660c

verified
+11 -1
src/screens/Post/PostLikedBy.tsx
··· 1 1 import React from 'react' 2 - import {Plural, Trans} from '@lingui/macro' 2 + import {msg, Plural, Trans} from '@lingui/macro' 3 + import {useLingui} from '@lingui/react' 3 4 import {useFocusEffect} from '@react-navigation/native' 4 5 6 + import {useSetTitle} from '#/lib/hooks/useSetTitle' 5 7 import { 6 8 type CommonNavigatorParams, 7 9 type NativeStackScreenProps, 8 10 } from '#/lib/routes/types' 9 11 import {makeRecordUri} from '#/lib/strings/url-helpers' 10 12 import {usePostQuery} from '#/state/queries/post' 13 + import {useProfileQuery} from '#/state/queries/profile' 14 + import {useResolveDidQuery} from '#/state/queries/resolve-uri' 11 15 import {useSetMinimalShellMode} from '#/state/shell' 12 16 import {PostLikedBy as PostLikedByComponent} from '#/view/com/post-thread/PostLikedBy' 13 17 import * as Layout from '#/components/Layout' 14 18 15 19 type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostLikedBy'> 16 20 export const PostLikedByScreen = ({route}: Props) => { 21 + const {_} = useLingui() 17 22 const setMinimalShellMode = useSetMinimalShellMode() 18 23 const {name, rkey} = route.params 19 24 const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) 20 25 const {data: post} = usePostQuery(uri) 26 + 27 + const {data: resolvedDid} = useResolveDidQuery(name) 28 + const {data: profile} = useProfileQuery({did: resolvedDid}) 29 + 30 + useSetTitle(profile ? _(msg`Skeet by @${profile.handle}`) : undefined) 21 31 22 32 let likeCount 23 33 if (post) {
+11 -1
src/screens/Post/PostQuotes.tsx
··· 1 1 import React from 'react' 2 - import {Plural, Trans} from '@lingui/macro' 2 + import {msg, Plural, Trans} from '@lingui/macro' 3 + import {useLingui} from '@lingui/react' 3 4 import {useFocusEffect} from '@react-navigation/native' 4 5 6 + import {useSetTitle} from '#/lib/hooks/useSetTitle' 5 7 import { 6 8 type CommonNavigatorParams, 7 9 type NativeStackScreenProps, 8 10 } from '#/lib/routes/types' 9 11 import {makeRecordUri} from '#/lib/strings/url-helpers' 10 12 import {usePostQuery} from '#/state/queries/post' 13 + import {useProfileQuery} from '#/state/queries/profile' 14 + import {useResolveDidQuery} from '#/state/queries/resolve-uri' 11 15 import {useSetMinimalShellMode} from '#/state/shell' 12 16 import {PostQuotes as PostQuotesComponent} from '#/view/com/post-thread/PostQuotes' 13 17 import * as Layout from '#/components/Layout' 14 18 15 19 type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostQuotes'> 16 20 export const PostQuotesScreen = ({route}: Props) => { 21 + const {_} = useLingui() 17 22 const setMinimalShellMode = useSetMinimalShellMode() 18 23 const {name, rkey} = route.params 19 24 const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) 20 25 const {data: post} = usePostQuery(uri) 26 + 27 + const {data: resolvedDid} = useResolveDidQuery(name) 28 + const {data: profile} = useProfileQuery({did: resolvedDid}) 29 + 30 + useSetTitle(profile ? _(msg`Skeet by @${profile.handle}`) : undefined) 21 31 22 32 let quoteCount 23 33 if (post) {
+11 -1
src/screens/Post/PostRepostedBy.tsx
··· 1 1 import React from 'react' 2 - import {Plural, Trans} from '@lingui/macro' 2 + import {msg, Plural, Trans} from '@lingui/macro' 3 + import {useLingui} from '@lingui/react' 3 4 import {useFocusEffect} from '@react-navigation/native' 4 5 6 + import {useSetTitle} from '#/lib/hooks/useSetTitle' 5 7 import { 6 8 type CommonNavigatorParams, 7 9 type NativeStackScreenProps, 8 10 } from '#/lib/routes/types' 9 11 import {makeRecordUri} from '#/lib/strings/url-helpers' 10 12 import {usePostQuery} from '#/state/queries/post' 13 + import {useProfileQuery} from '#/state/queries/profile' 14 + import {useResolveDidQuery} from '#/state/queries/resolve-uri' 11 15 import {useSetMinimalShellMode} from '#/state/shell' 12 16 import {PostRepostedBy as PostRepostedByComponent} from '#/view/com/post-thread/PostRepostedBy' 13 17 import * as Layout from '#/components/Layout' 14 18 15 19 type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostRepostedBy'> 16 20 export const PostRepostedByScreen = ({route}: Props) => { 21 + const {_} = useLingui() 17 22 const {name, rkey} = route.params 18 23 const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) 19 24 const setMinimalShellMode = useSetMinimalShellMode() 20 25 const {data: post} = usePostQuery(uri) 26 + 27 + const {data: resolvedDid} = useResolveDidQuery(name) 28 + const {data: profile} = useProfileQuery({did: resolvedDid}) 29 + 30 + useSetTitle(profile ? _(msg`Skeet by @${profile.handle}`) : undefined) 21 31 22 32 let quoteCount 23 33 if (post) {
+9
src/screens/Profile/KnownFollowers.tsx
··· 5 5 import {useFocusEffect} from '@react-navigation/native' 6 6 7 7 import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' 8 + import {useSetTitle} from '#/lib/hooks/useSetTitle' 8 9 import { 9 10 type CommonNavigatorParams, 10 11 type NativeStackScreenProps, ··· 12 13 import {cleanError} from '#/lib/strings/errors' 13 14 import {logger} from '#/logger' 14 15 import {useProfileKnownFollowersQuery} from '#/state/queries/known-followers' 16 + import {useProfileQuery} from '#/state/queries/profile' 15 17 import {useResolveDidQuery} from '#/state/queries/resolve-uri' 16 18 import {useSetMinimalShellMode} from '#/state/shell' 17 19 import {ProfileCardWithFollowBtn} from '#/view/com/profile/ProfileCard' ··· 57 59 isLoading: isDidLoading, 58 60 error: resolveError, 59 61 } = useResolveDidQuery(route.params.name) 62 + const {data: profile} = useProfileQuery({ 63 + did: resolvedDid, 64 + }) 60 65 const { 61 66 data, 62 67 isLoading: isFollowersLoading, ··· 66 71 error, 67 72 refetch, 68 73 } = useProfileKnownFollowersQuery(resolvedDid) 74 + 75 + useSetTitle( 76 + profile ? _(msg`Followers of @${profile.handle} that you know`) : undefined, 77 + ) 69 78 70 79 const onRefresh = React.useCallback(async () => { 71 80 setIsPTRing(true)
+6 -1
src/screens/Profile/ProfileFollowers.tsx
··· 1 1 import React from 'react' 2 - import {Plural} from '@lingui/macro' 2 + import {msg, Plural} from '@lingui/macro' 3 + import {useLingui} from '@lingui/react' 3 4 import {useFocusEffect} from '@react-navigation/native' 4 5 6 + import {useSetTitle} from '#/lib/hooks/useSetTitle' 5 7 import { 6 8 type CommonNavigatorParams, 7 9 type NativeStackScreenProps, ··· 16 18 type Props = NativeStackScreenProps<CommonNavigatorParams, 'ProfileFollowers'> 17 19 export const ProfileFollowersScreen = ({route}: Props) => { 18 20 const {name} = route.params 21 + const {_} = useLingui() 19 22 const setMinimalShellMode = useSetMinimalShellMode() 20 23 21 24 const {data: resolvedDid} = useResolveDidQuery(name) 22 25 const {data: profile} = useProfileQuery({ 23 26 did: resolvedDid, 24 27 }) 28 + 29 + useSetTitle(profile ? _(msg`People following @${profile.handle}`) : undefined) 25 30 26 31 useFocusEffect( 27 32 React.useCallback(() => {
+8 -1
src/screens/Profile/ProfileFollows.tsx
··· 1 1 import React from 'react' 2 - import {Plural} from '@lingui/macro' 2 + import {msg, Plural} from '@lingui/macro' 3 + import {useLingui} from '@lingui/react' 3 4 import {useFocusEffect} from '@react-navigation/native' 4 5 6 + import {useSetTitle} from '#/lib/hooks/useSetTitle' 5 7 import { 6 8 type CommonNavigatorParams, 7 9 type NativeStackScreenProps, ··· 16 18 type Props = NativeStackScreenProps<CommonNavigatorParams, 'ProfileFollows'> 17 19 export const ProfileFollowsScreen = ({route}: Props) => { 18 20 const {name} = route.params 21 + const {_} = useLingui() 19 22 const setMinimalShellMode = useSetMinimalShellMode() 20 23 21 24 const {data: resolvedDid} = useResolveDidQuery(name) 22 25 const {data: profile} = useProfileQuery({ 23 26 did: resolvedDid, 24 27 }) 28 + 29 + useSetTitle( 30 + profile ? _(msg`People followed by @${profile.handle}`) : undefined, 31 + ) 25 32 26 33 useFocusEffect( 27 34 React.useCallback(() => {
+3
src/screens/Profile/ProfileSearch.tsx
··· 2 2 import {msg} from '@lingui/macro' 3 3 import {useLingui} from '@lingui/react' 4 4 5 + import {useSetTitle} from '#/lib/hooks/useSetTitle' 5 6 import { 6 7 type CommonNavigatorParams, 7 8 type NativeStackScreenProps, ··· 19 20 20 21 const {data: resolvedDid} = useResolveDidQuery(name) 21 22 const {data: profile} = useProfileQuery({did: resolvedDid}) 23 + 24 + useSetTitle(profile ? _(msg`Search @${profile.handle}'s skeets`) : undefined) 22 25 23 26 const fixedParams = useMemo( 24 27 () => ({
+11
src/view/screens/PostThread.tsx
··· 1 1 import {useCallback} from 'react' 2 + import {msg} from '@lingui/macro' 3 + import {useLingui} from '@lingui/react' 2 4 import {useFocusEffect} from '@react-navigation/native' 3 5 6 + import {useSetTitle} from '#/lib/hooks/useSetTitle' 4 7 import { 5 8 type CommonNavigatorParams, 6 9 type NativeStackScreenProps, 7 10 } from '#/lib/routes/types' 8 11 import {makeRecordUri} from '#/lib/strings/url-helpers' 12 + import {useProfileQuery} from '#/state/queries/profile' 13 + import {useResolveDidQuery} from '#/state/queries/resolve-uri' 9 14 import {useSetMinimalShellMode} from '#/state/shell' 10 15 import {PostThread} from '#/screens/PostThread' 11 16 import * as Layout from '#/components/Layout' 12 17 13 18 type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostThread'> 14 19 export function PostThreadScreen({route}: Props) { 20 + const {_} = useLingui() 15 21 const setMinimalShellMode = useSetMinimalShellMode() 16 22 17 23 const {name, rkey} = route.params 18 24 const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) 25 + 26 + const {data: resolvedDid} = useResolveDidQuery(name) 27 + const {data: profile} = useProfileQuery({did: resolvedDid}) 28 + 29 + useSetTitle(profile ? _(msg`Skeet by @${profile.handle}`) : undefined) 19 30 20 31 useFocusEffect( 21 32 useCallback(() => {