"use client"; import { Badge, Group, Paper, Stack, Table, Text, ThemeIcon, Title } from "@mantine/core"; import { IconCheck, IconDatabase, IconGitBranch } from "@tabler/icons-react"; import { useScopedI18n } from "@homarr/translation/client"; import type { BackupAnalysis } from "./types"; import { PREVIEW_TABLE_KEYS } from "./types"; interface BackupPreviewPanelProps { analysis: BackupAnalysis; } export const BackupPreviewPanel = ({ analysis }: BackupPreviewPanelProps) => { const t = useScopedI18n("management.page.tool.backup.restore.preview"); const exportDate = new Date(analysis.metadata.exportedAt).toLocaleString(); const pendingCount = analysis.migrations.pending.length; const hasPendingMigrations = pendingCount > 0; return (
{t("title")} {t("exported", { date: exportDate })}
Homarr {analysis.metadata.homarrVersion}
{t("entity")} {t("count")} {PREVIEW_TABLE_KEYS.map((key) => ( {t(`entities.${key}` as never)} {(analysis.counts[key] ?? 0) > 0 && } {analysis.counts[key] ?? 0} ))}
{analysis.boardNames.length > 0 && ( {t("boards")}: {analysis.boardNames.map((name) => ( {name} ))} )}
{hasPendingMigrations && (
{pendingCount === 1 ? t("migrationsApplied", { count: String(pendingCount) }) : t("migrationsAppliedPlural", { count: String(pendingCount) })} {pendingCount === 1 ? t("migrationsOlderVersion", { count: String(pendingCount) }) : t("migrationsOlderVersionPlural", { count: String(pendingCount) })}
{t("migrationsPending", { count: String(pendingCount) })}
)} {!hasPendingMigrations && ( {t("migrationsUpToDate", { count: String(analysis.migrations.total) })} )}
); };