import { Download, Gauge, Globe2, Play, RotateCcw, ShieldCheck } from 'lucide-react' import type { ProfileState } from '../state/profiles' import { installPercent, installStageLabels } from '../state/game' import type { GameOperation } from '../state/game' import type { Server } from '../types/launcher' interface PlayDockProps { server: Server operation: GameOperation profile: ProfileState | undefined memoryGb: number native: boolean needsLogin: boolean needsLink: boolean error: string | null label: string primaryDisabled: boolean repairDisabled: boolean onPrimary: () => void onRepair: () => void onLegacy: () => void } export function PlayDock(props: PlayDockProps) { const { server, operation, profile, memoryGb, needsLogin, error } = props const progress = operation.phase === 'installing' ? operation.progress : null const percent = installPercent(progress) const working = operation.phase === 'syncing' || operation.phase === 'installing' || operation.phase === 'launching' let title: string let detail: string if (operation.phase === 'installing') { title = progress ? installStageLabels[progress.stage] : 'Готовим установку' detail = percent === null ? 'Проверяем файлы…' : `${percent}%` } else if (operation.phase === 'launching') { title = 'Запускаем игру'; detail = 'Подготавливаем игровой процесс…' } else if (operation.phase === 'running') { title = 'Игра запущена'; detail = 'Вернитесь после завершения игры' } else if (operation.phase === 'syncing') { title = 'Синхронизируем сборку'; detail = 'Скачиваем и проверяем файлы' } else if (!props.native) { title = 'Предпросмотр интерфейса'; detail = 'Установка и запуск доступны в приложении' } else { title = needsLogin ? 'Нужен вход ShaCraft' : props.needsLink ? 'Нужно привязать ник' : profile?.status === 'checking' ? 'Проверяем сборку' : profile?.inspection?.upToDate ? 'Сборка готова' : 'Требуется проверка' detail = profile?.inspection ? `${profile.inspection.upToDate ? 'Проверено файлов сборки' : 'Файлов в сборке'}: ${profile.inspection.managedFiles}` : 'Проверяем локальные файлы' } return (
{working ? : } {title}{error ?? detail} {percent !== null &&
}
{server.version} {memoryGb} ГБ памяти
) }