Add name, refactor

This commit is contained in:
Ian Philips 2022-10-06 11:03:44 -04:00
parent bc8a3a8e3c
commit d999865122
5 changed files with 17 additions and 4 deletions

View File

@ -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

View File

@ -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 = {

View File

@ -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 = (

View File

@ -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

View File

@ -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
}
/>
<div className={'flex w-full flex-row pl-1 sm:pl-0'}>