Skip to content

Commit

Permalink
[PLAT-819]: Fix copy for repost and save of albums notifications (#3151)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrina-kiam authored Apr 4, 2023
1 parent 10617a2 commit 78cbdfa
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { FavoriteNotification as FavoriteNotificationType } from '@audius/c
import {
formatCount,
notificationsSelectors,
useProxySelector
useProxySelector,
Entity
} from '@audius/common'

import IconHeart from 'app/assets/images/iconHeart.svg'
Expand Down Expand Up @@ -50,6 +51,11 @@ export const FavoriteNotification = (props: FavoriteNotificationProps) => {
[notification]
)

const entityTypeText =
entity && 'is_album' in entity && entity.is_album
? Entity.Album
: entityType

const handlePress = useCallback(() => {
navigation.navigate(notification)
}, [navigation, notification])
Expand All @@ -64,7 +70,7 @@ export const FavoriteNotification = (props: FavoriteNotificationProps) => {
<NotificationText>
<UserNameLink user={firstUser} />
{otherUsersCount > 0 ? messages.others(otherUsersCount) : null}
{messages.favorited} {entityType.toLowerCase()}{' '}
{messages.favorited} {entityTypeText.toLowerCase()}{' '}
<EntityLink entity={entity} />
</NotificationText>
</NotificationTile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { FavoriteOfRepostNotification as FavoriteOfRepostNotificationType }
import {
formatCount,
notificationsSelectors,
useProxySelector
useProxySelector,
Entity
} from '@audius/common'

import IconHeart from 'app/assets/images/iconHeart.svg'
Expand Down Expand Up @@ -52,6 +53,11 @@ export const FavoriteOfRepostNotification = (
[notification]
)

const entityTypeText =
entity && 'is_album' in entity && entity.is_album
? Entity.Album
: entityType

const handlePress = useCallback(() => {
navigation.navigate(notification)
}, [navigation, notification])
Expand All @@ -66,7 +72,7 @@ export const FavoriteOfRepostNotification = (
<NotificationText>
<UserNameLink user={firstUser} />
{otherUsersCount > 0 ? messages.others(otherUsersCount) : null}
{messages.favorited} {entityType.toLowerCase()}{' '}
{messages.favorited} {entityTypeText.toLowerCase()}{' '}
<EntityLink entity={entity} />
</NotificationText>
</NotificationTile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { RepostNotification as RepostNotificationType } from '@audius/commo
import {
useProxySelector,
formatCount,
notificationsSelectors
notificationsSelectors,
Entity
} from '@audius/common'

import IconRepost from 'app/assets/images/iconRepost.svg'
Expand Down Expand Up @@ -49,6 +50,11 @@ export const RepostNotification = (props: RepostNotificationProps) => {
[notification]
)

const entityTypeText =
entity && 'is_album' in entity && entity.is_album
? Entity.Album
: entityType

const handlePress = useCallback(() => {
navigation.navigate(notification)
}, [navigation, notification])
Expand All @@ -63,7 +69,7 @@ export const RepostNotification = (props: RepostNotificationProps) => {
<NotificationText>
<UserNameLink user={firstUser} />
{otherUsersCount > 0 ? messages.others(otherUsersCount) : null}
{messages.reposted} {entityType.toLowerCase()}{' '}
{messages.reposted} {entityTypeText.toLowerCase()}{' '}
<EntityLink entity={entity} />
</NotificationText>
</NotificationTile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { RepostOfRepostNotification as RepostOfRepostNotificationType } fro
import {
useProxySelector,
formatCount,
notificationsSelectors
notificationsSelectors,
Entity
} from '@audius/common'

import IconRepost from 'app/assets/images/iconRepost.svg'
Expand Down Expand Up @@ -51,6 +52,11 @@ export const RepostOfRepostNotification = (
[notification]
)

const entityTypeText =
entity && 'is_album' in entity && entity.is_album
? Entity.Album
: entityType

const handlePress = useCallback(() => {
navigation.navigate(notification)
}, [navigation, notification])
Expand All @@ -65,7 +71,7 @@ export const RepostOfRepostNotification = (
<NotificationText>
<UserNameLink user={firstUser} />
{otherUsersCount > 0 ? messages.others(otherUsersCount) : null}
{messages.reposted} {entityType.toLowerCase()}{' '}
{messages.reposted} {entityTypeText.toLowerCase()}{' '}
<EntityLink entity={entity} />
</NotificationText>
</NotificationTile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { MouseEventHandler, useCallback } from 'react'

import {
notificationsSelectors,
FavoriteNotification as FavoriteNotificationType
FavoriteNotification as FavoriteNotificationType,
Entity
} from '@audius/common'
import { push } from 'connected-react-router'
import { useDispatch } from 'react-redux'
Expand Down Expand Up @@ -48,6 +49,11 @@ export const FavoriteNotification = (props: FavoriteNotificationProps) => {
getNotificationEntity(state, notification)
)

const entityTypeText =
entity && 'is_album' in entity && entity.is_album
? Entity.Album
: entityType

const dispatch = useDispatch()

const handleGoToEntity = useGoToEntity(entity, entityType)
Expand Down Expand Up @@ -91,8 +97,8 @@ export const FavoriteNotification = (props: FavoriteNotificationProps) => {
<OthersLink othersCount={otherUsersCount} onClick={handleClick} />
) : null}
{messages.favorited}
{entityType.toLowerCase()}{' '}
<EntityLink entity={entity} entityType={entityType} />
{entityTypeText.toLowerCase()}{' '}
<EntityLink entity={entity} entityType={entityTypeText} />
</NotificationBody>
<NotificationFooter timeLabel={timeLabel} isViewed={isViewed} />
</NotificationTile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
notificationsSelectors,
FavoriteOfRepostNotification as FavoriteOfRepostNotificationType
FavoriteOfRepostNotification as FavoriteOfRepostNotificationType,
Entity
} from '@audius/common'

import { useSelector } from 'utils/reducer'
Expand Down Expand Up @@ -39,6 +40,11 @@ export const FavoriteOfRepostNotification = (
getNotificationEntity(state, notification)
)

const entityTypeText =
entity && 'is_album' in entity && entity.is_album
? Entity.Album
: entityType

const handleGoToEntity = useGoToEntity(entity, entityType)

if (!users || !firstUser || !entity) return null
Expand All @@ -62,8 +68,8 @@ export const FavoriteOfRepostNotification = (
<OthersText othersCount={otherUsersCount} />
) : null}
{messages.favorited}
{entityType.toLowerCase()}{' '}
<EntityLink entity={entity} entityType={entityType} />
{entityTypeText.toLowerCase()}{' '}
<EntityLink entity={entity} entityType={entityTypeText} />
</NotificationBody>
<NotificationFooter timeLabel={timeLabel} isViewed={isViewed} />
</NotificationTile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MouseEventHandler, useCallback } from 'react'

import {
Entity,
notificationsSelectors,
RepostNotification as RepostNotificationType
} from '@audius/common'
Expand Down Expand Up @@ -49,6 +50,11 @@ export const RepostNotification = (props: RepostNotificationProps) => {
getNotificationEntity(state, notification)
)

const entityTypeText =
entity && 'is_album' in entity && entity.is_album
? Entity.Album
: entityType

const dispatch = useDispatch()

const handleGoToEntity = useGoToEntity(entity, entityType)
Expand Down Expand Up @@ -95,8 +101,8 @@ export const RepostNotification = (props: RepostNotificationProps) => {
{otherUsersCount > 0 ? (
<OthersLink othersCount={otherUsersCount} onClick={handleClick} />
) : null}{' '}
{messages.reposted} {entityType.toLowerCase()}{' '}
<EntityLink entity={entity} entityType={entityType} />
{messages.reposted} {entityTypeText.toLowerCase()}{' '}
<EntityLink entity={entity} entityType={entityTypeText} />
</NotificationBody>
<NotificationFooter timeLabel={timeLabel} isViewed={isViewed} />
</NotificationTile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
Entity,
notificationsSelectors,
RepostOfRepostNotification as RepostOfRepostNotificationType
} from '@audius/common'
Expand Down Expand Up @@ -40,6 +41,11 @@ export const RepostOfRepostNotification = (
getNotificationEntity(state, notification)
)

const entityTypeText =
entity && 'is_album' in entity && entity.is_album
? Entity.Album
: entityType

const handleGoToEntity = useGoToEntity(entity, entityType)

if (!users || !firstUser || !entity) return null
Expand All @@ -62,8 +68,8 @@ export const RepostOfRepostNotification = (
{otherUsersCount > 0 ? (
<OthersText othersCount={otherUsersCount} />
) : null}{' '}
{messages.reposted} {entityType.toLowerCase()}{' '}
<EntityLink entity={entity} entityType={entityType} />
{messages.reposted} {entityTypeText.toLowerCase()}{' '}
<EntityLink entity={entity} entityType={entityTypeText} />
</NotificationBody>
<NotificationFooter timeLabel={timeLabel} isViewed={isViewed} />
</NotificationTile>
Expand Down

0 comments on commit 78cbdfa

Please sign in to comment.