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:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user