chitchatter/src/contexts/ShellContext.ts
Flaykz 492cfa58ce
feat: [#7] Play a sound on new message (#25)
* feat: [#7] Play a sound on new message

* fix: [#7] Since this mock is a no-op, I think we can omit the argument to mockImplementation

Co-authored-by: Jeremy Kahn <jeremyckahn@gmail.com>

* fix: [#7] lazy initialization of this state

Co-authored-by: Jeremy Kahn <jeremyckahn@gmail.com>

* fix: [#7] More accurate error message

Co-authored-by: Jeremy Kahn <jeremyckahn@gmail.com>

* fix: [#7] Replace then with await

* [closes #24]  Settings UI (#26)

* feat: [#24] wire up settings page
* feat: [#24] stand up settings UI
* feat: [#24] implement storage deletion
* feat: [#24] confirm deletion of settings data

* feat: [#7] Add play sound switch in settings

* feat: [#7] avoid typescript warning

Co-authored-by: Jeremy Kahn <jeremyckahn@gmail.com>

* feat: [#7] more straighforward wording

Co-authored-by: Jeremy Kahn <jeremyckahn@gmail.com>

* feat: [#7] remove useless usestate

* feat: [#7] avoid new settings to be undefined in persisted storage

* feat: [#7] creating a chat section in settings

Co-authored-by: Jeremy Kahn <jeremyckahn@gmail.com>
2022-09-26 08:10:31 -05:00

22 lines
613 B
TypeScript

import { createContext, Dispatch, SetStateAction } from 'react'
import { AlertOptions } from 'models/shell'
interface ShellContextProps {
numberOfPeers: number
tabHasFocus: boolean
setDoShowPeers: Dispatch<SetStateAction<boolean>>
setNumberOfPeers: Dispatch<SetStateAction<number>>
setTitle: Dispatch<SetStateAction<string>>
showAlert: (message: string, options?: AlertOptions) => void
}
export const ShellContext = createContext<ShellContextProps>({
numberOfPeers: 1,
tabHasFocus: true,
setDoShowPeers: () => {},
setNumberOfPeers: () => {},
setTitle: () => {},
showAlert: () => {},
})