"use client"; import { useTranslations } from "next-intl"; import { Button } from "@/components/ui/button"; import { compareFurniture, type FurnitureInspection, furnitureHealth, } from "@/lib/furni/studio-inspection"; import { FurnitureCompleteness } from "./furniture-completeness"; import type { FurniItem } from "./studio-types"; import { useFurnitureInspection } from "./use-furniture-inspection"; const HEALTH_KEYS = { complete: "healthComplete", incomplete: "healthIncomplete", new: "healthNew", conflict: "healthConflict", unknown: "healthUnknown", } as const; const FIELD_KEYS = { Name: "fieldName", Description: "fieldDescription", Revision: "fieldRevision", Type: "fieldType", } as const; export function FurnitureComparison({ item, local, }: { item: FurniItem; local: FurnitureInspection; }) { const t = useTranslations("admin.studio.inspector"); const comparison = compareFurniture(item, local); return (
{t("furnidataUnreadable")}
)}| {t("field")} | {t("localNow")} | {t("source")} |
|---|---|---|
| {labelKey ? t(labelKey) : field.label} {field.changed ? ` · ${t("changed")}` : ""} | {field.before ?? "—"} | {field.after ?? t("notSupplied")} |
{t("compareNote")}
{t("itemRow", { id: row.id, sprite: row.spriteId, name: row.name, })}
)) ) : ({t("noSqlItem")}
)} {local.catalog.map((row) => ({t("offerRow", { id: row.id, page: row.pageId, credits: row.credits, points: row.points, })}
))}{t("checking")}
); if (inspection.error) return ({inspection.error}
{t("missing", { parts: health.missing.join(", ") })}
)} {health.state === "conflict" && ({t("conflictNote")}
)} {health.state === "unknown" && ({t("unknownNote")}
)} {health.state === "incomplete" && onRepair && ( <>{t("repairNote")}
> )}{t("unavailable")}
); }