diff --git a/web/components/avatar.tsx b/web/components/avatar.tsx index e6506c03..53257deb 100644 --- a/web/components/avatar.tsx +++ b/web/components/avatar.tsx @@ -53,7 +53,7 @@ export function EmptyAvatar(props: { size?: number; multi?: boolean }) { return (
diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index bc952618..4917dfea 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -375,9 +375,8 @@ function IncomeNotificationItem(props: { justSummary={true} /> - + {getReasonForShowingNotification(notification, true)} - {` on`} @@ -405,64 +404,51 @@ function IncomeNotificationItem(props: { ) ) : ( )} -
-
- {sourceType != 'bonus' && - (sourceUserUsername === 'Multiple Users' ? ( - Multiple Users - ) : ( - - ))} -
- {sourceType && reason && ( -
- {getReasonForShowingNotification(notification, false)} - -
- )} -
+
+
+ {sourceType && reason && ( +
+ + + + {sourceType != 'bonus' && + (sourceUserUsername === 'Multiple Users' ? ( + Users + ) : ( + + ))} + {getReasonForShowingNotification(notification, false)} +
+ )}
- {sourceId && sourceContractSlug && sourceContractCreatorUsername ? ( - - ) : ( - - )} + +
-
- -
- -
+ + on + + +
) @@ -507,16 +493,18 @@ function NotificationGroupItem(props: { )} -
+
setExpanded(!expanded)} - className={'line-clamp-1 cursor-pointer pl-1 sm:pl-0'} + className={' flex cursor-pointer truncate pl-1 sm:pl-0'} > {sourceContractTitle ? ( - - {'Activity on '} - - + <> + {'Activity on '} + + + + ) : ( 'Other activity' )} @@ -560,6 +548,7 @@ function NotificationGroupItem(props: { notification={notification} key={notification.id} justSummary={false} + hideTitle={true} /> ))} @@ -789,7 +778,7 @@ function NotificationLink(props: { notification: Notification }) { : '' } className={ - 'ml-1 font-bold hover:underline hover:decoration-indigo-400 hover:decoration-2' + 'ml-1 inline max-w-xs truncate font-bold text-gray-500 hover:underline hover:decoration-indigo-400 hover:decoration-2 sm:max-w-sm' } > {sourceContractTitle || sourceTitle} @@ -842,8 +831,9 @@ function getSourceIdForLinkComponent( function NotificationItem(props: { notification: Notification justSummary?: boolean + hideTitle?: boolean }) { - const { notification, justSummary } = props + const { notification, justSummary, hideTitle } = props const { sourceType, sourceId, @@ -892,10 +882,7 @@ function NotificationItem(props: { {sourceType && reason && - getReasonForShowingNotification(notification, true).replace( - ' on', - '' - )} + getReasonForShowingNotification(notification, true, true)}
)} -
- {sourceType && reason && ( -
- {getReasonForShowingNotification(notification, false)} + {sourceType && reason && ( +
+ + {getReasonForShowingNotification(notification, false, true)} + + {!hideTitle && ( -
- )} -
+ )} +
+ )} + {sourceId && + sourceContractSlug && + sourceContractCreatorUsername ? ( + + ) : ( + + )}
- {sourceId && sourceContractSlug && sourceContractCreatorUsername ? ( - - ) : ( - - )}
@@ -1035,7 +1026,9 @@ function NotificationTextLabel(props: { ) } else if ((sourceType === 'bonus' || sourceType === 'tip') && sourceText) { return ( - {formatMoney(parseInt(sourceText))} + + {'+' + formatMoney(parseInt(sourceText))} + ) } // return default text @@ -1048,7 +1041,8 @@ function NotificationTextLabel(props: { function getReasonForShowingNotification( notification: Notification, - simple?: boolean + simple?: boolean, + replaceOn?: boolean ) { const { sourceType, sourceUpdateType, sourceText, reason, sourceSlug } = notification @@ -1106,17 +1100,22 @@ function getReasonForShowingNotification( case 'bonus': if (reason === 'unique_bettors_on_your_contract' && sourceText) reasonText = !simple - ? `You had ${ + ? `for ${ parseInt(sourceText) / UNIQUE_BETTOR_BONUS_AMOUNT - } unique bettors on` - : ' for unique bettors' + } unique bettors` + : ' for unique bettors on' else reasonText = 'You earned your daily manna' break case 'tip': - reasonText = !simple ? `tipped you on` : `in tips on` + reasonText = !simple ? `tipped you` : `in tips on` break default: reasonText = '' } - return reasonText + + return ( + + {replaceOn ? reasonText.replace(' on', '') : reasonText} + + ) }