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 type: BadgeTypes
createdTime: number createdTime: number
data: { [key: string]: any } data: { [key: string]: any }
name: string
} }
export type BadgeTypes = 'PROVEN_CORRECT' | 'STREAKER' | 'MARKET_CREATOR' export type BadgeTypes = 'PROVEN_CORRECT' | 'STREAKER' | 'MARKET_CREATOR'
export type ProvenCorrectBadgeData = { export type ProvenCorrectBadgeData = {
name: 'Proven Correct'
type: 'PROVEN_CORRECT' type: 'PROVEN_CORRECT'
data: { data: {
contractSlug: string contractSlug: string
@ -20,6 +22,7 @@ export type ProvenCorrectBadgeData = {
} }
export type MarketCreatorBadgeData = { export type MarketCreatorBadgeData = {
name: 'Market Maker'
type: 'MARKET_CREATOR' type: 'MARKET_CREATOR'
data: { data: {
totalContractsCreated: number totalContractsCreated: number
@ -27,6 +30,7 @@ export type MarketCreatorBadgeData = {
} }
export type StreakerBadgeData = { export type StreakerBadgeData = {
name: 'Streaker'
type: 'STREAKER' type: 'STREAKER'
data: { data: {
totalBettingStreak: number totalBettingStreak: number

View File

@ -4,7 +4,7 @@ export type Notification = {
id: string id: string
userId: string userId: string
reasonText?: string reasonText?: string
reason?: notification_reason_types reason?: notification_reason_types | notification_preference
createdTime: number createdTime: number
viewTime?: number viewTime?: number
isSeen: boolean isSeen: boolean
@ -46,6 +46,7 @@ export type notification_source_types =
| 'loan' | 'loan'
| 'like' | 'like'
| 'tip_and_like' | 'tip_and_like'
| 'badge'
export type notification_source_update_types = export type notification_source_update_types =
| 'created' | 'created'
@ -235,6 +236,10 @@ export const NOTIFICATION_DESCRIPTIONS: notification_descriptions = {
simple: `Only on markets you're invested in`, simple: `Only on markets you're invested in`,
detailed: `Answers on markets that you're watching and that 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 = { export type BettingStreakData = {

View File

@ -53,6 +53,7 @@ export type notification_preferences = {
profit_loss_updates: notification_destination_types[] profit_loss_updates: notification_destination_types[]
onboarding_flow: notification_destination_types[] onboarding_flow: notification_destination_types[]
thank_you_for_purchases: notification_destination_types[] thank_you_for_purchases: notification_destination_types[]
badges_awarded: notification_destination_types[]
} }
export const getDefaultNotificationPreferences = ( export const getDefaultNotificationPreferences = (

View File

@ -98,7 +98,8 @@ export type PortfolioMetrics = {
userId: string 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 MANIFOLD_AVATAR_URL = 'https://manifold.markets/logo-bg-white.png'
export const BETTOR = ENV_CONFIG.bettor ?? 'bettor' // aka predictor 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 { db } from 'web/lib/firebase/init'
import { import {
MANIFOLD_AVATAR_URL, MANIFOLD_AVATAR_URL,
MANIFOLD_USERNAME, MANIFOLD_USER_USERNAME,
PrivateUser, PrivateUser,
} from 'common/user' } from 'common/user'
import clsx from 'clsx' import clsx from 'clsx'
@ -857,7 +857,9 @@ function NotificationFrame(props: {
size={'sm'} size={'sm'}
className={'z-10 mr-2'} className={'z-10 mr-2'}
username={ username={
questionNeedsResolution ? MANIFOLD_USERNAME : sourceUserUsername questionNeedsResolution
? MANIFOLD_USER_USERNAME
: sourceUserUsername
} }
/> />
<div className={'flex w-full flex-row pl-1 sm:pl-0'}> <div className={'flex w-full flex-row pl-1 sm:pl-0'}>