import { FormDialog } from "@repo/shadcn-ui/components/form-dialog"; import { useTranslation } from "react-i18next"; import type { CatalogItemDTO } from "../common"; import { CatalogHelp } from "./catalog-help"; export function CatalogDefinitionDialog({ item, items, onClose, }: { item?: CatalogItemDTO | undefined; items: readonly CatalogItemDTO[]; onClose: () => void; }) { const { t } = useTranslation("resources"); if (!item) { return null; } const values = item.values; return ( { if (!open) { onClose(); } }} open title={t("viewDefinition", { name: values.name })} wide={values.kind === "template"} >
{values.description && (

{values.description}

)} {values.kind === "field" ? (
{t("type")}
{t(values.type)}
{values.unit && (
{t("unit")}
{values.unit}
)} {values.choices.length > 0 && (
{t("choices")}
{values.choices.join("\n")}
)}
) : ( )} {item.builtin &&

{t("protected")}

}
); }