chitchatter/src/contexts/ShellContext.ts

51 lines
1.6 KiB
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 { AudioState, ScreenShareState, VideoState, 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
roomId?: string
setRoomId: Dispatch<SetStateAction<string | undefined>>
password?: string
setPassword: Dispatch<SetStateAction<string | undefined>>
isPeerListOpen: boolean
setIsPeerListOpen: Dispatch<SetStateAction<boolean>>
peerList: Peer[]
setPeerList: Dispatch<SetStateAction<Peer[]>>
audioState: AudioState
setAudioState: Dispatch<SetStateAction<AudioState>>
videoState: VideoState
setVideoState: Dispatch<SetStateAction<VideoState>>
screenState: ScreenShareState
setScreenState: Dispatch<SetStateAction<ScreenShareState>>
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: () => {},
roomId: undefined,
setRoomId: () => {},
password: undefined,
setPassword: () => {},
isPeerListOpen: false,
setIsPeerListOpen: () => {},
peerList: [],
setPeerList: () => {},
audioState: AudioState.STOPPED,
setAudioState: () => {},
videoState: VideoState.STOPPED,
setVideoState: () => {},
screenState: ScreenShareState.NOT_SHARING,
setScreenState: () => {},
2022-08-28 21:25:49 -05:00
})