diff --git a/docs/sentrapedia-ui.md b/docs/sentrapedia-ui.md index f52e792..3d9668b 100644 --- a/docs/sentrapedia-ui.md +++ b/docs/sentrapedia-ui.md @@ -151,3 +151,26 @@ Terapi Farmakologi: "Untuk ()", satu obat per baris dengan dos ## Workspace berbentuk Glass (2026-11-04) Menggantikan Clinical Cockpit, rail "Alur kasus", jawaban diketik, dan dialog Pengaturan Agent di atas. Sidebar mengikuti urutan Glass; kanvas terbagi antara chat dan panel dokumen di atas 1200 px (sheet "Dokumen encounter" di bawahnya). Chat berisi prosa, ringkasan dokter, dan kartu dokumen; panel berisi tab Ringkasan encounter dan satu tab per dokumen. Analisis AADI dirender dari hasil mesin yang tersimpan dalam bentuk diferensial Glass (`src/lib/aadi/analysis-view.ts`, `src/components/analysis-document.tsx`): Pembahasan kasus, Kemungkinan utama, Alternatif, Jangan terlewat, Langkah diagnostik berikutnya, Rencana tata laksana (lewat gerbang bukti; dosis yang tidak terverifikasi diberi tanda "Cek dosis obat"), Edukasi dan tindak lanjut, Kutipan pedoman (kartu bernomor, tautan `[n]`). Kartu berpikir hanya melaporkan yang terjadi (permintaan diterima, detik menunggu); jejak pipeline disimpan bersama jawaban. Komposer memakai satu baris chip (8 mode) dan `/` sebagai pemilih penuh. Pengaturan Agent menjadi halaman `/agent` dengan tab Preferensi, Mode dan templat, Pengetahuan; `settings.environment` tampil sebagai pil beranda, `settings.modeInstructions` hanya dipakai draf lokal. Token radius: `--radius-control` 8 px, `--radius-structure` 12 px. Bukti: `docs/verification/glass-redesign-2026-11-04/` (1440, 1024, 375 px; axe 0 pelanggaran). + +## Alur kasus yang lebih aman (2026-11-26) + +Empat perbaikan P0 dari audit alur UI (SVI-CEO-RPT-001), status REVIEW: + +- Workspace baru, atau workspace yang tidak dapat dibaca, mulai kosong: tanpa Pasien atau Encounter contoh (`emptyWorkspace`, `src/lib/workspace.ts`). Catatan Pasien contoh yang masih tersimpan di workspace lama tidak pernah dikirim ke AADI sebagai riwayat kasus (`isSeedPatientNote`). +- Chip mode tetap menulis kalimat pembukanya di composer, tetapi kalimat itu dibuang saat kirim (`stripOpening`, `src/lib/studio.ts`), sehingga tidak menjadi Keluhan Utama atau keluhan utama AADI. +- Bila Encounter yang terbuka sudah berisi kasus dan usia/jenis kelamin yang diketik berbeda (Pasien tersimpan dulu, lalu kasus pertama), kasus belum dikirim: composer menawarkan "Kasus baru" atau "Tetap di encounter ini" (`knownCaseFields`, `caseMismatch`, `src/lib/aadi/composer.ts`). Nilai yang tidak diketahui tidak pernah memblokir. +- Chip dan pemilih `/` menandai jenis mode: AI untuk lima mode yang dianalisis AADI, Template untuk tiga belas mode yang hanya menyusun ulang teks (`modeKind`). Draf lokal menulis "Template … disusun dari teks Anda, tanpa analisis AI." + +Verifikasi: seluruh vitest 841 lulus, 23 dilewati (data privat); lint dan typecheck bersih; pemeriksaan browser `next dev` mode auth lokal pada 1440 dan 390 px. Jawaban AADI live dan layar Clerk tidak diuji di lingkungan cloud. + +## Alur workspace lebih mulus (2026-11-26) + +Lanjutan audit (#5, #6, #9-#12), status REVIEW: + +- Membuka dialog (Tambah Konteks, Pasien, Templat, Pusat perintah, dan lainnya) tidak lagi membatalkan analisis yang sedang berjalan. Scribe tetap membatalkan karena memulai draf baru. +- Selama item wajib Peninjauan belum dicentang, di bawah kepala dokumen tampil "Centang semua item wajib di Peninjauan untuk menandai Ditinjau." dengan tombol "Buka Peninjauan". +- Di composer, kirim menjadi satu-satunya aksi utama (Mulai Scribe sekunder), dan Standar/Extended hanya tampil pada mode Template. +- Pada 1201-1460 px dengan panel dokumen terbuka, Scribe dan Konteks tampil sebagai ikon (nama aksesibel dan tooltip tetap), sehingga toolbar composer satu baris. Baris chip memudar di tepi kanan sebagai tanda bisa digulir. +- 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). diff --git a/src/app/globals.css b/src/app/globals.css index 358c404..06fbae1 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -145,6 +145,10 @@ h1 span { white-space: normal; } .composer-analysis { margin-top: 14px; text-align: left; font-size: var(--text-xs); line-height: var(--leading-relaxed); color: var(--color-text-secondary); } .composer-toolbar { margin-top: 7px; display: flex; align-items: center; justify-content: space-between; gap: 7px; } .composer-tools-left, .composer-tools-right { display: flex; align-items: center; gap: 8px; } +/* The left group gives way first (its status line ellipsizes), so the toolbar keeps one row in the split chat column. */ +.composer-tools-left { flex: 1 1 0; min-width: 0; } +.composer-tools-left .button { flex-shrink: 0; } +.composer-tools-right { flex-shrink: 0; } .button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--color-border-subtle); min-height: 36px; padding: 8px 11px; border-radius: var(--radius); background: var(--workspace-white); font-size: var(--text-base); color: var(--color-text-secondary); line-height: 1.125rem; white-space: nowrap; } label.button { cursor: pointer; } label.button:has(input:focus-visible) { outline: 2px solid var(--workspace-focus); outline-offset: 2px; } @@ -197,6 +201,7 @@ label.button:has(input:focus-visible) { outline: 2px solid var(--workspace-focus .context-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); color: var(--color-text-muted); padding-left: 2px; } .context-status .listening { color: var(--workspace-accent-ink); } .action-chip { display: flex; align-items: center; gap: 7px; flex-shrink: 0; border: 1px solid var(--color-border-subtle); border-radius: var(--radius); background: var(--workspace-white); padding: 8px 11px; font-size: var(--text-sm); height: 36px; white-space: nowrap; } +.action-chip .chip-kind { font-size: var(--text-xs); color: var(--color-text-secondary); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-control); padding: 0 5px; line-height: 16px; } .action-chip:hover { border-color: var(--workspace-ink-faint); background: var(--color-background-surface); } .action-chip.active { color: var(--workspace-accent-ink); border-color: color-mix(in srgb, var(--workspace-focus), transparent 45%); background: var(--workspace-accent-soft); } .home-bottom { width: min(780px, calc(100% - 48px)); flex-shrink: 0; margin: 18px auto 16px; text-align: left; } @@ -328,7 +333,6 @@ label.button:has(input:focus-visible) { outline: 2px solid var(--workspace-focus .message-actions .icon-button { color: var(--color-text-secondary); } .text-button { padding: 0; min-height: 24px; display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); color: var(--color-text-muted); } .text-button:hover { color: var(--workspace-accent-ink); } -.evidence-handoff { display: grid; gap: 7px; margin: 20px 0 0; background: var(--workspace-accent-soft); border: 1px solid var(--color-border-subtle); padding: 15px; border-radius: var(--radius); color: var(--workspace-accent-ink); font-size: var(--text-sm); line-height: var(--leading-relaxed); } .chat-composer { width: min(780px, calc(100% - 48px)); flex-shrink: 0; margin: 8px auto 8px; } @@ -555,7 +559,9 @@ label.button:has(input:focus-visible) { outline: 2px solid var(--workspace-focus /* Glass's shape: the composer is a rounded card; under it one row of mode chips scrolls sideways instead of wrapping. */ .composer-area { position: relative; } .composer .button, .composer .model-select select, .composer .icon-tool { border-radius: var(--radius-control); } -.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 10px 2px 4px; } +.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 10px 2px 4px; mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); } +/* The fade at the right edge says the row scrolls; the last chip clears it. */ +.chip-row::after { content: ""; flex: 0 0 24px; } .chip-row::-webkit-scrollbar { display: none; } .chip-row .action-chip { height: 32px; padding: 0 12px; border: 1px solid rgba(31, 31, 31, .1); border-radius: var(--radius-control); background: var(--workspace-white); color: var(--color-text-primary); font-size: var(--text-sm); font-weight: var(--weight-medium); } .chip-row .action-chip:hover:not(:disabled) { background: var(--color-background-surface); border-color: var(--workspace-ink-faint); } @@ -655,6 +661,9 @@ label.button:has(input:focus-visible) { outline: 2px solid var(--workspace-focus @keyframes headline-enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } } @media (min-width: 1201px) and (max-width: 1460px) { .composer-toolbar { flex-wrap: wrap; gap: 9px; } + /* Beside the document pane the chat column is narrow: Scribe and Konteks keep their icon and accessible name, so the + toolbar stays one row and the conversation keeps its height. */ + .workspace-body[data-split="true"] .chat-composer .button-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } } @media (max-width: 760px) { .home-headline { min-height: 140px; } diff --git a/src/components/chip-row.tsx b/src/components/chip-row.tsx index a025c3f..6014106 100644 --- a/src/components/chip-row.tsx +++ b/src/components/chip-row.tsx @@ -4,6 +4,7 @@ import { chipLabel, chipShortlist } from "../lib/studio"; import { modes, type ModeId } from "../lib/drafts"; import type { PersonalTemplate } from "../lib/workflow"; import type { Encounter } from "../lib/workspace"; +import { modeKind, modeKindLabel } from "../lib/aadi/composer"; /** The shortlist under the composer: one scrollable row, the active mode pressed, every chip off while an analysis runs. * When the active mode is outside the shortlist, or a personal template is active, one extra pressed chip leads the row so the doctor can see what the next answer will be. */ @@ -12,7 +13,7 @@ export function ChipRow({ encounter, mode, templateKey, templates, busy, onChip const lead = template ? template.name : chipShortlist.includes(mode) ? null : modes.find((item) => item.id === mode)!.label; return
{/* A template chip only names the active template: choosing a mode here would drop it. */} - {lead && } - {chipShortlist.map((id) => )} + {lead && } + {chipShortlist.map((id) => )}
; } diff --git a/src/components/composer.tsx b/src/components/composer.tsx index f83fcee..adbc060 100644 --- a/src/components/composer.tsx +++ b/src/components/composer.tsx @@ -8,11 +8,12 @@ import { modes, type ModeId } from "../lib/drafts"; import { composerPlaceholder, withOpening } from "../lib/studio"; import { modeCategories } from "../lib/clinical-templates"; import { modelLabel } from "../lib/ui-labels"; +import { modeKind, modeKindLabel } from "../lib/aadi/composer"; import type { PersonalTemplate } from "../lib/workflow"; import type { Encounter, Settings } from "../lib/workspace"; import { useDictation } from "./use-dictation"; -interface Props { prompt: string; onPrompt: (value: string) => void; mode: ModeId; onMode: (mode: ModeId) => void; settings: Settings; onModel: (model: Settings["model"]) => void; context: string; onContext: () => void; onScribe: () => void; encounter?: Pick; patientName?: string; templates: PersonalTemplate[]; favorites: string[]; templateKey: string | null; onTemplate: (key: string) => void; onSubmit: () => void; busy: boolean; aadiEnabled?: boolean; analysisError?: string; onCancelAnalysis?: () => void; onFallback?: () => void } +interface Props { prompt: string; onPrompt: (value: string) => void; mode: ModeId; onMode: (mode: ModeId) => void; settings: Settings; onModel: (model: Settings["model"]) => void; context: string; onContext: () => void; onScribe: () => void; encounter?: Pick; patientName?: string; templates: PersonalTemplate[]; favorites: string[]; templateKey: string | null; onTemplate: (key: string) => void; onSubmit: () => void; busy: boolean; aadiEnabled?: boolean; analysisError?: string; onCancelAnalysis?: () => void; onFallback?: () => void; mismatch?: { onNew: () => void; onKeep: () => void } | null } const modeLabel = (id: ModeId) => modes.find((item) => item.id === id)!.label; @@ -20,7 +21,7 @@ const modeLabel = (id: ModeId) => modes.find((item) => item.id === id)!.label; function slashGroups(query: string, templates: PersonalTemplate[], favorites: string[]) { const needle = query.toLowerCase(); const all = [ - ...[...new Set(modeCategories.flatMap((group) => group.modes))].map((id) => ({ key: `mode:${id}`, label: modeLabel(id), hint: `/${id}`, search: `${id} ${modeLabel(id)}` })), + ...[...new Set(modeCategories.flatMap((group) => group.modes))].map((id) => ({ key: `mode:${id}`, label: modeLabel(id), hint: `/${id} · ${modeKindLabel[modeKind(id)]}`, search: `${id} ${modeLabel(id)}` })), ...templates.map((item) => ({ key: `template:${item.id}`, label: item.name, hint: "", search: item.name })), ].filter((option) => option.search.toLowerCase().includes(needle)); return [ @@ -60,11 +61,12 @@ export function Composer(props: Props) { return
{ event.preventDefault(); if (slashOpen) { if (options[slashIndex]) choose(options[slashIndex].key); } else props.onSubmit(); }}>