'use client' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { Progress } from '@/components/ui/progress' import type { DownloadProgress } from '@/lib/api/schemas' import { useDownloadsStore } from '@/lib/stores/downloadsStore' const summarize = (downloads: Record) => { const values = Object.values(downloads) if (values.length === 0) return null let total = 0 let downloaded = 0 let active: string | null = null for (const d of values) { total += d.total ?? 0 downloaded += d.downloaded const s = d.status.status if (s === 'started' || s === 'downloading') active = d.filename } return { filename: active, percent: total > 0 ? Math.min(100, Math.round((downloaded / total) * 100)) : undefined, } } export function AppInitializationSkeleton() { const { t } = useTranslation() const downloads = useDownloadsStore((s) => s.downloads) const progress = useMemo(() => summarize(downloads), [downloads]) return (
Koharu

Koharu

{t('common.initializing')}

{progress?.filename ?? '\u00A0'}

) }