Update FeedItem.tsx

This commit is contained in:
Minseo Lee
2024-06-10 15:01:40 +09:00
parent d8adcae539
commit 564e55bcaa
+65 -58
View File
@@ -169,7 +169,6 @@ let FeedItem = ({
) )
let action: ReactElement let action: ReactElement
let actionPlural: ReactElement
let icon = ( let icon = (
<HeartIconFilled <HeartIconFilled
size="xl" size="xl"
@@ -181,67 +180,75 @@ let FeedItem = ({
) )
if (item.type === 'post-like') { if (item.type === 'post-like') {
action = <Trans>{author} liked your post</Trans> action =
actionPlural = ( authors.length > 1 ? (
<Trans> <Trans>
{author} and{' '} {author} and{' '}
<Text style={[pal.text, s.bold]}> <Text style={[pal.text, s.bold]}>
<Plural <Plural
value={authors.length - 1} value={authors.length - 1}
one={`${formattedCount} other`} one={`${formattedCount} other`}
other={`${formattedCount} others`} other={`${formattedCount} others`}
/> />
</Text>{' '} </Text>{' '}
liked your post liked your post
</Trans> </Trans>
) ) : (
<Trans>{author} liked your post</Trans>
)
} else if (item.type === 'repost') { } else if (item.type === 'repost') {
action = <Trans>{author} reposted your post</Trans> action =
actionPlural = ( authors.length > 1 ? (
<Trans> <Trans>
{author} and{' '} {author} and{' '}
<Text style={[pal.text, s.bold]}> <Text style={[pal.text, s.bold]}>
<Plural <Plural
value={authors.length - 1} value={authors.length - 1}
one={`${formattedCount} other`} one={`${formattedCount} other`}
other={`${formattedCount} others`} other={`${formattedCount} others`}
/> />
</Text>{' '} </Text>{' '}
reposted your post reposted your post
</Trans> </Trans>
) ) : (
<Trans>{author} reposted your post</Trans>
)
icon = <RepostIcon size="xl" style={{color: t.palette.positive_600}} /> icon = <RepostIcon size="xl" style={{color: t.palette.positive_600}} />
} else if (item.type === 'follow') { } else if (item.type === 'follow') {
action = <Trans>{author} followed you</Trans> action =
actionPlural = ( authors.length > 1 ? (
<Trans> <Trans>
{author} and{' '} {author} and{' '}
<Text style={[pal.text, s.bold]}> <Text style={[pal.text, s.bold]}>
<Plural <Plural
value={authors.length - 1} value={authors.length - 1}
one={`${formattedCount} other`} one={`${formattedCount} other`}
other={`${formattedCount} others`} other={`${formattedCount} others`}
/> />
</Text>{' '} </Text>{' '}
followed you followed you
</Trans> </Trans>
) ) : (
<Trans>{author} followed you</Trans>
)
icon = <PersonPlusIcon size="xl" style={{color: t.palette.primary_500}} /> icon = <PersonPlusIcon size="xl" style={{color: t.palette.primary_500}} />
} else if (item.type === 'feedgen-like') { } else if (item.type === 'feedgen-like') {
action = <Trans>{author} liked your custom feed</Trans> action =
actionPlural = ( authors.length > 1 ? (
<Trans> <Trans>
{author} and{' '} {author} and{' '}
<Text style={[pal.text, s.bold]}> <Text style={[pal.text, s.bold]}>
<Plural <Plural
value={authors.length - 1} value={authors.length - 1}
one={`${formattedCount} other`} one={`${formattedCount} other`}
other={`${formattedCount} others`} other={`${formattedCount} others`}
/> />
</Text>{' '} </Text>{' '}
liked your custom feed liked your custom feed
</Trans> </Trans>
) ) : (
<Trans>{author} liked your custom feed</Trans>
)
} else { } else {
return null return null
} }
@@ -309,7 +316,7 @@ let FeedItem = ({
/> />
<ExpandedAuthorsList visible={isAuthorsExpanded} authors={authors} /> <ExpandedAuthorsList visible={isAuthorsExpanded} authors={authors} />
<Text style={[styles.meta, pal.text]}> <Text style={[styles.meta, pal.text]}>
{authors.length > 1 ? actionPlural : action} {action}
<TimeElapsed timestamp={item.notification.indexedAt}> <TimeElapsed timestamp={item.notification.indexedAt}>
{({timeElapsed}) => ( {({timeElapsed}) => (
<Text <Text