remnantchat/src/contexts/SettingsContext.ts
Jeremy Kahn dfe510e642
feat: [closes #76] Custom usernames (#93)
* feat: add Username component
* feat: set custom username state
* feat: update custom username on input blur
* feat: inform peers of username updates
* feat: display username for peers
* feat: show static name in parentheses
* feat: use display name in message notification
* feat: remove username display from Shell Drawer
* feat: persist customUsername
2023-03-04 12:55:37 -06:00

20 lines
530 B
TypeScript

import { createContext } from 'react'
import { UserSettings } from 'models/settings'
export interface SettingsContextProps {
updateUserSettings: (settings: Partial<UserSettings>) => Promise<void>
getUserSettings: () => UserSettings
}
export const SettingsContext = createContext<SettingsContextProps>({
updateUserSettings: () => Promise.resolve(),
getUserSettings: () => ({
userId: '',
customUsername: '',
colorMode: 'dark',
playSoundOnNewMessage: true,
showNotificationOnNewMessage: true,
}),
})