diff --git a/common/badge.ts b/common/badge.ts index d90a9119..b4c6b975 100644 --- a/common/badge.ts +++ b/common/badge.ts @@ -4,11 +4,13 @@ export type Badge = { type: BadgeTypes createdTime: number data: { [key: string]: any } + name: string } export type BadgeTypes = 'PROVEN_CORRECT' | 'STREAKER' | 'MARKET_CREATOR' export type ProvenCorrectBadgeData = { + name: 'Proven Correct' type: 'PROVEN_CORRECT' data: { contractSlug: string @@ -20,6 +22,7 @@ export type ProvenCorrectBadgeData = { } export type MarketCreatorBadgeData = { + name: 'Market Maker' type: 'MARKET_CREATOR' data: { totalContractsCreated: number @@ -27,6 +30,7 @@ export type MarketCreatorBadgeData = { } export type StreakerBadgeData = { + name: 'Streaker' type: 'STREAKER' data: { totalBettingStreak: number diff --git a/common/notification.ts b/common/notification.ts index b42df541..802d44fa 100644 --- a/common/notification.ts +++ b/common/notification.ts @@ -4,7 +4,7 @@ export type Notification = { id: string userId: string reasonText?: string - reason?: notification_reason_types + reason?: notification_reason_types | notification_preference createdTime: number viewTime?: number isSeen: boolean @@ -46,6 +46,7 @@ export type notification_source_types = | 'loan' | 'like' | 'tip_and_like' + | 'badge' export type notification_source_update_types = | 'created' @@ -235,6 +236,10 @@ export const NOTIFICATION_DESCRIPTIONS: notification_descriptions = { simple: `Only on markets you're invested in`, detailed: `Answers on markets that you're watching and that you're invested in`, }, + badges_awarded: { + simple: 'New badges awarded', + detailed: 'New badges you have earned', + }, } export type BettingStreakData = { diff --git a/common/user-notification-preferences.ts b/common/user-notification-preferences.ts index 3fc0fb2f..abc4ecde 100644 --- a/common/user-notification-preferences.ts +++ b/common/user-notification-preferences.ts @@ -53,6 +53,7 @@ export type notification_preferences = { profit_loss_updates: notification_destination_types[] onboarding_flow: notification_destination_types[] thank_you_for_purchases: notification_destination_types[] + badges_awarded: notification_destination_types[] } export const getDefaultNotificationPreferences = ( diff --git a/common/user.ts b/common/user.ts index 9b37161d..9e1f254c 100644 --- a/common/user.ts +++ b/common/user.ts @@ -98,7 +98,8 @@ export type PortfolioMetrics = { userId: string } -export const MANIFOLD_USERNAME = 'ManifoldMarkets' +export const MANIFOLD_USER_USERNAME = 'ManifoldMarkets' +export const MANIFOLD_USER_NAME = 'ManifoldMarkets' export const MANIFOLD_AVATAR_URL = 'https://manifold.markets/logo-bg-white.png' export const BETTOR = ENV_CONFIG.bettor ?? 'bettor' // aka predictor diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index 2f5c0bf9..a6bbf086 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -15,7 +15,7 @@ import { doc, updateDoc } from 'firebase/firestore' import { db } from 'web/lib/firebase/init' import { MANIFOLD_AVATAR_URL, - MANIFOLD_USERNAME, + MANIFOLD_USER_USERNAME, PrivateUser, } from 'common/user' import clsx from 'clsx' @@ -857,7 +857,9 @@ function NotificationFrame(props: { size={'sm'} className={'z-10 mr-2'} username={ - questionNeedsResolution ? MANIFOLD_USERNAME : sourceUserUsername + questionNeedsResolution + ? MANIFOLD_USER_USERNAME + : sourceUserUsername } />