feat(web): readable, grouped object detail (labels, placeholders, actions toolbar) (#45)

Refactor object-detail.tsx to resolve term/authority ids to labels via
FlexibleFieldValue, group flexible fields by def.group in definition order
(ungrouped → trailing "Other"), always show core fields with "—" placeholders,
and move Edit (button-styled Link) + Delete into a right-aligned toolbar.

Move formatDate into lib/format-date.ts so the component module no longer
co-exports a non-component (clears the react-refresh/only-export-components
warning); both flexible-field-value.tsx and object-detail.tsx import it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 11:38:41 +02:00
parent 2e38af565a
commit 03d5b59b48
6 changed files with 148 additions and 65 deletions
+8
View File
@@ -0,0 +1,8 @@
/** Formats a date-only ISO string (YYYY-MM-DD) for display in the active locale.
* Parses as local midnight so a date-only value isn't shifted a day by tz. */
export function formatDate(value: unknown, lang: string): string {
if (typeof value !== "string") return value == null ? "—" : String(value);
const date = new Date(`${value}T00:00:00`);
if (Number.isNaN(date.getTime())) return value;
return new Intl.DateTimeFormat(lang, { dateStyle: "medium" }).format(date);
}