From 38241839e4bb9dfbfdfc08f76015dece193ad16c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 20:29:33 +0000 Subject: [PATCH 1/3] fix(ui): apply design audit recommendations 1-4 - Mode chips wrap on phones instead of clipping behind the fade. - Plain-language NOT_CONFIGURED message; analysis error shows its recovery actions as separate buttons. - 2px focus ring on composer, feedback field, links and selects. - 44px touch targets in the phone sidebar; one --submenu-row variable keeps encounter rows and the active-branch line aligned. - Home "/" picker opens below the composer on wide screens. - Phone dialog actions stack full width in DOM order. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012ta9C8FRC79LLB1FAxo819 --- docs/sentrapedia-ui.md | 13 +++ src/app/globals.css | 37 ++++++++- src/components/composer.tsx | 2 +- src/components/sidebar-submenu.tsx | 2 +- src/lib/aadi/gateway.ts | 2 +- tests/aadi-guardrails.test.ts | 12 +++ tests/ui/design-audit-fixes.test.tsx | 116 +++++++++++++++++++++++++++ 7 files changed, 179 insertions(+), 5 deletions(-) create mode 100644 tests/ui/design-audit-fixes.test.tsx diff --git a/docs/sentrapedia-ui.md b/docs/sentrapedia-ui.md index 3d9668b..510209c 100644 --- a/docs/sentrapedia-ui.md +++ b/docs/sentrapedia-ui.md @@ -174,3 +174,16 @@ Lanjutan audit (#5, #6, #9-#12), status REVIEW: - Catatan usang "Hubungkan AI Clinical" pada jawaban pertanyaan dihapus. Verifikasi: vitest 849 lulus, 23 dilewati (data privat); lint dan typecheck bersih; tinggi toolbar diukur di browser pada 1440, 1210, 1024 (satu baris) dan 390 px (dua baris, sesuai desain HP). + +## Design audit fixes (2026-11-27) + +From the 2026-11-26 design audit (recommendations 1-4; token migration waits for the brand decision). All in `src/app/globals.css` unless named. + +- Mode chips wrap at 760px and below, so every chip is visible on a phone; wider screens keep the scrolling row with its fade. +- An unconfigured analysis service reads "Layanan analisis belum tersambung. Pertanyaan Anda tetap tersimpan; …" (`src/lib/aadi/gateway.ts`), and the composer shows the message and its recovery actions ("Coba lagi", "Susun draf SOAP lokal") as separate elements, the actions as buttons (`src/components/composer.tsx`). +- The composer and feedback fields, links and selects carry the 2px `--workspace-focus` ring. +- At 760px and below sidebar rows, encounter rows, icon buttons and the feedback field reach `--target-min` (44px). `--submenu-row` sets the encounter row height, its tree line and the active-branch indicator together (`src/components/sidebar-submenu.tsx`). +- Above 760px the home composer's `/` picker opens below it; on a phone and in chat it opens upward. +- At 600px and below dialog actions stack full width in DOM order, so focus order matches what is seen. + +Tests: `tests/ui/design-audit-fixes.test.tsx`, plus the NOT_CONFIGURED wording in `tests/aadi-guardrails.test.ts`. Browser check at 390/768/1440 px with Playwright and axe-core (0 violations on the audited screens). diff --git a/src/app/globals.css b/src/app/globals.css index 06fbae1..df8fef6 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -435,10 +435,10 @@ label.button:has(input:focus-visible) { outline: 2px solid var(--workspace-focus .submenu-section[data-open="true"] .submenu-body { grid-template-rows: 1fr; opacity: 1; } .submenu-clip { min-height: 0; overflow: hidden; } .submenu-items { position: relative; padding: 0 0 6px 14px; } -.submenu-item { height: 34px; display: flex; align-items: center; position: relative; gap: 2px; opacity: 0; transform: translateY(-4px); transition: opacity 280ms ease-out, transform 280ms cubic-bezier(.23, 1, .32, 1); } +.submenu-item { height: var(--submenu-row); display: flex; align-items: center; position: relative; gap: 2px; opacity: 0; transform: translateY(-4px); transition: opacity 280ms ease-out, transform 280ms cubic-bezier(.23, 1, .32, 1); } .submenu-section[data-open="true"] .submenu-item { opacity: 1; transform: translateY(0); transition-delay: calc(40ms + min(var(--item-order), 8) * 35ms); } .submenu-item::before { content: ""; position: absolute; left: -10px; top: 0; height: 100%; border-left: 1px solid var(--color-border-subtle); } -.submenu-item:last-child::before { height: 17px; } +.submenu-item:last-child::before { height: calc(var(--submenu-row) / 2); } .submenu-item::after { content: ""; position: absolute; left: -10px; top: 9px; width: 9px; height: 8px; border-left: 1px solid var(--color-border-subtle); border-bottom: 1px solid var(--color-border-subtle); border-bottom-left-radius: var(--radius); pointer-events: none; } .submenu-item > button:first-child { min-width: 0; flex: 1; height: 32px; display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: var(--radius); text-align: left; font-size: var(--text-sm); } .submenu-item > button:first-child > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; } @@ -814,3 +814,36 @@ label.button:has(input:focus-visible) { outline: 2px solid var(--workspace-focus html[data-printing] [data-print-target] .message-actions, html[data-printing] [data-print-target] .pipeline-trace { display: none; } html[data-printing] [data-print-target]::before { content: attr(data-print-status); display: block; margin-bottom: 12px; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); } } + +/* Design audit fixes (2026-11-27; audit findings H1, H2, H3, S1, D1, D2). */ +/* One encounter-row height drives the row, its tree line and the active-branch indicator (sidebar-submenu.tsx). */ +:root { --submenu-row: 34px; } +/* The composer and feedback fields draw no ring of their own, so the field box carries the same 2px ring as buttons. */ +.composer:focus-within, .feedback:focus-within { outline: 2px solid var(--workspace-focus); outline-offset: 2px; } +a:focus-visible, select:focus-visible { outline: 2px solid var(--workspace-focus); outline-offset: 2px; } +/* Analysis error: the message, then its recovery actions as real buttons on their own row. */ +.form-warning-message { margin: 0; } +.form-warning-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; } +.form-warning-actions .button { min-height: 32px; padding: 4px 11px; background: var(--workspace-white); color: var(--color-text-primary); font-size: var(--text-sm); } +/* On a wide screen the home composer sits near the top of the canvas, so the / picker opens below it. On a phone the + composer sits low, so the picker keeps opening upward, as the chat composer's always does. */ +@media (min-width: 761px) { .home-content .slash-picker { top: calc(100% + 4px); bottom: auto; } } +@media (max-width: 760px) { + :root { --submenu-row: var(--target-min); } + /* Every mode chip stays visible on a phone: the row wraps instead of scrolling behind a fade. */ + .chip-row { flex-wrap: wrap; overflow-x: visible; mask-image: none; } + .chip-row::after { content: none; } + .main-nav > button, .main-nav > a { height: auto; min-height: var(--target-min); } + .small-icon { min-width: var(--target-min); min-height: var(--target-min); } + .submenu-heading > button:first-child { min-height: var(--target-min); } + .sidebar .icon-button { min-width: var(--target-min); min-height: var(--target-min); } + .empty-text { min-height: var(--target-min); align-items: center; } + .feedback { height: auto; min-height: var(--target-min); } + .feedback button { min-width: var(--target-min); } + .submenu-item > button:first-child { height: auto; min-height: var(--target-min); } +} +@media (max-width: 600px) { + /* Stacked in DOM order, so the focus order matches what is seen; the destructive action stands apart at the top. */ + .dialog-footer { flex-direction: column; align-items: stretch; } + .dialog-footer .push-left { margin: 0 0 8px; } +} diff --git a/src/components/composer.tsx b/src/components/composer.tsx index adbc060..5e6f3e1 100644 --- a/src/components/composer.tsx +++ b/src/components/composer.tsx @@ -75,7 +75,7 @@ export function Composer(props: Props) { {dictation.error &&

{dictation.error}

} {props.aadiEnabled &&

Sebelum mengirim ke layanan AI, hapus identitas pasien dari pertanyaan, catatan, dan konteks.

} {props.mismatch &&

Data usia/jenis kelamin berbeda dari encounter ini.

} - {props.aadiEnabled && props.analysisError &&

{props.analysisError} {props.prompt.trim() && !props.busy && <> {props.onFallback && }}

} + {props.aadiEnabled && props.analysisError &&

{props.analysisError}

{props.prompt.trim() && !props.busy &&
{props.onFallback && }
}
} {/* Options are the rows themselves: focus stays in the textarea, which points at the active row. */} {slashOpen &&
{groups.map((group, g) =>
{group.options.map((item, i) => { const at = groups.slice(0, g).reduce((n, earlier) => n + earlier.options.length, 0) + i; return
event.preventDefault()} onClick={() => choose(item.key)}>{item.label}{item.key === current ? : item.hint && {item.hint}}
; })}
)}{!options.length &&

Tidak ada templat yang cocok.

}
} ; diff --git a/src/components/sidebar-submenu.tsx b/src/components/sidebar-submenu.tsx index f01c569..8b905fd 100644 --- a/src/components/sidebar-submenu.tsx +++ b/src/components/sidebar-submenu.tsx @@ -24,7 +24,7 @@ export function SidebarSubmenu({ sections, initialSection }: { sections: Submenu
{section.action}
- {selectedIndex >= 0 &&