diff --git a/src/screens/Post/PostLikedBy.tsx b/src/screens/Post/PostLikedBy.tsx index b8a230246..97b290537 100644 --- a/src/screens/Post/PostLikedBy.tsx +++ b/src/screens/Post/PostLikedBy.tsx @@ -1,24 +1,34 @@ import React from 'react' -import {Plural, Trans} from '@lingui/macro' +import {msg, Plural, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' +import {useSetTitle} from '#/lib/hooks/useSetTitle' import { type CommonNavigatorParams, type NativeStackScreenProps, } from '#/lib/routes/types' import {makeRecordUri} from '#/lib/strings/url-helpers' import {usePostQuery} from '#/state/queries/post' +import {useProfileQuery} from '#/state/queries/profile' +import {useResolveDidQuery} from '#/state/queries/resolve-uri' import {useSetMinimalShellMode} from '#/state/shell' import {PostLikedBy as PostLikedByComponent} from '#/view/com/post-thread/PostLikedBy' import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export const PostLikedByScreen = ({route}: Props) => { + const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const {name, rkey} = route.params const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) const {data: post} = usePostQuery(uri) + const {data: resolvedDid} = useResolveDidQuery(name) + const {data: profile} = useProfileQuery({did: resolvedDid}) + + useSetTitle(profile ? _(msg`Skeet by @${profile.handle}`) : undefined) + let likeCount if (post) { likeCount = post.likeCount diff --git a/src/screens/Post/PostQuotes.tsx b/src/screens/Post/PostQuotes.tsx index 33ebe94f3..556db9c27 100644 --- a/src/screens/Post/PostQuotes.tsx +++ b/src/screens/Post/PostQuotes.tsx @@ -1,24 +1,34 @@ import React from 'react' -import {Plural, Trans} from '@lingui/macro' +import {msg, Plural, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' +import {useSetTitle} from '#/lib/hooks/useSetTitle' import { type CommonNavigatorParams, type NativeStackScreenProps, } from '#/lib/routes/types' import {makeRecordUri} from '#/lib/strings/url-helpers' import {usePostQuery} from '#/state/queries/post' +import {useProfileQuery} from '#/state/queries/profile' +import {useResolveDidQuery} from '#/state/queries/resolve-uri' import {useSetMinimalShellMode} from '#/state/shell' import {PostQuotes as PostQuotesComponent} from '#/view/com/post-thread/PostQuotes' import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export const PostQuotesScreen = ({route}: Props) => { + const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const {name, rkey} = route.params const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) const {data: post} = usePostQuery(uri) + const {data: resolvedDid} = useResolveDidQuery(name) + const {data: profile} = useProfileQuery({did: resolvedDid}) + + useSetTitle(profile ? _(msg`Skeet by @${profile.handle}`) : undefined) + let quoteCount if (post) { quoteCount = post.quoteCount diff --git a/src/screens/Post/PostRepostedBy.tsx b/src/screens/Post/PostRepostedBy.tsx index cbacbb43e..c3f796741 100644 --- a/src/screens/Post/PostRepostedBy.tsx +++ b/src/screens/Post/PostRepostedBy.tsx @@ -1,24 +1,34 @@ import React from 'react' -import {Plural, Trans} from '@lingui/macro' +import {msg, Plural, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' +import {useSetTitle} from '#/lib/hooks/useSetTitle' import { type CommonNavigatorParams, type NativeStackScreenProps, } from '#/lib/routes/types' import {makeRecordUri} from '#/lib/strings/url-helpers' import {usePostQuery} from '#/state/queries/post' +import {useProfileQuery} from '#/state/queries/profile' +import {useResolveDidQuery} from '#/state/queries/resolve-uri' import {useSetMinimalShellMode} from '#/state/shell' import {PostRepostedBy as PostRepostedByComponent} from '#/view/com/post-thread/PostRepostedBy' import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export const PostRepostedByScreen = ({route}: Props) => { + const {_} = useLingui() const {name, rkey} = route.params const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) const setMinimalShellMode = useSetMinimalShellMode() const {data: post} = usePostQuery(uri) + const {data: resolvedDid} = useResolveDidQuery(name) + const {data: profile} = useProfileQuery({did: resolvedDid}) + + useSetTitle(profile ? _(msg`Skeet by @${profile.handle}`) : undefined) + let quoteCount if (post) { quoteCount = post.repostCount diff --git a/src/screens/Profile/KnownFollowers.tsx b/src/screens/Profile/KnownFollowers.tsx index 6c94ebeed..2934c4fd9 100644 --- a/src/screens/Profile/KnownFollowers.tsx +++ b/src/screens/Profile/KnownFollowers.tsx @@ -5,6 +5,7 @@ import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' +import {useSetTitle} from '#/lib/hooks/useSetTitle' import { type CommonNavigatorParams, type NativeStackScreenProps, @@ -12,6 +13,7 @@ import { import {cleanError} from '#/lib/strings/errors' import {logger} from '#/logger' import {useProfileKnownFollowersQuery} from '#/state/queries/known-followers' +import {useProfileQuery} from '#/state/queries/profile' import {useResolveDidQuery} from '#/state/queries/resolve-uri' import {useSetMinimalShellMode} from '#/state/shell' import {ProfileCardWithFollowBtn} from '#/view/com/profile/ProfileCard' @@ -57,6 +59,9 @@ export const ProfileKnownFollowersScreen = ({route}: Props) => { isLoading: isDidLoading, error: resolveError, } = useResolveDidQuery(route.params.name) + const {data: profile} = useProfileQuery({ + did: resolvedDid, + }) const { data, isLoading: isFollowersLoading, @@ -67,6 +72,10 @@ export const ProfileKnownFollowersScreen = ({route}: Props) => { refetch, } = useProfileKnownFollowersQuery(resolvedDid) + useSetTitle( + profile ? _(msg`Followers of @${profile.handle} that you know`) : undefined, + ) + const onRefresh = React.useCallback(async () => { setIsPTRing(true) try { diff --git a/src/screens/Profile/ProfileFollowers.tsx b/src/screens/Profile/ProfileFollowers.tsx index 1bd784738..a003f58f8 100644 --- a/src/screens/Profile/ProfileFollowers.tsx +++ b/src/screens/Profile/ProfileFollowers.tsx @@ -1,7 +1,9 @@ import React from 'react' -import {Plural} from '@lingui/macro' +import {msg, Plural} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' +import {useSetTitle} from '#/lib/hooks/useSetTitle' import { type CommonNavigatorParams, type NativeStackScreenProps, @@ -16,6 +18,7 @@ import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export const ProfileFollowersScreen = ({route}: Props) => { const {name} = route.params + const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const {data: resolvedDid} = useResolveDidQuery(name) @@ -23,6 +26,8 @@ export const ProfileFollowersScreen = ({route}: Props) => { did: resolvedDid, }) + useSetTitle(profile ? _(msg`People following @${profile.handle}`) : undefined) + useFocusEffect( React.useCallback(() => { setMinimalShellMode(false) diff --git a/src/screens/Profile/ProfileFollows.tsx b/src/screens/Profile/ProfileFollows.tsx index 3faf5a332..8b6e0b31a 100644 --- a/src/screens/Profile/ProfileFollows.tsx +++ b/src/screens/Profile/ProfileFollows.tsx @@ -1,7 +1,9 @@ import React from 'react' -import {Plural} from '@lingui/macro' +import {msg, Plural} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' +import {useSetTitle} from '#/lib/hooks/useSetTitle' import { type CommonNavigatorParams, type NativeStackScreenProps, @@ -16,6 +18,7 @@ import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export const ProfileFollowsScreen = ({route}: Props) => { const {name} = route.params + const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const {data: resolvedDid} = useResolveDidQuery(name) @@ -23,6 +26,10 @@ export const ProfileFollowsScreen = ({route}: Props) => { did: resolvedDid, }) + useSetTitle( + profile ? _(msg`People followed by @${profile.handle}`) : undefined, + ) + useFocusEffect( React.useCallback(() => { setMinimalShellMode(false) diff --git a/src/screens/Profile/ProfileSearch.tsx b/src/screens/Profile/ProfileSearch.tsx index e6d80b290..dea567ebe 100644 --- a/src/screens/Profile/ProfileSearch.tsx +++ b/src/screens/Profile/ProfileSearch.tsx @@ -2,6 +2,7 @@ import {useMemo} from 'react' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {useSetTitle} from '#/lib/hooks/useSetTitle' import { type CommonNavigatorParams, type NativeStackScreenProps, @@ -20,6 +21,8 @@ export const ProfileSearchScreen = ({route}: Props) => { const {data: resolvedDid} = useResolveDidQuery(name) const {data: profile} = useProfileQuery({did: resolvedDid}) + useSetTitle(profile ? _(msg`Search @${profile.handle}'s skeets`) : undefined) + const fixedParams = useMemo( () => ({ from: profile?.handle ?? name, diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx index f07c971fb..45ca6059d 100644 --- a/src/view/screens/PostThread.tsx +++ b/src/view/screens/PostThread.tsx @@ -1,22 +1,33 @@ import {useCallback} from 'react' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' +import {useSetTitle} from '#/lib/hooks/useSetTitle' import { type CommonNavigatorParams, type NativeStackScreenProps, } from '#/lib/routes/types' import {makeRecordUri} from '#/lib/strings/url-helpers' +import {useProfileQuery} from '#/state/queries/profile' +import {useResolveDidQuery} from '#/state/queries/resolve-uri' import {useSetMinimalShellMode} from '#/state/shell' import {PostThread} from '#/screens/PostThread' import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps export function PostThreadScreen({route}: Props) { + const {_} = useLingui() const setMinimalShellMode = useSetMinimalShellMode() const {name, rkey} = route.params const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) + const {data: resolvedDid} = useResolveDidQuery(name) + const {data: profile} = useProfileQuery({did: resolvedDid}) + + useSetTitle(profile ? _(msg`Skeet by @${profile.handle}`) : undefined) + useFocusEffect( useCallback(() => { setMinimalShellMode(false)