diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-12-11 22:24:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-11 22:24:22 +0000 |
commit | 48346edde606e8cb5cd2071a1a090610ff1670a9 (patch) | |
tree | 72d10da706a1084e39b8e9e6661b4934f396ba90 /src/screens/Post/PostRepostedBy.tsx | |
parent | 89c6ca94fe5f13a06d592be0771ebc27774b01ea (diff) | |
download | voidsky-48346edde606e8cb5cd2071a1a090610ff1670a9.tar.zst |
More exact counts (#7059)
* post liked by * rm unnecessary layout.center * do post quotes/reposts * set height of header to prevent layout shifts
Diffstat (limited to 'src/screens/Post/PostRepostedBy.tsx')
-rw-r--r-- | src/screens/Post/PostRepostedBy.tsx | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/screens/Post/PostRepostedBy.tsx b/src/screens/Post/PostRepostedBy.tsx index 304e70808..28cd7e87c 100644 --- a/src/screens/Post/PostRepostedBy.tsx +++ b/src/screens/Post/PostRepostedBy.tsx @@ -1,15 +1,12 @@ import React from 'react' -import {msg} from '@lingui/macro' -import {useLingui} from '@lingui/react' +import {Plural, Trans} from '@lingui/macro' import {useFocusEffect} from '@react-navigation/native' import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types' import {makeRecordUri} from '#/lib/strings/url-helpers' -import {isWeb} from '#/platform/detection' +import {usePostThreadQuery} from '#/state/queries/post-thread' import {useSetMinimalShellMode} from '#/state/shell' import {PostRepostedBy as PostRepostedByComponent} from '#/view/com/post-thread/PostRepostedBy' -import {ViewHeader} from '#/view/com/util/ViewHeader' -import {CenteredView} from '#/view/com/util/Views' import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps<CommonNavigatorParams, 'PostRepostedBy'> @@ -17,7 +14,12 @@ export const PostRepostedByScreen = ({route}: Props) => { const {name, rkey} = route.params const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey) const setMinimalShellMode = useSetMinimalShellMode() - const {_} = useLingui() + const {data: post} = usePostThreadQuery(uri) + + let quoteCount + if (post?.thread.type === 'post') { + quoteCount = post.thread.post.repostCount + } useFocusEffect( React.useCallback(() => { @@ -27,10 +29,27 @@ export const PostRepostedByScreen = ({route}: Props) => { return ( <Layout.Screen> - <CenteredView sideBorders={true}> - <ViewHeader title={_(msg`Reposted By`)} showBorder={!isWeb} /> - <PostRepostedByComponent uri={uri} /> - </CenteredView> + <Layout.Header.Outer> + <Layout.Header.BackButton /> + <Layout.Header.Content> + {post && ( + <> + <Layout.Header.TitleText> + <Trans>Reposted By</Trans> + </Layout.Header.TitleText> + <Layout.Header.SubtitleText> + <Plural + value={quoteCount ?? 0} + one="# reposts" + other="# reposts" + /> + </Layout.Header.SubtitleText> + </> + )} + </Layout.Header.Content> + <Layout.Header.Slot /> + </Layout.Header.Outer> + <PostRepostedByComponent uri={uri} /> </Layout.Screen> ) } |