Add label to profile card (#4843)

zio/stable
Eric Bailey 2024-07-25 18:11:31 -05:00 committed by GitHub
parent 043e5cea64
commit 50769b0b6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 7 deletions

View File

@ -190,7 +190,7 @@ export function SuggestedFollows() {
{profiles.slice(0, maxLength).map(profile => ( {profiles.slice(0, maxLength).map(profile => (
<ProfileCard.Link <ProfileCard.Link
key={profile.did} key={profile.did}
did={profile.handle} profile={profile}
onPress={() => { onPress={() => {
logEvent('feed:interstitial:profileCard:press', {}) logEvent('feed:interstitial:profileCard:press', {})
}} }}
@ -266,7 +266,10 @@ export function SuggestedFollows() {
a.pt_xs, a.pt_xs,
a.gap_md, a.gap_md,
]}> ]}>
<InlineLinkText to="/search" style={[t.atoms.text_contrast_medium]}> <InlineLinkText
label={_(msg`Browse more suggestions`)}
to="/search"
style={[t.atoms.text_contrast_medium]}>
<Trans>Browse more suggestions</Trans> <Trans>Browse more suggestions</Trans>
</InlineLinkText> </InlineLinkText>
<Arrow size="sm" fill={t.atoms.text_contrast_medium.color} /> <Arrow size="sm" fill={t.atoms.text_contrast_medium.color} />
@ -396,7 +399,10 @@ export function SuggestedFeeds() {
a.pt_xs, a.pt_xs,
a.gap_md, a.gap_md,
]}> ]}>
<InlineLinkText to="/search" style={[t.atoms.text_contrast_medium]}> <InlineLinkText
label={_(msg`Browse more suggestions`)}
to="/search"
style={[t.atoms.text_contrast_medium]}>
<Trans>Browse more suggestions</Trans> <Trans>Browse more suggestions</Trans>
</InlineLinkText> </InlineLinkText>
<Arrow size="sm" fill={t.atoms.text_contrast_medium.color} /> <Arrow size="sm" fill={t.atoms.text_contrast_medium.color} />

View File

@ -36,7 +36,7 @@ export function Default({
logContext?: 'ProfileCard' | 'StarterPackProfilesList' logContext?: 'ProfileCard' | 'StarterPackProfilesList'
}) { }) {
return ( return (
<Link did={profile.did}> <Link profile={profile}>
<Card <Card
profile={profile} profile={profile}
moderationOpts={moderationOpts} moderationOpts={moderationOpts}
@ -96,16 +96,24 @@ export function Header({
} }
export function Link({ export function Link({
did, profile,
children, children,
style, style,
...rest ...rest
}: {did: string} & Omit<LinkProps, 'to'>) { }: {
profile: AppBskyActorDefs.ProfileViewDetailed
} & Omit<LinkProps, 'to' | 'label'>) {
const {_} = useLingui()
return ( return (
<InternalLink <InternalLink
label={_(
msg`View ${
profile.displayName || sanitizeHandle(profile.handle)
}'s profile`,
)}
to={{ to={{
screen: 'Profile', screen: 'Profile',
params: {name: did}, params: {name: profile.did},
}} }}
style={[a.flex_col, style]} style={[a.flex_col, style]}
{...rest}> {...rest}>