Working loan notification
This commit is contained in:
parent
79a61f0e98
commit
15ba4eb48c
|
@ -486,7 +486,14 @@ export const createLoanIncomeNotification = async (
|
||||||
reason: 'loan_income',
|
reason: 'loan_income',
|
||||||
createdTime: Date.now(),
|
createdTime: Date.now(),
|
||||||
isSeen: false,
|
isSeen: false,
|
||||||
sourceText: formatMoney(income),
|
sourceId: idempotencyKey,
|
||||||
|
sourceType: 'loan',
|
||||||
|
sourceUpdateType: 'updated',
|
||||||
|
sourceUserName: toUser.name,
|
||||||
|
sourceUserUsername: toUser.username,
|
||||||
|
sourceUserAvatarUrl: toUser.avatarUrl,
|
||||||
|
sourceText: income.toString(),
|
||||||
|
sourceTitle: 'Loan',
|
||||||
}
|
}
|
||||||
await notificationRef.set(removeUndefinedProps(notification))
|
await notificationRef.set(removeUndefinedProps(notification))
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,6 +385,8 @@ function IncomeNotificationItem(props: {
|
||||||
: 'bonus on'
|
: 'bonus on'
|
||||||
} else if (sourceType === 'tip') {
|
} else if (sourceType === 'tip') {
|
||||||
reasonText = !simple ? `tipped you on` : `in tips on`
|
reasonText = !simple ? `tipped you on` : `in tips on`
|
||||||
|
} else if (sourceType === 'loan' && sourceText) {
|
||||||
|
reasonText = `of your invested bets returned as`
|
||||||
} else if (sourceType === 'betting_streak_bonus' && sourceText) {
|
} else if (sourceType === 'betting_streak_bonus' && sourceText) {
|
||||||
reasonText = `for your ${
|
reasonText = `for your ${
|
||||||
parseInt(sourceText) / BETTING_STREAK_BONUS_AMOUNT
|
parseInt(sourceText) / BETTING_STREAK_BONUS_AMOUNT
|
||||||
|
@ -393,7 +395,15 @@ function IncomeNotificationItem(props: {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{reasonText}
|
{reasonText}
|
||||||
{sourceType === 'betting_streak_bonus' ? (
|
{sourceType === 'loan' ? (
|
||||||
|
simple ? (
|
||||||
|
<span className={'ml-1 font-bold'}>Loan</span>
|
||||||
|
) : (
|
||||||
|
<SiteLink className={'ml-1 font-bold'} href={'/loans'}>
|
||||||
|
Loan
|
||||||
|
</SiteLink>
|
||||||
|
)
|
||||||
|
) : sourceType === 'betting_streak_bonus' ? (
|
||||||
simple ? (
|
simple ? (
|
||||||
<span className={'ml-1 font-bold'}>Betting Streak</span>
|
<span className={'ml-1 font-bold'}>Betting Streak</span>
|
||||||
) : (
|
) : (
|
||||||
|
@ -437,6 +447,7 @@ function IncomeNotificationItem(props: {
|
||||||
if (sourceType === 'challenge') return `${sourceSlug}`
|
if (sourceType === 'challenge') return `${sourceSlug}`
|
||||||
if (sourceType === 'betting_streak_bonus')
|
if (sourceType === 'betting_streak_bonus')
|
||||||
return `/${sourceUserUsername}/?show=betting-streak`
|
return `/${sourceUserUsername}/?show=betting-streak`
|
||||||
|
if (sourceType === 'loan') return `/${sourceUserUsername}/?show=loan`
|
||||||
if (sourceContractCreatorUsername && sourceContractSlug)
|
if (sourceContractCreatorUsername && sourceContractSlug)
|
||||||
return `/${sourceContractCreatorUsername}/${sourceContractSlug}#${getSourceIdForLinkComponent(
|
return `/${sourceContractCreatorUsername}/${sourceContractSlug}#${getSourceIdForLinkComponent(
|
||||||
sourceId ?? '',
|
sourceId ?? '',
|
||||||
|
@ -1003,8 +1014,6 @@ function getReasonForShowingNotification(
|
||||||
case 'challenge':
|
case 'challenge':
|
||||||
reasonText = 'accepted your challenge'
|
reasonText = 'accepted your challenge'
|
||||||
break
|
break
|
||||||
case 'loan':
|
|
||||||
reasonText = 'got a portion of your bet back'
|
|
||||||
default:
|
default:
|
||||||
reasonText = ''
|
reasonText = ''
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user