"use client"; import { Badge } from "@kandev/ui/badge"; import { Button } from "@kandev/ui/button"; import type { ImportDiff, SyncDiff } from "@/lib/api/domains/office-api"; import { useTranslation } from "react-i18next"; type SyncDiffPaneProps = { title: string; description: string; icon: React.ReactNode; diff: SyncDiff | null; loading: boolean; applying: boolean; applyLabel: string; onApply: () => void; /** * AC-OFFICE-CONFIG-SYNC-006.6: when config sync owns this workspace, apply * is refused server-side. Passing a reason disables the button and states * why, instead of letting the operator hit the 409. The read-only diff * below keeps rendering either way (AC-OFFICE-CONFIG-SYNC-005.3). */ disabledReason?: string; }; export function SyncDiffPane({ title, description, icon, diff, loading, applying, applyLabel, onApply, disabledReason, }: SyncDiffPaneProps) { const { t } = useTranslation(); const totalChanges = diff ? countChanges(diff) : 0; return (
{description}
{disabledReason &&{disabledReason}
}{t("common:loadingEllipsis")}
; } if (!diff || totalChanges === 0) { return{t("office:noChangesDetected")}
; } return ( <>{label}
{t("office:parseErrors")} {errors.length})
{err.file_path}
- {err.error}