Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/sentrapedia-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,30 @@ 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).

## Design standard (Gaffer, 2026-11-26)

The current "Glass" look is the approved design standard for the workspace: Geist for text and Plus Jakarta Sans for titles, the Tosca accent (`--color-action-primary` #40e0d0, `--workspace-accent-ink` #086b61), `--radius-control` 8px and `--radius-structure` 12px, and the overrides in `src/app/globals.css` `:root`. There is no planned migration to the Swiss foundation look (Archivo, 0/2px radii, ink primary). The admission pages (`src/app/auth.css`) keep the marketing site's Inter voice on purpose.

`src/app/sentra-tokens.css` (Sentraverse UI Foundation Tokens v1.0) is still imported and supplies the semantic variables that `globals.css` overrides. Its values are not the standard where `globals.css` overrides them. These groups are defined there but unused by the workspace as of 2026-11-26:

- Spacing `--space-1…9`: components use literal px values.
- Motion `--motion-duration-*`, `--motion-easing-standard`: transitions use literal durations.
- Breakpoints 640/1024/1440 (comment only): media queries use their own widths, mainly 600, 760, 900 and 1200px.
- Type `--font-family-*`, `--font-size-*`, `--letter-spacing-*`: the workspace uses `--font-body`, `--font-title` and its own `--text-*` scale.
- Dark theme `[data-theme="dark"]`: nothing sets `data-theme`, so the workspace is light only.

Used from it: `--target-min` (44px touch targets), and the semantic colour names that `globals.css` re-points. Code changes keep following `globals.css`; whether the unused groups are adopted or removed is a separate decision.
39 changes: 36 additions & 3 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ 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::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:last-child::before { height: calc(var(--submenu-row) / 2); }
.submenu-item::after { content: ""; position: absolute; left: -10px; top: calc(var(--submenu-row) / 2 - 8px); 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; }
.submenu-item:hover > button:first-child, .submenu-item[data-active="true"] > button:first-child { background: var(--workspace-accent-soft); color: var(--workspace-accent-ink); }
Expand Down Expand Up @@ -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; }
}
2 changes: 1 addition & 1 deletion src/components/composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function Composer(props: Props) {
{dictation.error &&<div className="composer-analysis"><p className="form-warning" role="alert">{dictation.error}</p></div>}
{props.aadiEnabled && <p className="form-hint">Sebelum mengirim ke layanan AI, hapus identitas pasien dari pertanyaan, catatan, dan konteks.</p>}
{props.mismatch && <div className="composer-analysis"><p className="form-warning" role="alert">Data usia/jenis kelamin berbeda dari encounter ini. <button type="button" className="text-button" onClick={props.mismatch.onNew}>Kasus baru</button> <button type="button" className="text-button" onClick={props.mismatch.onKeep}>Tetap di encounter ini</button></p></div>}
{props.aadiEnabled && props.analysisError && <div className="composer-analysis"><p className="form-warning" role="alert">{props.analysisError} {props.prompt.trim() && !props.busy && <><button type="button" className="text-button" onClick={props.onSubmit}>Coba lagi</button> {props.onFallback && <button type="button" className="text-button" onClick={props.onFallback}>Susun draf SOAP lokal</button>}</>}</p></div>}
{props.aadiEnabled && props.analysisError && <div className="composer-analysis"><div className="form-warning" role="alert"><p className="form-warning-message">{props.analysisError}</p>{props.prompt.trim() && !props.busy && <div className="form-warning-actions"><button type="button" className="button" onClick={props.onSubmit}>Coba lagi</button>{props.onFallback && <button type="button" className="button" onClick={props.onFallback}>Susun draf SOAP lokal</button>}</div>}</div></div>}
{/* Options are the rows themselves: focus stays in the textarea, which points at the active row. */}
{slashOpen && <div className="slash-picker" id={pickerId} role="listbox" aria-label="Pilih templat">{groups.map((group, g) => <div key={group.label} role="group" aria-label={group.label}><span className="slash-label" aria-hidden="true">{group.label}</span>{group.options.map((item, i) => { const at = groups.slice(0, g).reduce((n, earlier) => n + earlier.options.length, 0) + i; return <div role="option" aria-selected={slashIndex === at} id={`${pickerId}-${at}`} key={`${group.label}-${item.key}`} onPointerDown={(event) => event.preventDefault()} onClick={() => choose(item.key)}><strong>{item.label}</strong>{item.key === current ? <Check size={14} aria-label="dipakai"/> : item.hint && <span>{item.hint}</span>}</div>; })}</div>)}{!options.length && <p>Tidak ada templat yang cocok.</p>}</div>}
</div>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebar-submenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function SidebarSubmenu({ sections, initialSection }: { sections: Submenu
<div className="submenu-heading"><button type="button" id={`${panelId}-title`} aria-expanded={open} aria-controls={panelId} onClick={() => setOpenId(section.id)}><span>{section.title}</span><span className="submenu-count">{section.items.length}</span><ChevronDown size={13}/></button>{section.action}</div>
<div id={panelId} role="region" aria-labelledby={`${panelId}-title`} className="submenu-body" inert={!open} aria-hidden={!open}>
<div className="submenu-clip"><div className="submenu-items">
{selectedIndex >= 0 && <span aria-hidden="true" className="submenu-active-branch" style={{ height: `${selectedIndex * 34 + 17}px` }}/>}
{selectedIndex >= 0 && <span aria-hidden="true" className="submenu-active-branch" style={{ height: `calc(${selectedIndex} * var(--submenu-row) + var(--submenu-row) / 2)` }}/>}
{section.items.map((item, index) => <div key={item.id} className="submenu-item" style={{ "--item-order": index } as CSSProperties} data-active={item.id === section.selectedId}>
<button type="button" aria-current={item.id === section.selectedId ? "true" : undefined} onClick={item.onSelect}>{item.label}</button>{item.actions}
</div>)}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/aadi/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function createAadiGateway(options: Options = {}) {
if (!payload || typeof payload !== "object" || !("case" in payload) || Object.keys(payload).some(k => k !== "case") || !validCase(payload.case)) return failure("INPUT", "Lengkapi kasus terstruktur.", 400);
const caseData = payload.case;
if (caseContainsIdentity(caseData)) return failure("PII_DETECTED", "Hapus pola identitas pasien dari keluhan, catatan, dan konteks sebelum mengirim. Gunakan kode kasus tanpa nama, nomor identitas, kontak, atau alamat.", 400);
if (!base || !token) return failure("NOT_CONFIGURED", "Token koneksi layanan analisis belum dikonfigurasi pada server workspace.", 503);
if (!base || !token) return failure("NOT_CONFIGURED", "Layanan analisis belum tersambung. Pertanyaan Anda tetap tersimpan; coba lagi nanti atau hubungi pengelola workspace.", 503);
// With a queue the caller waits for a slot and can read their place (GET /api/aadi/queue); without one the
// gateway keeps its one-at-a-time refusal. The quota and the budget are charged only once a slot is held, so
// a place given up in line costs the person nothing. The request timer below starts after both.
Expand Down
12 changes: 12 additions & 0 deletions tests/aadi-guardrails.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,15 @@ describe("without the new options", () => {
releases[0](); expect((await first).status).toBe(200);
});
});

describe("an unconfigured engine, in the words a doctor reads (design audit H3)", () => {
it("answers 503 NOT_CONFIGURED without infrastructure terms and says the question is kept", async () => {
const gateway = createAadiGateway({ log: () => undefined, token: "", fetchFn: async () => Response.json(result(0.01)) });
const response = await gateway.step(post());
expect(response.status).toBe(503);
const { error } = await response.json();
expect(error.code).toBe("NOT_CONFIGURED");
expect(error.message).not.toMatch(/token|server|konfigurasi/i);
expect(error.message).toBe("Layanan analisis belum tersambung. Pertanyaan Anda tetap tersimpan; coba lagi nanti atau hubungi pengelola workspace.");
});
});
Loading
Loading