manifold/common/user.ts

95 lines
2.2 KiB
TypeScript
Raw Normal View History

import { notification_preferences } from './user-notification-preferences'
2022-09-15 15:12:56 +00:00
import { ENV_CONFIG } from 'common/envs/constants'
export type User = {
2022-01-10 23:52:03 +00:00
id: string
createdTime: number
2022-01-10 23:52:03 +00:00
name: string
username: string
avatarUrl?: string
// For their user page
bio?: string
bannerUrl?: string
website?: string
twitterHandle?: string
discordHandle?: string
2022-01-10 23:52:03 +00:00
balance: number
totalDeposits: number
profitCached: {
daily: number
weekly: number
monthly: number
allTime: number
}
creatorVolumeCached: {
daily: number
weekly: number
monthly: number
allTime: number
}
fractionResolvedCorrectly: number
nextLoanCached: number
followerCountCached: number
followedCategories?: string[]
homeSections?: string[]
referredByUserId?: string
referredByContractId?: string
2022-07-18 16:40:44 +00:00
referredByGroupId?: string
2022-07-15 14:45:52 +00:00
lastPingTime?: number
shouldShowWelcome?: boolean
lastBetTime?: number
currentBettingStreak?: number
hasSeenContractFollowModal?: boolean
2022-08-25 11:51:56 +00:00
freeMarketsCreated?: number
2022-08-28 05:23:25 +00:00
isBannedFromPosting?: boolean
2022-01-10 23:52:03 +00:00
}
export type PrivateUser = {
id: string // same as User.id
username: string // denormalized from User
email?: string
weeklyTrendingEmailSent?: boolean
weeklyPortfolioUpdateEmailSent?: boolean
manaBonusEmailSent?: boolean
initialDeviceToken?: string
initialIpAddress?: string
apiKey?: string
notificationPreferences: notification_preferences
twitchInfo?: {
twitchName: string
controlToken: string
botEnabled?: boolean
needsRelinking?: boolean
}
}
export type PortfolioMetrics = {
investmentValue: number
balance: number
totalDeposits: number
timestamp: number
userId: string
}
2022-07-15 17:53:30 +00:00
export const MANIFOLD_USERNAME = 'ManifoldMarkets'
export const MANIFOLD_AVATAR_URL = 'https://manifold.markets/logo-bg-white.png'
2022-09-15 15:12:56 +00:00
2022-09-18 00:10:34 +00:00
// TODO: remove. Hardcoding the strings would be better.
// Different views require different language.
2022-09-19 19:03:45 +00:00
export const BETTOR = ENV_CONFIG.bettor ?? 'trader'
export const BETTORS = ENV_CONFIG.bettor + 's' ?? 'traders'
export const PRESENT_BET = ENV_CONFIG.presentBet ?? 'trade'
export const PRESENT_BETS = ENV_CONFIG.presentBet + 's' ?? 'trades'
export const PAST_BET = ENV_CONFIG.pastBet ?? 'trade'
export const PAST_BETS = ENV_CONFIG.pastBet + 's' ?? 'trades'