diff --git a/components/Notification/NotificationItem.tsx b/components/Notification/NotificationItem.tsx
index b92c19e05..b54841432 100644
--- a/components/Notification/NotificationItem.tsx
+++ b/components/Notification/NotificationItem.tsx
@@ -5,6 +5,7 @@ import {
formatNotificationMessage,
getHubDetailsFromNotification,
formatNavigationUrl,
+ getBountyForYouUsdOverride,
getRSCAmountFromNotification,
} from './lib/formatNotification';
import { Avatar } from '@/components/ui/Avatar';
@@ -32,6 +33,7 @@ export function NotificationItem({ notification }: NotificationItemProps) {
const formattedNavigationUrl = formatNavigationUrl(notification);
const hasNavigationUrl = !!formattedNavigationUrl && formattedNavigationUrl.trim() !== '';
const rscAmount = getRSCAmountFromNotification(notification);
+ const bountyUsdOverride = getBountyForYouUsdOverride(notification);
const hubDetails = getHubDetailsFromNotification(notification);
@@ -83,10 +85,12 @@ export function NotificationItem({ notification }: NotificationItemProps) {
)}
- {rscAmount && (
+ {(rscAmount || bountyUsdOverride !== null) && (
{
+ const bountyCreatorId = notification.extra?.bountyCreatorId;
+
+ return (
+ notification.type === 'BOUNTY_FOR_YOU' &&
+ notification.extra?.bounty_type?.toUpperCase() === 'REVIEW' &&
+ FOUNDATION_USER_ID !== null &&
+ bountyCreatorId !== undefined &&
+ bountyCreatorId.toString() === FOUNDATION_USER_ID.toString()
+ );
+};
+
+export function getBountyForYouUsdOverride(notification: Notification): number | null {
+ if (isFoundationPeerReviewBountyNotification(notification)) {
+ return FOUNDATION_BOUNTY_FLAT_USD;
+ }
+
+ return null;
+}
+
/**
* Transform ResearchHub URLs to relative paths and convert #comments to /conversation
* Examples:
@@ -313,7 +334,11 @@ export function formatNotificationMessage(
const amount = notification.extra?.amount || '0';
const bountyType = notification.extra?.bounty_type || '';
const bountyTypeAction = getBountyTypeAction(bountyType);
- const usdValue = formatUsdValue(amount, exchangeRate);
+ const usdAmount = getBountyForYouUsdOverride(notification);
+ const usdValue =
+ usdAmount !== null
+ ? `$${usdAmount.toLocaleString()} USD`
+ : formatUsdValue(amount, exchangeRate);
return `Your expertise is needed! Earn ${usdValue} for ${bountyTypeAction} "${truncatedTitle}"`;
}
diff --git a/types/notification.ts b/types/notification.ts
index a054efca9..c0808575e 100644
--- a/types/notification.ts
+++ b/types/notification.ts
@@ -14,11 +14,13 @@ export interface NotificationHub {
export interface NotificationExtra {
amount?: string;
bounty_id?: string;
+ bounty_creator_id?: string | number;
bounty_type?: string;
bounty_expiration_date?: string;
hub_details?: string;
user_hub_score?: string;
rewardId?: string;
+ bountyCreatorId?: string | number;
rewardType?: 'REVIEW' | 'CONTRIBUTION' | 'DISCUSSION';
hub?: NotificationHub;
userHubScore?: string;
@@ -76,11 +78,13 @@ const transformNotificationExtraRaw = (raw: any): NotificationExtra | undefined
return {
amount: raw.amount,
bounty_id: raw.bounty_id,
+ bounty_creator_id: raw.bounty_creator_id ?? raw.bountyCreatorId,
bounty_type: raw.bounty_type,
bounty_expiration_date: raw.bounty_expiration_date,
hub,
user_hub_score: raw.user_hub_score,
rewardId: raw.bounty_id,
+ bountyCreatorId: raw.bounty_creator_id ?? raw.bountyCreatorId,
rewardType: raw.bounty_type,
rewardExpirationDate: raw.bounty_expiration_date,
};