import { createContext, Dispatch, SetStateAction } from 'react' import { AlertOptions } from 'models/shell' import { AudioState, ScreenShareState, VideoState, Peer } from 'models/chat' import { PeerConnectionType } from 'services/PeerRoom/PeerRoom' import { ConnectionTestResults } from 'components/Shell/useConnectionTest' interface ShellContextProps { tabHasFocus: boolean showRoomControls: boolean setShowRoomControls: Dispatch> setTitle: Dispatch> showAlert: (message: string, options?: AlertOptions) => void roomId?: string setRoomId: Dispatch> password?: string setPassword: Dispatch> isPeerListOpen: boolean setIsPeerListOpen: Dispatch> peerList: Peer[] setPeerList: Dispatch> peerConnectionTypes: Record setPeerConnectionTypes: Dispatch< SetStateAction> > audioState: AudioState setAudioState: Dispatch> videoState: VideoState setVideoState: Dispatch> screenState: ScreenShareState setScreenState: Dispatch> peerAudios: Record setPeerAudios: Dispatch>> customUsername: string setCustomUsername: Dispatch> connectionTestResults: ConnectionTestResults } export const ShellContext = createContext({ tabHasFocus: true, showRoomControls: false, setShowRoomControls: () => {}, setTitle: () => {}, showAlert: () => {}, roomId: undefined, setRoomId: () => {}, password: undefined, setPassword: () => {}, isPeerListOpen: false, setIsPeerListOpen: () => {}, peerList: [], setPeerList: () => {}, peerConnectionTypes: {}, setPeerConnectionTypes: () => {}, audioState: AudioState.STOPPED, setAudioState: () => {}, videoState: VideoState.STOPPED, setVideoState: () => {}, screenState: ScreenShareState.NOT_SHARING, setScreenState: () => {}, peerAudios: {}, setPeerAudios: () => {}, customUsername: '', setCustomUsername: () => {}, connectionTestResults: { hasHost: false, hasRelay: false, hasTracker: false }, })