Finish the i18n pass: settings panels (profile/care-team/signing), the
chat heading + input, the patient cards / detail / create-edit form, and
the notes page + rich-text editor are all keyed in en/translation.json.
All 526 static t() keys resolve. Document the new backend resources +
Socket.io realtime (backend README/CLAUDE) and the i18n coverage
(frontend CLAUDE).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move all hardcoded UI strings in the appointments, prescriptions, tasks,
messages, activity, analysis and patients views (plus their dialogs and
detail sheets), the remaining auth pages (verify-email, forgot/reset
password, accept-invite, onboarding), the clinic form and the sidebar user
menu into i18next keys in en/translation.json. Clinical option values
(appointment types, frequencies) stay canonical. English-only; no new
locale yet.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Auto-generate notifications on patient record create/update (fan out to
the other clinic members, pushed live), and wire the sidebar bell to real
data via a useNotifications hook over the shared socket: live unread badge,
real list, mark-all-read on open. Drops the hardcoded sample array and the
dead "View all" link.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add conversations/participants/messages tables, a participant-scoped REST
API (/api/conversations) and a Socket.io server (session-authenticated
handshake; per-user + per-conversation rooms) sharing the HTTP port. New
messages broadcast live and create per-recipient notifications. Also lands
the notifications table + service + routes (used by the message flow). The
Messages page is rewritten: live threads, unread state, and a compose
dialog to start a conversation with a clinic member.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add GET /api/analytics returning real aggregates over the clinic's
patients/appointments/prescriptions/tasks, and rebuild the Analysis page
to render them. Drops the fabricated revenue/profit cards — temetro has no
billing data source.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the activity_log table, a best-effort recordActivity() service and a
GET /api/activity feed, and write entries on create/update/delete of
patients, notes, appointments, prescriptions and tasks. The Activity page
now shows the real audit trail (actor, action, patient context, time);
the fabricated signing hashes / approval badges are gone — that vision
stays deferred.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the tasks table, validation, service and routes (/api/tasks with a
PATCH for partial updates / the done toggle, RBAC-gated) and the frontend
data module. The tasks board now loads, creates and toggles real data
(optimistic toggle with rollback).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the prescriptions table, validation, service and CRUD routes
(/api/prescriptions, RBAC-gated; prescriber defaults to the signed-in
clinician, prescribedAt to today) and the frontend data module. The page
now loads/persists real data and computes its status KPIs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the appointments table, validation, service and CRUD routes
(/api/appointments, RBAC-gated) and the matching frontend data module.
The appointments page now loads and persists real data; KPIs are computed
from it and the schedule/calendar anchor to the real current date.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extend the clinic access-control statements and role grants with
appointment/prescription/task resources (mirrored in the frontend client
AC), and widen the requirePermission type to accept any defined resource.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reflect that frontend/ and backend/ are now subdirectories of a single
git repo (the old per-folder repos are merged in); landing page lives in
a separate temetro-landing repo; note the POSTGRES_PORT workaround.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Task dialog: rename Title→Subject, add a "Details" textarea (notes),
widen to sm:max-w-lg.
- Tasks & Notes: replace split-panes with full-width lists that open a
right-side Sheet on click (TaskDetailSheet, NoteDetailSheet), mirroring
the Patients table → detail Sheet pattern.
- Prescriptions: rows are now clickable and open PrescriptionDetailSheet
with the full Rx details (incl. duration + notes).
- New prescription dialog: Duration is a dropdown of presets with an
"Other" → custom input, plus a Notes textarea; NewPrescription gains
notes and threads duration/notes through to the list.
- Appointments: header search filtering by patient/type/provider,
grouped by date, with an empty state.
- Patients: pressing Enter in the search box opens the top match's record.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The source logo has wide transparent margins; the icons were squared on top of
that, leaving the mark tiny in the browser tab. Regenerate app/icon.png (256) and
app/apple-icon.png (180) cropped to the artwork's alpha bounding box with a small
7% margin so the logo reads at favicon size.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Appointments now carry a date; the Calendar button opens a Google-Calendar
style month grid (color-coded event chips, month nav, Today, click a day for
its list). Today/Upcoming sections derive from dates.
- Add-appointment dialog gains a date picker (Popover + Calendar).
- Messages rebuilt as chat threads: an input-based composer that appends to a
two-way timeline (no more toast covering the field), and the unread count is
now a filter toggle.
- Favicon: the brand logo now shows in the tab. Removed the stale default
app/favicon.ico (which shadowed it) and added app/icon.png + app/apple-icon.png
generated from the logo; dropped the redundant metadata.icons.
- Sidebar: swapped Notes <-> Messages order (both kept).
- New pages: Activity (signed-change audit timeline with hash chips + approval
status) and Tasks (two-pane care-team to-do with add dialog).
- Prescriptions: adding a medication now surfaces mock drug-interaction and
allergy warnings against the patient's record.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Appointments: a Calendar button next to Add opens a month-grid dialog
(reuses the Calendar primitive + shared ScheduleList); the schedule day is
marked and selecting it lists that day's appointments.
- Patients sub-nav: new Prescriptions page (mock list + KPIs) with a compact
"New prescription" dialog reusing the patient quick-search pattern.
- Notes: deleting a note now goes through a reusable ConfirmDialog instead of
deleting immediately.
- New top-level Messages page: two-pane email-style inbox (list + reading pane
with mock reply composer), mirroring the Notes layout.
- Sidebar logo bumped from size-9 to size-10.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- User menu: rename "Quick nav" to "Search"; add spacing to the clinic
submenu so it no longer touches the parent menu (sideOffset).
- Notes: lay the list, title, toolbar, and writing area out as separate
rounded panels with gaps so they're no longer stuck together.
- Sidebar: shorten the "Appointments & Schedule" label to "Appointments".
- Appointments: replace the oversized patient form with a compact
"New appointment" dialog — pick a patient via quick search by name/file
number, set time/type/provider; the entry is added to today's schedule.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Footer is now a single user row. The ⌘K command hint moved into the user
menu below Theme, and the clinic switcher became a hover submenu below that
(revealing the active clinic's name/slug/count, the switch list, and
Create clinic). Removed SidebarCommandButton and deleted team-switcher.tsx.
- Patients sub-nav (Patients / Appointments & Schedule): no icons, no
background change on hover/active — only the text color changes.
- Appointments & Schedule: added an "Add" button that opens the create-patient
dialog.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Round-2 fixes to the 6 features:
- Logo: enlarge the sidebar mark, drop the inline wordmark, and show
"temetro" via a hover tooltip; bigger logo on the auth screens.
- Sidebar footer: wrap the quick-nav, clinic switcher, and user menu in a
single bordered block so it reads as one footer instead of three cards.
- Sidebar nav: highlight the active page (usePathname + data-[active]), and
add an Appointments & Schedule sub-page under Patients that auto-expands
for the current section. New mock /appointments page; reachable via ⌘K.
- Notes: redesign to a two-pane list + editor with an Empty state on the
right when nothing is selected; fix the editor so text starts top-left
(div instead of a centering <button>); compact the toolbar; add
.note-content typography in globals.css so headings/lists/etc. actually
render (the app has no typography plugin).
- Patients: new PatientDetail laid out to fit the side Sheet (stacked
full-width sections, no nested click-to-expand dialogs); keep Edit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- lib/notes.ts: list/get/create/update/delete via the API client.
- New /notes route + nav item (and shared lib/nav.ts entry, i18n key) so it
shows in the sidebar and command palette.
- components/notes/notes-view.tsx: a note list + "New note", with save/delete
and toasts.
- components/notes/notes-editor.tsx: a Word-like COSS Toolbar driving Tiptap
(StarterKit + Placeholder) — bold/italic/underline, H1–H2, bullet/numbered
lists, undo/redo — plus a title field and Save. Installed @coss/toolbar and
@coss/toggle-group and the Tiptap packages.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
New `note` table (src/db/schema/notes.ts) referencing organization + user,
with org+author scoping so a doctor only sees their own notes within the active
clinic. Adds:
- src/types/note.ts + src/lib/note-validation.ts (zod)
- src/services/notes.ts (CRUD, treats non-uuid ids as not-found)
- src/routes/notes.ts mounted at /api/notes, gated requireAuth → requireOrg
- schema barrel + generated migration drizzle/0001_*.sql (applied on startup
by the runtime migrator)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Several navigation/UX additions:
- Command palette (⌘K): components/command-palette.tsx wraps the app shell
(mounted in app/(app)/layout.tsx) with a controlled COSS CommandDialog listing
the nav pages; a "Quick nav" Kbd button in the sidebar footer also opens it.
Installed @coss/kbd. Extracted the nav list into lib/nav.ts so the sidebar and
palette share one source of truth.
- Clinic switcher moved from the sidebar body into the footer; its menu now
opens a read-only "Clinic info" dialog and a "Create clinic" dialog instead of
routing to /onboarding. Shared CreateClinicForm (components/clinic/) is reused
by onboarding.
- Patients: clicking a row opens a right-side Sheet with the full record
(components/patients/patient-detail-sheet.tsx) instead of navigating to the
chat; PatientResult gained a vertical "column" layout for the Sheet.
- New Analysis page (app/(app)/analysis/) — a mock dashboard (revenue/profit,
patient volume, appointments, operations) reusing Sparkline + Card + Badge.
- Logo: set metadata.icons so the new mark appears as the browser-tab favicon.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wire COSS's (Base UI) Sonner-style stacked toast into the app:
- Install @coss/toast (components/ui/toast.tsx) and mount <ToastProvider> in
the root layout; add a small notify.{success,error,info,warning} helper
(lib/toast.ts) over toastManager so callers don't repeat the toast shape.
- Toast on the events requested: clinic created (onboarding), auth actions
(sign in / sign up / sign out / password reset request + reset), patient
saved (create/edit), and all failure branches as error toasts (kept inline
errors as a fallback). New auth toast strings added to the en translation.
- Replace the logo everywhere: overwrite public/temetro-logo.png with the new
1024² square mark (same aspect ratio as the old 500², so existing 32×32
next/image usages stay undistorted; no reference changes needed).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Install COSS Calendar (@coss/calendar, react-day-picker) and add a co-located
DatePicker (Popover + Button trigger + Calendar) in patient-form-dialog. It
reads/writes the same formatted date string the form already uses (formatDate/
parseDate), so the Patient model is unchanged. Replace the free-text Visit 'Date'
and Problem 'Since' inputs with the picker.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Update frontend/CLAUDE.md after the COSS migration: note the sidebar theme
toggle and the always-use-semantic-tokens rule in Theming, add a 'COSS
composition gotchas' section (MenuGroup requirement, DialogPanel padding, no
Card/Avatar size prop, destructive variant, items-start Field, aliases,
ai-elements drift), and dedupe the repeated lucide-react note.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SidebarInset (variant=inset) had rounded corners + shadow but no border, so the
content card blended into the bg-sidebar backdrop. Add a subtle border (semantic
--border token: white/6% dark, black/8% light), scoped to the inset variant to
match the existing rounded-xl/shadow.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- chat-input: replace the two hardcoded oklch backgrounds (leftover Linear
palette) with COSS surface tokens — outer form bg-muted, inner card bg-input.
Lighter in dark mode and theme-aware (no longer near-black in light mode),
preserving the two-tone layered look.
- nav-user: wire the previously-static Theme menu item to next-themes
(useTheme/setTheme) — toggles light/dark, with the icon (Sun/Moon) and
shortcut label reflecting the current theme.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- MenuGroupLabel must live inside a MenuGroup (Base UI context) — wrap the
label in nav-user, team-switcher, and nav-notifications. Fixes the
'MenuGroupContext is missing' runtime error.
- Patient form/detail dialogs: COSS DialogPopup has no inner padding; move the
body into DialogPanel (form as 'contents') so fields get p-6 instead of being
flush to the edges.
- Settings 'Delete' button used the default variant + bg override, keeping a
near-white border-primary in dark mode. Use variant='destructive'.
- Auth forms: COSS Field is items-start (no stretch). Make the submit button and
the password-row/grid w-full, and underline the bottom sign-in/up link.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Components:
- Replace components/ui primitives with COSS equivalents from the @coss/* shadcn
registry. Add menu/preview-card/group; remove the superseded dropdown-menu,
hover-card, button-group; keep carousel (no COSS equivalent).
- Migrate live call sites to canonical COSS APIs preserving layout/behavior:
sidebar menus (nav-user, team-switcher, nav-notifications), chat-input radio
menu, patient dialogs/cards, auth forms (FieldGroup -> flex column), settings.
- ai-elements: migrate the live conversation/message with behavior parity
(Tooltip via render, Group/GroupText); repoint dormant files (hover-card ->
preview-card, dropdown-menu -> menu, button-group -> group, InputGroupButton
-> Button). Residual pre-existing Base UI type drift stays behind
ignoreBuildErrors.
Theme:
- Adopt COSS default neutral tokens in globals.css with light + dark palettes.
- Add next-themes (defaultTheme=dark, enableSystem) and drop the forced dark
class. Align font variables to the COSS contract (--font-sans/-heading/-mono).
Make scrollbars theme-aware.
i18n:
- Add i18next + react-i18next (lib/i18n/config.ts, locales/en/translation.json,
components/i18n-provider.tsx mounted in layout). Convert auth forms, sidebar
nav, and settings tabs to useTranslation() as the reference pattern.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Returning members were sent to onboarding on every sign-in because the new
session had no activeOrganizationId. Add a session.create `before` hook that
defaults it to the user's first clinic membership, so sign-in lands straight
in the app.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
If a signed-in user has no active clinic but already belongs to one, select
it automatically; only users with zero clinics are sent to onboarding. Fixes
being asked to create a clinic on every login.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the shadcn login-01 and signup-03 blocks (with the base-luma field/label
components) and wire their forms to the Better Auth client: login →
signIn.email, signup → signUp.email (12-char rule, confirm match), with error
+ submitting states. Dropped the non-functional "Login with Google" button.
Render the block forms from the existing (auth)/login and (auth)/signup pages
(deleting the blocks' duplicate app/login + app/signup routes). Replace the
animated AuthShell with a static, card-based shell + brand header so
onboarding/verify/reset/accept-invite match. Drop the unsupported `eslint`
key from next.config.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the split layout with a centered glass card on a living background:
drifting aurora blobs, a rotating conic-gradient halo around the card, a
spring entrance with staggered content, a floating logo badge, and a one-time
shimmer sweep on mount. Shared by all auth screens.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the centered bordered card with a two-column auth layout shared by
login/signup/onboarding (and the rest): a branded left panel (gradient glow,
subtle grid, product pitch + feature list) and a clean, card-less form on the
right. Collapses to a single centered column with a soft glow on mobile.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Since email verification is no longer enforced at sign-in, gating
organization creation on `user.emailVerified` blocked onboarding with
"You are not allowed to create a new organization". Allow any signed-in
user to create a clinic; re-tie to emailVerified when verification returns.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Email verification is no longer enforced (see backend), and sign-up now
auto-signs-in, so route to clinic onboarding instead of /verify-email.
Update CLAUDE.md: the app now talks to ../backend (auth + patient API),
route protection via proxy.ts, and build/type-check guidance.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- emailAndPassword.requireEmailVerification = false so users can sign in
immediately; verification emails are still sent and /verify-email still
works. Flip back to true to make it mandatory later (TODO noted in code).
- Add backend/CLAUDE.md documenting stack, commands, the auth/schema
generation workflow, and runtime gotchas.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- useSecureCookies now keys off the BETTER_AUTH_URL scheme instead of
NODE_ENV, so login works over http://localhost in the (production-mode)
Docker stack instead of the browser silently dropping the session cookie.
- env parsing treats empty strings as unset, so compose-supplied optionals
like `SMTP_PORT=` no longer fail coercion (Number("") === 0) and crash boot.
- docker-compose: configurable host Postgres port (POSTGRES_PORT) to avoid
clashing with an existing local Postgres.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Connects the UI-only app to the new backend over Better Auth + a small
patient API client, replacing the in-memory fixture and placeholder identity.
- Better Auth React client (lib/auth-client.ts) + shared access-control
roles; API client (lib/api-client.ts) sending credentials cross-origin.
- Designed (auth) route group: login, signup, verify-email, forgot/reset
password, clinic onboarding, and accept-invite.
- proxy.ts (this Next's renamed middleware) optimistic redirect + an
authoritative client AppAuthGuard requiring a session and active clinic.
- Real identity in nav-user (useSession + sign out); the unused team
switcher repurposed as an organization (clinic) switcher; Care-team
settings tab manages members and invitations.
- lib/patients.ts now calls the org-scoped API (types unchanged); patients
table and create/edit dialog updated for async create/update.
- next.config: standalone output + Dockerfile for containerized runs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Implements the first temetro backend: an Express 5 API on Postgres via
Drizzle ORM, with authentication and multi-tenant clinics powered by
Better Auth.
- Auth: email/password with required email verification, password reset,
rate limiting, CSRF/trusted-origins, secure cookies, session audit hook.
- Organizations (clinics) with RBAC (owner/admin/member/viewer) and an
extended `patient` permission set; member invitations by email.
- Org-scoped patient records mirroring the frontend Patient shape, with
CRUD endpoints gated by permission (read/write/delete).
- Email helper logs links to the console when SMTP is unset (zero-setup
local dev); Dockerfile + docker-compose (db + backend + frontend) with
migrations applied on startup and a configurable Postgres host port.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Patients: new /patients directory table (name, MRN, age·sex, status,
last seen, allergies) with search + Add patient; clicking a row opens
the record in the chat via /?patient=<#>. chat-panel reads that search
param (Suspense-wrapped) and runs the lookup once on arrival. Sidebar
"Patients" now links to /patients; lib/patients gains listPatients().
- Settings: re-themed to clinical tabs (Profile · Records · Signing ·
Care team · Developers) — clinician profile, patient notifications,
patient-owned-storage/signed-records features, and a Signing key panel.
Same layout/components, only content changed.
- Sidebar footer: Polar-style NavUser (avatar + name + chevron) opening a
menu upward — Settings · Docs & GitHub · Theme · Log out. Collapsed
("locked"): avatar only, name on hover (tooltip), menu opens to the
right. Placeholder identity (no auth yet).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- app-sidebar: remove the "Saved" and "Conversations" nav items (dead #
links) and the "temetro / Clinic" team switcher; footer is now a plain
"temetro · open source" wordmark. Keep the notifications bell. Drop the
now-unused Bookmark/MessageSquare/Logo/TeamSwitcher imports.
- CLAUDE.md (frontend): rewrite "What this is" to match the current
patient-records flow (/patient cards, sparklines, create/edit dialog over
the mock fixture) and point to the project vision; note team-switcher.tsx
is unused.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Generalize add-patient-dialog → shared PatientFormDialog (create | edit).
Edit mode prefills from the patient; both modes now cover all sections
with add/remove rows: identity, vitals, allergies, meds, problems, labs,
visits. Save writes to the store (addPatient overwrites by file #).
- Fix the dialog scrollbar: fixed header + footer (Save/Cancel pinned),
only the field body scrolls, scrollbar hidden (no-scrollbar).
- patient-cards: "Edit record" button on the Summary card opens the editor
(stopPropagation so it doesn't open the detail dialog); PatientResult
holds the editor state and exposes onPatientUpdated.
- chat-panel: onPatientUpdated replaces the message's patient in place, so
saved edits update the on-screen cards (no duplicate message, no requery).
- chat-input: Add pill now uses PatientFormDialog mode="create".
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extensions like ColorZilla inject attributes (cz-shortcut-listen) into
<body> before React hydrates, causing a benign hydration mismatch.
suppressHydrationWarning on <body> is the standard fix; it only ignores
attribute diffs on <body> itself, not its children.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- chat-input: new "Add patient" pill (UserPlus) opens an intake dialog;
remounts it via a key each open for a fresh file # / cleared form. On
create it runs /patient <new#> so the record's cards open in the chat.
- add-patient-dialog: controlled Dialog + form — generated file # (with
regenerate), identity (name/age/sex/status/PCP), current vitals, and
repeatable allergies & medications. Save builds a Patient and adds it
to the store. Save disabled until a name is entered.
- lib/patients: generateFileNumber() (unique) + addPatient() (session
store; swap point for a real create API).
- patient-cards: graceful empty states (no labs / meds / problems /
visits / trend) so a brand-new sparse chart renders cleanly.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
scroll-snap-align:start snapped the first card flush to the scroll-port
start, hiding the row's left padding and making the card look cut off on
the left. Drop snap-x/snap-start; the p-2 breathing room now shows on
both ends.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Each patient card is now a Dialog trigger (nativeButton=false for
accessible click/keyboard) that opens a roomier detail dialog with
expanded per-topic info (full demographics, vitals/labs min·max·latest
with a larger chart, all labs with dates, full visit notes).
- Sparkline shows the value (dot + tooltip) at the nearest reading on
mousemove; reused larger in the dialogs.
- Row padding pb-2 → p-2 so card tops and the first/last card edges
(ring/shadow/rounded corners) are no longer clipped by the scroller.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>