Adopt shared WebUI structural primitives

This commit is contained in:
2026-08-18 13:17:31 +02:00
parent cb824749a4
commit e494cff561
3 changed files with 20 additions and 106 deletions
+15 -16
View File
@@ -6,11 +6,16 @@ import { ActionToolbar,
DismissibleAlert,
LoadingIndicator,
PageScrollViewport,
SelectionList,
SelectionListItem,
SelectionListItemContent,
StatePanel,
StatusBadge,
hasScope,
i18nMessage,
useGuardedNavigate,
usePlatformLanguage,
WorkspaceFrame,
type PlatformRouteContext
} from "@govoplan/core-webui";
import { listFormInstances, type FormInstance } from "../../api/formsRuntime";
@@ -57,8 +62,8 @@ export default function FormsRuntimePage({ settings, auth }: PlatformRouteContex
return (
<main className="forms-runtime-page">
<div className="forms-runtime-shell">
<ActionToolbar className="forms-runtime-toolbar">
<WorkspaceFrame className="forms-runtime-shell" label="Forms runtime" interfaceId="forms-runtime.workspace" helpContextId="forms-runtime.page.workspace" helpModuleId="forms-runtime">
<ActionToolbar surface="panel-header" className="forms-runtime-toolbar">
<Button onClick={() => void load()} disabled={loading} disabledReason={loading ? FORMS_RUNTIME_I18N.loading : undefined}>
<RefreshCw size={16} aria-hidden="true" />
Refresh
@@ -94,29 +99,23 @@ export default function FormsRuntimePage({ settings, auth }: PlatformRouteContex
}
{loading && <LoadingIndicator label="Loading forms" />}
{!loading && !error && items.length === 0 &&
<div className="forms-runtime-empty">No matching Forms.</div>
<StatePanel size="compact" description="No matching Forms." />
}
{!loading && items.length > 0 &&
<div className="forms-runtime-list" role="list">
<SelectionList variant="navigation" label="Forms">
{items.map((item) =>
<button
type="button"
role="listitem"
className="forms-runtime-row"
<SelectionListItem
key={item.instance_id}
selected={false}
onClick={() => navigate(`/forms-runtime/${encodeURIComponent(item.instance_id)}`)}>
<span className="forms-runtime-row-main">
<strong>{item.definition_ref.label ?? humanize(item.definition_ref.object_id)}</strong>
<span>Revision {item.definition_ref.version ?? "-"}</span>
</span>
<span>{formatDateTime(item.recorded_at, language)}</span>
<SelectionListItemContent title={item.definition_ref.label ?? humanize(item.definition_ref.object_id)} description={`Revision ${item.definition_ref.version ?? "-"} · ${formatDateTime(item.recorded_at, language)}`} />
<StatusBadge status={isOpen(item.status) ? "active" : "inactive"} label={stateLabel(item.status)} />
</button>
</SelectionListItem>
)}
</div>
</SelectionList>
}
</PageScrollViewport>
</div>
</WorkspaceFrame>
<IntakeProfilesDialog open={intakeOpen} settings={settings} onClose={() => setIntakeOpen(false)} />
</main>
);