Remove unnecessary icons

This commit is contained in:
Ian Philips 2022-07-06 13:23:34 -06:00
parent 4e3a08b6f4
commit d6af0c389e

View File

@ -34,9 +34,10 @@ import toast from 'react-hot-toast'
import { formatMoney } from 'common/util/format' import { formatMoney } from 'common/util/format'
import { groupPath } from 'web/lib/firebase/groups' import { groupPath } from 'web/lib/firebase/groups'
import { UNIQUE_BETTOR_BONUS_AMOUNT } from 'common/numeric-constants' import { UNIQUE_BETTOR_BONUS_AMOUNT } from 'common/numeric-constants'
import { groupBy, uniq } from 'lodash' import { groupBy, sum, uniq } from 'lodash'
export const NOTIFICATIONS_PER_PAGE = 30 export const NOTIFICATIONS_PER_PAGE = 30
const MULTIPLE_USERS_KEY = 'multipleUsers'
export default function Notifications() { export default function Notifications() {
const user = useUser() const user = useUser()
@ -186,7 +187,6 @@ function IncomeNotificationGroupItem(props: {
const { notificationGroup, className } = props const { notificationGroup, className } = props
const { notifications } = notificationGroup const { notifications } = notificationGroup
const numSummaryLines = 3 const numSummaryLines = 3
const [expanded, setExpanded] = useState(false) const [expanded, setExpanded] = useState(false)
const [highlighted, setHighlighted] = useState( const [highlighted, setHighlighted] = useState(
notifications.some((n) => !n.isSeen) notifications.some((n) => !n.isSeen)
@ -200,12 +200,12 @@ function IncomeNotificationGroupItem(props: {
if (expanded) setHighlighted(false) if (expanded) setHighlighted(false)
}, [expanded]) }, [expanded])
const totalIncome = notifications.reduce( const totalIncome = sum(
(acc, notification) => notifications.map((notification) =>
acc + (notification.sourceText ? parseInt(notification.sourceText) : 0), notification.sourceText ? parseInt(notification.sourceText) : 0
0 )
) )
// loop through the contracts and combine the notification items into one // Loop through the contracts and combine the notification items into one
function combineNotificationsByAddingNumericSourceTexts( function combineNotificationsByAddingNumericSourceTexts(
notifications: Notification[] notifications: Notification[]
) { ) {
@ -245,7 +245,7 @@ function IncomeNotificationGroupItem(props: {
sourceText: sum.toString(), sourceText: sum.toString(),
sourceUserUsername: sourceUserUsername:
uniqueUsers.length > 1 uniqueUsers.length > 1
? 'Multiple Users' ? MULTIPLE_USERS_KEY
: notificationsForContractId[0].sourceType, : notificationsForContractId[0].sourceType,
} }
newNotifications.push(newNotification) newNotifications.push(newNotification)
@ -362,10 +362,10 @@ function IncomeNotificationItem(props: {
let reasonText = '' let reasonText = ''
if (sourceType === 'bonus' && sourceText) { if (sourceType === 'bonus' && sourceText) {
reasonText = !simple reasonText = !simple
? `for ${ ? `bonus for ${
parseInt(sourceText) / UNIQUE_BETTOR_BONUS_AMOUNT parseInt(sourceText) / UNIQUE_BETTOR_BONUS_AMOUNT
} unique bettors` } unique bettors`
: ' for unique bettors on' : ' bonus for unique bettors on'
} else if (sourceType === 'tip') { } else if (sourceType === 'tip') {
reasonText = !simple ? `tipped you` : `in tips on` reasonText = !simple ? `tipped you` : `in tips on`
} }
@ -407,48 +407,31 @@ function IncomeNotificationItem(props: {
> >
<a href={getSourceUrl(notification)}> <a href={getSourceUrl(notification)}>
<Row className={'items-center text-gray-500 sm:justify-start'}> <Row className={'items-center text-gray-500 sm:justify-start'}>
{sourceType != 'bonus' ? ( <div className={'flex max-w-xl shrink '}>
sourceUserUsername === 'Multiple Users' ? ( {sourceType && reason && (
<div className={'mr-2'}> <div className={'inline'}>
<EmptyAvatar multi /> <span className={'mr-1'}>
</div> <NotificationTextLabel
) : ( contract={null}
<Avatar defaultText={notification.sourceText ?? ''}
avatarUrl={sourceUserAvatarUrl} notification={notification}
size={'sm'} />
className={'mr-1'} </span>
username={sourceUserName}
/> {sourceType != 'bonus' &&
) (sourceUserUsername === MULTIPLE_USERS_KEY ? (
) : ( <span className={'mr-1 truncate'}>Multiple users</span>
<TrendingUpIcon className={'text-primary mr-1 h-7 w-7'} /> ) : (
)} <UserLink
<div className={'flex max-w-xl shrink pl-1 sm:pl-0'}> name={sourceUserName || ''}
<div className={'inline-flex pl-1'}> username={sourceUserUsername || ''}
{sourceType && reason && ( className={'mr-1 flex-shrink-0'}
<div className={'inline'}> justFirstName={true}
<span className={'mr-1'}>
<NotificationTextLabel
contract={null}
defaultText={notification.sourceText ?? ''}
notification={notification}
/> />
</span> ))}
{sourceType != 'bonus' && </div>
(sourceUserUsername === 'Multiple Users' ? ( )}
<span className={'mr-1'}>Users</span> {getReasonForShowingIncomeNotification(false)}
) : (
<UserLink
name={sourceUserName || ''}
username={sourceUserUsername || ''}
className={'mr-1 flex-shrink-0'}
justFirstName={true}
/>
))}
{getReasonForShowingIncomeNotification(false)}
</div>
)}
</div>
<span className={'ml-1 flex hidden sm:inline-block'}> <span className={'ml-1 flex hidden sm:inline-block'}>
on on
<NotificationLink notification={notification} /> <NotificationLink notification={notification} />