-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Followers/following exact count (#7057)
* followers exact count in heading * exact count for following * move files to new dir * use <Plural>
- Loading branch information
Showing
5 changed files
with
114 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react' | ||
import {Plural} from '@lingui/macro' | ||
import {useFocusEffect} from '@react-navigation/native' | ||
|
||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types' | ||
import {sanitizeDisplayName} from '#/lib/strings/display-names' | ||
import {useProfileQuery} from '#/state/queries/profile' | ||
import {useResolveDidQuery} from '#/state/queries/resolve-uri' | ||
import {useSetMinimalShellMode} from '#/state/shell' | ||
import {ProfileFollowers as ProfileFollowersComponent} from '#/view/com/profile/ProfileFollowers' | ||
import * as Layout from '#/components/Layout' | ||
|
||
type Props = NativeStackScreenProps<CommonNavigatorParams, 'ProfileFollowers'> | ||
export const ProfileFollowersScreen = ({route}: Props) => { | ||
const {name} = route.params | ||
const setMinimalShellMode = useSetMinimalShellMode() | ||
|
||
const {data: resolvedDid} = useResolveDidQuery(name) | ||
const {data: profile} = useProfileQuery({ | ||
did: resolvedDid, | ||
}) | ||
|
||
useFocusEffect( | ||
React.useCallback(() => { | ||
setMinimalShellMode(false) | ||
}, [setMinimalShellMode]), | ||
) | ||
|
||
return ( | ||
<Layout.Screen testID="profileFollowersScreen"> | ||
<Layout.Header.Outer> | ||
<Layout.Header.BackButton /> | ||
<Layout.Header.Content> | ||
{profile && ( | ||
<> | ||
<Layout.Header.TitleText> | ||
{sanitizeDisplayName(profile.displayName || profile.handle)} | ||
</Layout.Header.TitleText> | ||
<Layout.Header.SubtitleText> | ||
<Plural | ||
value={profile.followersCount ?? 0} | ||
one="# follower" | ||
other="# followers" | ||
/> | ||
</Layout.Header.SubtitleText> | ||
</> | ||
)} | ||
</Layout.Header.Content> | ||
<Layout.Header.Slot /> | ||
</Layout.Header.Outer> | ||
<Layout.Center> | ||
<ProfileFollowersComponent name={name} /> | ||
</Layout.Center> | ||
</Layout.Screen> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react' | ||
import {Plural} from '@lingui/macro' | ||
import {useFocusEffect} from '@react-navigation/native' | ||
|
||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types' | ||
import {sanitizeDisplayName} from '#/lib/strings/display-names' | ||
import {useProfileQuery} from '#/state/queries/profile' | ||
import {useResolveDidQuery} from '#/state/queries/resolve-uri' | ||
import {useSetMinimalShellMode} from '#/state/shell' | ||
import {ProfileFollows as ProfileFollowsComponent} from '#/view/com/profile/ProfileFollows' | ||
import * as Layout from '#/components/Layout' | ||
|
||
type Props = NativeStackScreenProps<CommonNavigatorParams, 'ProfileFollows'> | ||
export const ProfileFollowsScreen = ({route}: Props) => { | ||
const {name} = route.params | ||
const setMinimalShellMode = useSetMinimalShellMode() | ||
|
||
const {data: resolvedDid} = useResolveDidQuery(name) | ||
const {data: profile} = useProfileQuery({ | ||
did: resolvedDid, | ||
}) | ||
|
||
useFocusEffect( | ||
React.useCallback(() => { | ||
setMinimalShellMode(false) | ||
}, [setMinimalShellMode]), | ||
) | ||
|
||
return ( | ||
<Layout.Screen testID="profileFollowsScreen"> | ||
<Layout.Header.Outer> | ||
<Layout.Header.BackButton /> | ||
<Layout.Header.Content> | ||
{profile && ( | ||
<> | ||
<Layout.Header.TitleText> | ||
{sanitizeDisplayName(profile.displayName || profile.handle)} | ||
</Layout.Header.TitleText> | ||
<Layout.Header.SubtitleText> | ||
<Plural | ||
value={profile.followersCount ?? 0} | ||
one="# following" | ||
other="# following" | ||
/> | ||
</Layout.Header.SubtitleText> | ||
</> | ||
)} | ||
</Layout.Header.Content> | ||
<Layout.Header.Slot /> | ||
</Layout.Header.Outer> | ||
<Layout.Center> | ||
<ProfileFollowsComponent name={name} /> | ||
</Layout.Center> | ||
</Layout.Screen> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.