From 78cbdfa49f46e768004822cdd1c652afb5e9cc3c Mon Sep 17 00:00:00 2001 From: sabrina-kiam <109105561+sabrina-kiam@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:39:45 -0400 Subject: [PATCH] [PLAT-819]: Fix copy for repost and save of albums notifications (#3151) --- .../Notifications/FavoriteNotification.tsx | 10 ++++++++-- .../Notifications/FavoriteOfRepostNotification.tsx | 10 ++++++++-- .../Notifications/RepostNotification.tsx | 10 ++++++++-- .../Notifications/RepostOfRepostNotification.tsx | 10 ++++++++-- .../Notification/FavoriteNotification.tsx | 12 +++++++++--- .../Notification/FavoriteOfRepostNotification.tsx | 12 +++++++++--- .../notification/Notification/RepostNotification.tsx | 10 ++++++++-- .../Notification/RepostOfRepostNotification.tsx | 10 ++++++++-- 8 files changed, 66 insertions(+), 18 deletions(-) diff --git a/packages/mobile/src/screens/notifications-screen/Notifications/FavoriteNotification.tsx b/packages/mobile/src/screens/notifications-screen/Notifications/FavoriteNotification.tsx index acb22ef7c03..3e5619d095e 100644 --- a/packages/mobile/src/screens/notifications-screen/Notifications/FavoriteNotification.tsx +++ b/packages/mobile/src/screens/notifications-screen/Notifications/FavoriteNotification.tsx @@ -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' @@ -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]) @@ -64,7 +70,7 @@ export const FavoriteNotification = (props: FavoriteNotificationProps) => { {otherUsersCount > 0 ? messages.others(otherUsersCount) : null} - {messages.favorited} {entityType.toLowerCase()}{' '} + {messages.favorited} {entityTypeText.toLowerCase()}{' '} diff --git a/packages/mobile/src/screens/notifications-screen/Notifications/FavoriteOfRepostNotification.tsx b/packages/mobile/src/screens/notifications-screen/Notifications/FavoriteOfRepostNotification.tsx index b08ab8321ae..76818ad4f65 100644 --- a/packages/mobile/src/screens/notifications-screen/Notifications/FavoriteOfRepostNotification.tsx +++ b/packages/mobile/src/screens/notifications-screen/Notifications/FavoriteOfRepostNotification.tsx @@ -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' @@ -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]) @@ -66,7 +72,7 @@ export const FavoriteOfRepostNotification = ( {otherUsersCount > 0 ? messages.others(otherUsersCount) : null} - {messages.favorited} {entityType.toLowerCase()}{' '} + {messages.favorited} {entityTypeText.toLowerCase()}{' '} diff --git a/packages/mobile/src/screens/notifications-screen/Notifications/RepostNotification.tsx b/packages/mobile/src/screens/notifications-screen/Notifications/RepostNotification.tsx index 8e314ffafb1..f3c78473d36 100644 --- a/packages/mobile/src/screens/notifications-screen/Notifications/RepostNotification.tsx +++ b/packages/mobile/src/screens/notifications-screen/Notifications/RepostNotification.tsx @@ -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' @@ -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]) @@ -63,7 +69,7 @@ export const RepostNotification = (props: RepostNotificationProps) => { {otherUsersCount > 0 ? messages.others(otherUsersCount) : null} - {messages.reposted} {entityType.toLowerCase()}{' '} + {messages.reposted} {entityTypeText.toLowerCase()}{' '} diff --git a/packages/mobile/src/screens/notifications-screen/Notifications/RepostOfRepostNotification.tsx b/packages/mobile/src/screens/notifications-screen/Notifications/RepostOfRepostNotification.tsx index ff6c2dc9f90..28deadbb4fc 100644 --- a/packages/mobile/src/screens/notifications-screen/Notifications/RepostOfRepostNotification.tsx +++ b/packages/mobile/src/screens/notifications-screen/Notifications/RepostOfRepostNotification.tsx @@ -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' @@ -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]) @@ -65,7 +71,7 @@ export const RepostOfRepostNotification = ( {otherUsersCount > 0 ? messages.others(otherUsersCount) : null} - {messages.reposted} {entityType.toLowerCase()}{' '} + {messages.reposted} {entityTypeText.toLowerCase()}{' '} diff --git a/packages/web/src/components/notification/Notification/FavoriteNotification.tsx b/packages/web/src/components/notification/Notification/FavoriteNotification.tsx index 359bb325268..d79a327066e 100644 --- a/packages/web/src/components/notification/Notification/FavoriteNotification.tsx +++ b/packages/web/src/components/notification/Notification/FavoriteNotification.tsx @@ -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' @@ -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) @@ -91,8 +97,8 @@ export const FavoriteNotification = (props: FavoriteNotificationProps) => { ) : null} {messages.favorited} - {entityType.toLowerCase()}{' '} - + {entityTypeText.toLowerCase()}{' '} + diff --git a/packages/web/src/components/notification/Notification/FavoriteOfRepostNotification.tsx b/packages/web/src/components/notification/Notification/FavoriteOfRepostNotification.tsx index 0dbf73ac42a..ebd3ee4e304 100644 --- a/packages/web/src/components/notification/Notification/FavoriteOfRepostNotification.tsx +++ b/packages/web/src/components/notification/Notification/FavoriteOfRepostNotification.tsx @@ -1,6 +1,7 @@ import { notificationsSelectors, - FavoriteOfRepostNotification as FavoriteOfRepostNotificationType + FavoriteOfRepostNotification as FavoriteOfRepostNotificationType, + Entity } from '@audius/common' import { useSelector } from 'utils/reducer' @@ -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 @@ -62,8 +68,8 @@ export const FavoriteOfRepostNotification = ( ) : null} {messages.favorited} - {entityType.toLowerCase()}{' '} - + {entityTypeText.toLowerCase()}{' '} + diff --git a/packages/web/src/components/notification/Notification/RepostNotification.tsx b/packages/web/src/components/notification/Notification/RepostNotification.tsx index 1ea4059c414..4f66af162eb 100644 --- a/packages/web/src/components/notification/Notification/RepostNotification.tsx +++ b/packages/web/src/components/notification/Notification/RepostNotification.tsx @@ -1,6 +1,7 @@ import { MouseEventHandler, useCallback } from 'react' import { + Entity, notificationsSelectors, RepostNotification as RepostNotificationType } from '@audius/common' @@ -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) @@ -95,8 +101,8 @@ export const RepostNotification = (props: RepostNotificationProps) => { {otherUsersCount > 0 ? ( ) : null}{' '} - {messages.reposted} {entityType.toLowerCase()}{' '} - + {messages.reposted} {entityTypeText.toLowerCase()}{' '} + diff --git a/packages/web/src/components/notification/Notification/RepostOfRepostNotification.tsx b/packages/web/src/components/notification/Notification/RepostOfRepostNotification.tsx index 8206430e22b..4bfe8005786 100644 --- a/packages/web/src/components/notification/Notification/RepostOfRepostNotification.tsx +++ b/packages/web/src/components/notification/Notification/RepostOfRepostNotification.tsx @@ -1,4 +1,5 @@ import { + Entity, notificationsSelectors, RepostOfRepostNotification as RepostOfRepostNotificationType } from '@audius/common' @@ -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 @@ -62,8 +68,8 @@ export const RepostOfRepostNotification = ( {otherUsersCount > 0 ? ( ) : null}{' '} - {messages.reposted} {entityType.toLowerCase()}{' '} - + {messages.reposted} {entityTypeText.toLowerCase()}{' '} +