chitchatter/src/contexts/ShellContext.ts

31 lines
893 B
TypeScript
Raw Normal View History

2022-08-28 21:25:49 -05:00
import { createContext, Dispatch, SetStateAction } from 'react'
import { AlertOptions } from 'models/shell'
import { Peer } from 'models/chat'
2022-08-28 21:25:49 -05:00
interface ShellContextProps {
2022-08-29 22:05:56 -05:00
numberOfPeers: number
tabHasFocus: boolean
2022-09-01 21:28:45 -05:00
setDoShowPeers: Dispatch<SetStateAction<boolean>>
setNumberOfPeers: Dispatch<SetStateAction<number>>
setTitle: Dispatch<SetStateAction<string>>
showAlert: (message: string, options?: AlertOptions) => void
isPeerListOpen: boolean
setIsPeerListOpen: Dispatch<SetStateAction<boolean>>
peerList: Peer[]
setPeerList: Dispatch<SetStateAction<Peer[]>>
2022-08-28 21:25:49 -05:00
}
export const ShellContext = createContext<ShellContextProps>({
2022-08-29 22:05:56 -05:00
numberOfPeers: 1,
tabHasFocus: true,
2022-09-01 21:28:45 -05:00
setDoShowPeers: () => {},
setNumberOfPeers: () => {},
setTitle: () => {},
showAlert: () => {},
isPeerListOpen: false,
setIsPeerListOpen: () => {},
peerList: [],
setPeerList: () => {},
2022-08-28 21:25:49 -05:00
})