import * as React from 'react' ; import { OptionalTeam , unknownTeam } from './misc' ; import { createSimpleContext } from './providers' ; import { useRootData } from './use-root-data' ; const { Provider : TeamProviderBase , useValue : useTeam } = createSimpleContext < [ OptionalTeam , React . Dispatch < React . SetStateAction < OptionalTeam > > ] > ( 'Team' ) ; export { useTeam } ; export function TeamProvider ( { children , } ) { const { user } = useRootData ( ) ; const [ team , setTeam ] = React . useState < OptionalTeam > ( unknownTeam . UNKNOWN ) ; React . useEffect ( ( ) => { if ( ! user ) setTeam ( unknownTeam . UNKNOWN ) ; } , [ user ] ) ; return ( < TeamProviderBase value = { [ user ?. team ?? team , setTeam ] } > { children } < /TeamProviderBase>); } export const teamEmoji = { RED : '🔴' , BLUE : '🔵' , YELLOW : '🟡' , UNKNOWN : '⚪' , } ;