mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 22:02:16 +00:00
feat(medications): a sortable table view with an order you choose
The medications page gains a compact table beside the card view — one row per medication with the same served-due status pill, next-intake line, cadence-scaled adherence bars, dose-derived stock and the take and skip actions the cards use, all from the payloads the cards already read; the list response aggregates stock in the same round trip. Columns sort tri-state with nulls last, the default order is yours to arrange — the same drag dialog the dashboard and insights use, applied to both views — and the chosen view and order persist per user on their own settings column with field-scoped writes, so toggling the view never touches the order. Inactive medications pin to the end, the first column stays put under horizontal scroll, and the loading skeleton follows the view you left.
This commit is contained in:
1 parent
d142a6ed31
commit
e21dfd040e
31 files changed
+3382
-65
No files matched your search
@@ -0,0 +1,11 @@
|
||||
-- v1.16.10 — medications list presentation preference.
|
||||
--
|
||||
-- `medication_list_layout_json` (users): the per-user card/table view
|
||||
-- choice for /medications plus the user-defined manual medication order
|
||||
-- shared by both views. Follows the per-surface-column convention of
|
||||
-- `dashboard_widgets_json` / `insights_layout_json`. NULL = defaults
|
||||
-- (cards, alphabetical order); the GET endpoint never lazy-writes.
|
||||
--
|
||||
-- Shape: { "version": 1, "view": "table", "order": ["<medicationId>", ...] }
|
||||
|
||||
ALTER TABLE "users" ADD COLUMN "medication_list_layout_json" JSONB;
|
||||
@@ -137,6 +137,14 @@ model User {
|
||||
// the user has explicitly saved a layout.
|
||||
// Shape: { "tiles": [{ "id": "blutdruck", "visible": true, "order": 0 }, ...], "version": 1 }
|
||||
insightsLayoutJson Json? @map("insights_layout_json")
|
||||
// Per-user medications list presentation — the card/table view choice
|
||||
// plus the user-defined manual medication order shared by BOTH views.
|
||||
// Follows the per-surface-column convention of `dashboardWidgetsJson` /
|
||||
// `insightsLayoutJson`. Null = defaults (cards, alphabetical order).
|
||||
// The GET endpoint never lazy-writes — the column only carries data
|
||||
// once the user has explicitly toggled the view or saved an order.
|
||||
// Shape: { "version": 1, "view": "table", "order": ["<medicationId>", ...] }
|
||||
medicationListLayoutJson Json? @map("medication_list_layout_json")
|
||||
// Blood-glucose display unit preference. Canonical storage is mg/dL.
|
||||
glucoseUnit String? @map("glucose_unit") // "mg/dL" | "mmol/L" | null = default "mg/dL"
|
||||
// v1.7.0 unit pref — global metric/imperial display preference.
|
||||
|
||||
Reference in new issue
Block a user