polish(web): fields form resets error, shared labelText, drop dead nav.soon, a11y required marker, Other group last

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 14:29:25 +02:00
parent 37c80121ed
commit fd1c22191b
4 changed files with 19 additions and 13 deletions
+1
View File
@@ -36,6 +36,7 @@ export function FieldForm() {
setAuthorityKind("");
setGroup("");
setRequired(false);
setError(false);
};
const onSubmit = (event: FormEvent) => {
+16 -11
View File
@@ -2,19 +2,11 @@ import { useTranslation } from "react-i18next";
import type { components } from "../api/schema";
import { useFieldDefinitions } from "../api/queries";
import { labelText } from "../lib/labels";
import { Skeleton } from "@/components/ui/skeleton";
type FieldDefinitionView = components["schemas"]["FieldDefinitionView"];
function labelText(labels: FieldDefinitionView["labels"], lang: string): string {
return (
labels.find((l) => l.lang === lang)?.label ??
labels.find((l) => l.lang === "en")?.label ??
labels[0]?.label ??
""
);
}
export function FieldList() {
const { t, i18n } = useTranslation();
const { data, isLoading, isError } = useFieldDefinitions();
@@ -44,9 +36,14 @@ export function FieldList() {
groups.set(key, bucket);
}
const otherLabel = t("fields.other");
const entries = [...groups.entries()].sort((a, b) =>
a[0] === otherLabel ? 1 : b[0] === otherLabel ? -1 : 0,
);
return (
<ul className="overflow-auto">
{[...groups.entries()].map(([group, defs]) => (
{entries.map(([group, defs]) => (
<li key={group}>
<div className="border-b bg-neutral-50 px-3 py-1 text-xs font-medium uppercase tracking-wide text-neutral-500">
{group}
@@ -59,7 +56,15 @@ export function FieldList() {
<span className="rounded bg-neutral-100 px-1.5 py-0.5 text-xs text-neutral-600">
{t(`fields.types.${def.data_type}`)}
</span>
{def.required && <span className="text-xs text-red-600">*</span>}
{def.required && (
<span
className="text-xs text-red-600"
title={t("fields.required")}
aria-label={t("fields.required")}
>
*
</span>
)}
</li>
))}
</ul>