From fe66ceb2c8c2539c86a0ffdd9df615e4dd0e3362 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Thu, 7 Jul 2022 11:20:53 -0600 Subject: [PATCH] Give notification question priority & 2 lines --- web/pages/notifications.tsx | 182 +++++++++++++++--------------------- 1 file changed, 75 insertions(+), 107 deletions(-) diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index cf2d7741..f5ba6d8e 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -8,7 +8,6 @@ import { Page } from 'web/components/page' import { Title } from 'web/components/title' import { doc, updateDoc } from 'firebase/firestore' import { db } from 'web/lib/firebase/init' -import { CopyLinkDateTimeComponent } from 'web/components/feed/copy-link-date-time' import { UserLink } from 'web/components/user-page' import { notification_subscribe_types, PrivateUser } from 'common/user' import { Contract } from 'common/contract' @@ -340,13 +339,7 @@ function IncomeNotificationItem(props: { justSummary?: boolean }) { const { notification, justSummary } = props - const { - sourceType, - sourceUserName, - reason, - sourceUserUsername, - createdTime, - } = notification + const { sourceType, sourceUserName, sourceUserUsername } = notification const [highlighted] = useState(!notification.isSeen) useEffect(() => { @@ -365,7 +358,7 @@ function IncomeNotificationItem(props: { } else if (sourceType === 'tip') { reasonText = !simple ? `tipped you` : `in tips on` } - return {reasonText} + return reasonText } if (justSummary) { @@ -385,7 +378,7 @@ function IncomeNotificationItem(props: { {getReasonForShowingIncomeNotification(true)} - + @@ -403,42 +396,33 @@ function IncomeNotificationItem(props: { > -
- {sourceType && reason && ( -
- - +
+ + + +
+ + {sourceType != 'bonus' && + (sourceUserUsername === MULTIPLE_USERS_KEY ? ( + Multiple users + ) : ( + - - - {sourceType != 'bonus' && - (sourceUserUsername === MULTIPLE_USERS_KEY ? ( - Multiple users - ) : ( - - ))} -
- )} - {getReasonForShowingIncomeNotification(false)} - -
- - on - -
@@ -484,23 +468,20 @@ function NotificationGroupItem(props: { )} -
-
setExpanded(!expanded)} - className={' flex cursor-pointer truncate pl-1 sm:pl-0'} - > +
+ {sourceContractTitle ? ( - <> - {'Activity on '} - - - - + + Activity on + + ) : ( - 'Other activity' + + Other activity + + )} -
- +
@@ -561,17 +542,13 @@ function NotificationItem(props: { const { notification, justSummary, hideTitle } = props const { sourceType, - sourceId, sourceUserName, sourceUserAvatarUrl, sourceUpdateType, reasonText, reason, sourceUserUsername, - createdTime, sourceText, - sourceContractCreatorUsername, - sourceContractSlug, } = notification const [defaultNotificationText, setDefaultNotificationText] = @@ -640,45 +617,32 @@ function NotificationItem(props: { className={'mr-2'} username={sourceUserName} /> -
-
- {sourceUpdateType != 'closed' && ( - - )} - {sourceType && reason && ( -
- - {getReasonForShowingNotification(notification, false, true)} - - {!hideTitle && ( - + +
+ + + {sourceUpdateType != 'closed' && ( + )} -
- )} - {sourceId && - sourceContractSlug && - sourceContractCreatorUsername ? ( - - ) : ( - - )} + {getReasonForShowingNotification(notification, false, true)} + {hideTitle && ( + + )} +
+ {!hideTitle && } + {!hideTitle && ( + + + + )} +
-
+
{ return notifications } -function NotificationLink(props: { notification: Notification }) { - const { notification } = props +function NotificationLink(props: { + notification: Notification + noClick?: boolean +}) { + const { notification, noClick } = props const { sourceType, sourceContractTitle, @@ -718,8 +685,17 @@ function NotificationLink(props: { notification: Notification }) { sourceSlug, sourceTitle, } = notification + if (noClick) + return ( + + {sourceContractTitle || sourceTitle} + + ) return ( {sourceContractTitle || sourceTitle} @@ -908,12 +881,7 @@ function getReasonForShowingNotification( default: reasonText = '' } - - return ( - - {replaceOn ? reasonText.replace(' on', '') : reasonText} - - ) + return replaceOn ? reasonText.replace(' on', '') : reasonText } // TODO: where should we put referral bonus notifications?