import { useEffect, useRef } from 'react'; import { useGlobalSettings } from '../../../../Hooks/useGlobalSettings'; import { Player, Rotation } from '../../../../Types/Player'; import { Paragraph } from '../../../Misc/TextComponents'; import { DynamicText } from '../../StartingPlayerCard'; export const RoulettePlayerCard = ({ player }: { player: Player }) => { const startPlayingTimerRef = useRef(undefined); const { settings, randomizingPlayer, playing, setPlaying } = useGlobalSettings(); useEffect(() => { if ( player.isStartingPlayer && ((!playing && randomizingPlayer) || !playing) ) { startPlayingTimerRef.current = setTimeout(() => { setPlaying(true); }, 10_000); } return () => clearTimeout(startPlayingTimerRef.current); }, [ player.isStartingPlayer, playing, setPlaying, settings.preStartMode, randomizingPlayer, ]); const calcTextRotation = player.settings.rotation === Rotation.SideFlipped || player.settings.rotation === Rotation.Side ? player.settings.rotation - 180 : player.settings.rotation; return (
{player.isStartingPlayer && (
👑
)}
); };