Use new icons on notifications screen (#4299)

* use new icons on notif screen

* replace placeholder icon too

* cull unused legacy icons
This commit is contained in:
Samuel Newman 2024-05-31 15:13:01 +03:00 committed by GitHub
parent 05b55c1966
commit 455937dd0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 52 additions and 690 deletions

View file

@ -17,11 +17,6 @@ import {
ModerationOpts,
} from '@atproto/api'
import {AtUri} from '@atproto/api'
import {
FontAwesomeIcon,
FontAwesomeIconStyle,
Props,
} from '@fortawesome/react-native-fontawesome'
import {msg, plural, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useQueryClient} from '@tanstack/react-query'
@ -29,7 +24,6 @@ import {useQueryClient} from '@tanstack/react-query'
import {FeedNotification} from '#/state/queries/notifications/feed'
import {useAnimatedValue} from 'lib/hooks/useAnimatedValue'
import {usePalette} from 'lib/hooks/usePalette'
import {HeartIconSolid} from 'lib/icons'
import {makeProfileLink} from 'lib/routes/links'
import {sanitizeDisplayName} from 'lib/strings/display-names'
import {sanitizeHandle} from 'lib/strings/handles'
@ -37,6 +31,14 @@ import {niceDate} from 'lib/strings/time'
import {colors, s} from 'lib/styles'
import {isWeb} from 'platform/detection'
import {precacheProfile} from 'state/queries/profile'
import {atoms as a, useTheme} from '#/alf'
import {
ChevronBottom_Stroke2_Corner0_Rounded as ChevronDownIcon,
ChevronTop_Stroke2_Corner0_Rounded as ChevronUpIcon,
} from '#/components/icons/Chevron'
import {Heart2_Filled_Stroke2_Corner0_Rounded as HeartIconFilled} from '#/components/icons/Heart2'
import {PersonPlus_Filled_Stroke2_Corner0_Rounded as PersonPlusIcon} from '#/components/icons/Person'
import {Repost_Stroke2_Corner2_Rounded as RepostIcon} from '#/components/icons/Repost'
import {Link as NewLink} from '#/components/Link'
import {ProfileHoverCard} from '#/components/ProfileHoverCard'
import {FeedSourceCard} from '../feeds/FeedSourceCard'
@ -47,6 +49,7 @@ import {formatCount} from '../util/numeric/format'
import {Text} from '../util/text/Text'
import {TimeElapsed} from '../util/TimeElapsed'
import {PreviewableUserAvatar, UserAvatar} from '../util/UserAvatar'
import hairlineWidth = StyleSheet.hairlineWidth
const MAX_AUTHORS = 5
@ -71,6 +74,7 @@ let FeedItem = ({
const queryClient = useQueryClient()
const pal = usePalette('default')
const {_} = useLingui()
const t = useTheme()
const [isAuthorsExpanded, setAuthorsExpanded] = useState<boolean>(false)
const itemHref = useMemo(() => {
if (item.type === 'post-like' || item.type === 'repost') {
@ -150,30 +154,25 @@ let FeedItem = ({
}
let action = ''
let icon: Props['icon'] | 'HeartIconSolid'
let iconStyle: Props['style'] = []
let icon = (
<HeartIconFilled
size="xl"
style={[
s.likeColor,
// {position: 'relative', top: -4}
]}
/>
)
if (item.type === 'post-like') {
action = _(msg`liked your post`)
icon = 'HeartIconSolid'
iconStyle = [
s.likeColor as FontAwesomeIconStyle,
{position: 'relative', top: -4},
]
} else if (item.type === 'repost') {
action = _(msg`reposted your post`)
icon = 'retweet'
iconStyle = [s.green3 as FontAwesomeIconStyle]
icon = <RepostIcon size="xl" style={{color: t.palette.positive_600}} />
} else if (item.type === 'follow') {
action = _(msg`followed you`)
icon = 'user-plus'
iconStyle = [s.blue3 as FontAwesomeIconStyle]
icon = <PersonPlusIcon size="xl" style={{color: t.palette.primary_500}} />
} else if (item.type === 'feedgen-like') {
action = _(msg`liked your custom feed`)
icon = 'HeartIconSolid'
iconStyle = [
s.likeColor as FontAwesomeIconStyle,
{position: 'relative', top: -4},
]
} else {
return null
}
@ -200,18 +199,10 @@ let FeedItem = ({
item.type === 'repost'
}
onBeforePress={onBeforePress}>
<View style={styles.layoutIcon}>
<View style={[styles.layoutIcon, a.pr_sm]}>
{/* TODO: Prevent conditional rendering and move toward composable
notifications for clearer accessibility labeling */}
{icon === 'HeartIconSolid' ? (
<HeartIconSolid size={28} style={[styles.icon, ...iconStyle]} />
) : (
<FontAwesomeIcon
icon={icon}
size={24}
style={[styles.icon, ...iconStyle]}
/>
)}
{icon}
</View>
<View style={styles.layoutContent}>
<ExpandListPressable
@ -322,9 +313,8 @@ function CondensedAuthorsList({
accessibilityHint={_(
msg`Collapses list of users for a given notification`,
)}>
<FontAwesomeIcon
icon="angle-up"
size={18}
<ChevronUpIcon
size="md"
style={[styles.expandedAuthorsCloseBtnIcon, pal.text]}
/>
<Text type="sm-medium" style={pal.text}>
@ -369,9 +359,8 @@ function CondensedAuthorsList({
+{authors.length - MAX_AUTHORS}
</Text>
) : undefined}
<FontAwesomeIcon
icon="angle-down"
size={18}
<ChevronDownIcon
size="md"
style={[styles.expandedAuthorsCloseBtnIcon, pal.textLight]}
/>
</View>