From 3f2a6b5d53c7d1c5a2b7e956259121480fb83496 Mon Sep 17 00:00:00 2001 From: "Zimin A.N." Date: Wed, 6 May 2026 12:50:44 +0300 Subject: [PATCH] feat(admin-ui): scope accent on dictionary detail page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Перенесли scope-визуальные константы (SCOPE_ORDER, SCOPE_DOT, SCOPE_ACCENT) в `lib/scope-style.ts` для переиспользования. На detail странице (`dictionaries/$name`) добавили top accent strip 4px цветом scope + цветной чип в breadcrumb рядом с back-link. Теперь при переходе из списка в карточку scope сразу виден без чтения badge в таблице. --- ordinis-admin-ui/src/lib/scope-style.ts | 42 +++++++++++++++++++ .../src/routes/dictionaries.$name.tsx | 26 ++++++++++-- .../src/routes/dictionaries.index.tsx | 15 +------ 3 files changed, 66 insertions(+), 17 deletions(-) create mode 100644 ordinis-admin-ui/src/lib/scope-style.ts diff --git a/ordinis-admin-ui/src/lib/scope-style.ts b/ordinis-admin-ui/src/lib/scope-style.ts new file mode 100644 index 0000000..b412fe4 --- /dev/null +++ b/ordinis-admin-ui/src/lib/scope-style.ts @@ -0,0 +1,42 @@ +import type { DataScope } from '@/api/client' + +/** + * Visual ordering: PUBLIC → INTERNAL → RESTRICTED. + * Reads as escalating sensitivity, matches semaphore mental model. + */ +export const SCOPE_ORDER: ReadonlyArray = [ + 'PUBLIC', + 'INTERNAL', + 'RESTRICTED', +] + +/** + * Solid background classes for ●-shaped scope indicators (size-2 dots, + * section-header bullets). + */ +export const SCOPE_DOT: Record = { + PUBLIC: 'bg-emerald-500', + INTERNAL: 'bg-amber-500', + RESTRICTED: 'bg-rose-500', +} + +/** + * `before:` background classes used for the 4px left-accent stripe on + * dictionary cards. Pair with `relative` + `before:absolute before:left-0 + * before:top-0 before:bottom-0 before:w-1 before:rounded-l-lg`. + */ +export const SCOPE_ACCENT: Record = { + PUBLIC: 'before:bg-emerald-500', + INTERNAL: 'before:bg-amber-500', + RESTRICTED: 'before:bg-rose-500', +} + +/** + * Solid border-top classes for page-level scope banner stripes (used on + * dictionary detail page). + */ +export const SCOPE_BORDER_TOP: Record = { + PUBLIC: 'border-t-emerald-500', + INTERNAL: 'border-t-amber-500', + RESTRICTED: 'border-t-rose-500', +} diff --git a/ordinis-admin-ui/src/routes/dictionaries.$name.tsx b/ordinis-admin-ui/src/routes/dictionaries.$name.tsx index 6c5abdb..8f41ed2 100644 --- a/ordinis-admin-ui/src/routes/dictionaries.$name.tsx +++ b/ordinis-admin-ui/src/routes/dictionaries.$name.tsx @@ -28,6 +28,7 @@ import { SchemaDrivenForm } from '@/components/form/SchemaDrivenForm' import { DictionaryEditorDialog } from '@/components/schema/DictionaryEditorDialog' import { RecordHistoryDrawer } from '@/components/record/RecordHistoryDrawer' import { nowIsoLocal } from '@/lib/dates' +import { SCOPE_BORDER_TOP, SCOPE_DOT } from '@/lib/scope-style' export const Route = createFileRoute('/dictionaries/$name')({ component: DictionaryDetail, @@ -87,14 +88,33 @@ function DictionaryDetail() { const serverError = serverErrorMessage(activeMutation?.error) const totalRecords = recordsResult.data?.length ?? 0 + const scope = detailQuery.data?.scope return (
+ {scope && ( +