/
kochkatech
/
CorpGame
Обзор
Документация
Войти
/
kochkatech
/
CorpGame
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
1
CI/CD
Аналитика
dev
frontend/src/components/TheftOverlay.tsx
38 строк
2 KB
kochkareal
chore: добавлен .gitattributes, нормализованы переносы строк (LF везде, кроме .bat/.cmd)
06 авг 2026, 15:18
06 авг 2026, 15:18
c25ef1b
Код
Авторство
О чём код?
import { useEffect, useState } from 'react'; import { TheftStarted } from '../types'; import { Emoji } from './ui/Emoji'; interface Props { theft: TheftStarted | null; } /** Полноэкранный красный оверлей у вора на время процесса кражи (20 сек) */ export function TheftOverlay({ theft }: Props) { const [now, setNow] = useState(() => Date.now()); useEffect(() => { if (!theft) return; const id = setInterval(() => setNow(Date.now()), 200); return () => clearInterval(id); }, [theft]); if (!theft) return null; const remainingMs = Math.max(0, new Date(theft.expiresAt).getTime() - now); const remainingSec = Math.ceil(remainingMs / 1000); return ( <div className="fixed inset-0 z-[200] flex animate-pulse-theft flex-col items-center justify-center gap-4 px-4 text-center text-white"> <div className="flex items-center gap-2 text-3xl font-black tracking-wide"> <Emoji name="spy" fallback="🕵️" label="Кража" className="h-8 w-8" /> Кража в процессе… </div> <div className="text-lg">Цель: {theft.targetName}</div> <div className="flex h-32 w-32 items-center justify-center rounded-full border-4 border-white/70 font-mono text-6xl font-black shadow-card"> {remainingSec} </div> <div className="max-w-sm text-sm text-white/85"> Не выключайте экран — если вас не поймают за руку, кража удастся </div> </div> ); }