mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-05 20:11:13 +08:00
* feat: add beginner onboarding and mode switching flow * chore: ignore local gh auth config * fix: restore kline fallback and align onboarding language --------- Co-authored-by: zavier-bin <zhaobbbhhh@gmail.com>
29 lines
821 B
TypeScript
29 lines
821 B
TypeScript
export type UserMode = 'beginner' | 'advanced'
|
|
|
|
const USER_MODE_KEY = 'nofx_user_mode'
|
|
const BEGINNER_WALLET_ADDRESS_KEY = 'nofx_beginner_wallet_address'
|
|
|
|
export function getUserMode(): UserMode | null {
|
|
const value = localStorage.getItem(USER_MODE_KEY)
|
|
if (value === 'beginner' || value === 'advanced') {
|
|
return value
|
|
}
|
|
return null
|
|
}
|
|
|
|
export function setUserMode(mode: UserMode) {
|
|
localStorage.setItem(USER_MODE_KEY, mode)
|
|
}
|
|
|
|
export function getPostAuthPath(mode: UserMode | null | undefined): string {
|
|
return mode === 'beginner' ? '/welcome' : '/traders'
|
|
}
|
|
|
|
export function setBeginnerWalletAddress(address: string) {
|
|
localStorage.setItem(BEGINNER_WALLET_ADDRESS_KEY, address)
|
|
}
|
|
|
|
export function getBeginnerWalletAddress(): string | null {
|
|
return localStorage.getItem(BEGINNER_WALLET_ADDRESS_KEY)
|
|
}
|