mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
refactor(medications): split the dose-history ledger into its hook, row and dialogs
The ledger file held two components of 404 and 314 lines. It now reads: - dose-history/use-dose-history-ledger: the window read, summary, day groups and the optimistic mark, plus the owner's edits (toggle, pin, release, delete) and one reconcile step after every write - dose-history/ledger-row-item: the row and, apart from it, the owner's row menu - dose-history/ledger-summary-chart and ledger-confirms dose-history-ledger.tsx keeps the ledger layout. Markup and behaviour are unchanged; the guards name the modules that now hold what they check.
This commit is contained in:
1 parent
3eb5aa9364
commit
58215f3338
14 files changed
+1008
-849
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$comment": "Production files over 800 lines and their length. Maintained by src/__tests__/source-size-ratchet.test.ts.",
|
||||
"count": 118,
|
||||
"total": 136542,
|
||||
"count": 117,
|
||||
"total": 135490,
|
||||
"entries": {
|
||||
"app/api/dashboard/summary/route.ts": 1032,
|
||||
"app/api/documents/inbound/route.ts": 811,
|
||||
@@ -26,7 +26,6 @@
|
||||
"components/measurement-reminders/vorsorge-section.tsx": 1536,
|
||||
"components/measurements/measurement-form.tsx": 815,
|
||||
"components/medications/detail/medication-detail-tabs.tsx": 1160,
|
||||
"components/medications/dose-history-ledger.tsx": 1052,
|
||||
"components/medications/medication-table.tsx": 853,
|
||||
"components/medications/wizard/wizard-payload.ts": 1414,
|
||||
"components/mood/mood-list.tsx": 1408,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$comment": "Production functions over 200 lines, keyed \"file :: name\", and their length. Maintained by src/__tests__/source-size-ratchet.test.ts.",
|
||||
"count": 405,
|
||||
"total": 140305,
|
||||
"count": 403,
|
||||
"total": 139587,
|
||||
"entries": {
|
||||
"app/achievements/page.tsx :: AchievementsPage": 206,
|
||||
"app/api/admin/backups/upload/route.ts :: apiHandler(arg)": 314,
|
||||
@@ -183,8 +183,6 @@
|
||||
"components/medications/detail/efficacy/efficacy-chart.tsx :: EfficacyChart": 361,
|
||||
"components/medications/detail/medication-detail-tabs.tsx :: MedicationDetailTabs": 771,
|
||||
"components/medications/dose-history-add-dialog.tsx :: LedgerAddDialog": 223,
|
||||
"components/medications/dose-history-ledger.tsx :: DoseHistoryLedger": 404,
|
||||
"components/medications/dose-history-ledger.tsx :: LedgerRowItem": 314,
|
||||
"components/medications/dose-strength-curve.tsx :: DoseStrengthCurve": 266,
|
||||
"components/medications/glp1-medication-card.tsx :: Glp1MedicationCard": 405,
|
||||
"components/medications/injection-site-picker.tsx :: InjectionSitePicker": 287,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$comment": "Comment lines that open with a release version, per file under src/. Maintained by src/__tests__/version-stamp-ratchet.test.ts.",
|
||||
"count": 2950,
|
||||
"total": 10294,
|
||||
"count": 2949,
|
||||
"total": 10287,
|
||||
"entries": {
|
||||
"__tests__/account-payload-consumer-guard.test.ts": 2,
|
||||
"__tests__/acting-account-boundary-guard.test.ts": 7,
|
||||
@@ -1171,7 +1171,6 @@
|
||||
"components/medications/detail/medication-detail-tabs.tsx": 28,
|
||||
"components/medications/dose-history-add-dialog.tsx": 2,
|
||||
"components/medications/dose-history-ledger-compute.ts": 5,
|
||||
"components/medications/dose-history-ledger.tsx": 7,
|
||||
"components/medications/dose-strength-curve.tsx": 2,
|
||||
"components/medications/drug-level-chart.tsx": 2,
|
||||
"components/medications/glp1-medication-card.tsx": 36,
|
||||
|
||||
@@ -242,7 +242,7 @@ describe("daily-reads refetch guard", () => {
|
||||
expect(read(rel)).toMatch(/invalidateMedicationReads\(/);
|
||||
}
|
||||
const pairInPlace = [
|
||||
"components/medications/dose-history-ledger.tsx",
|
||||
"components/medications/dose-history/use-dose-history-ledger.ts",
|
||||
"components/medications/dose-history-add-dialog.tsx",
|
||||
];
|
||||
for (const rel of pairInPlace) {
|
||||
|
||||
@@ -252,7 +252,7 @@ const RAW_ALLOWLIST: ReadonlyArray<{ file: string; why: string }> = [
|
||||
why: "The `yyyy-MM-dd` key the ledger groups doses by. The heading a reader sees is rendered separately, through the preference-aware `formatDateWithWeekdaySmart`.",
|
||||
},
|
||||
{
|
||||
file: "src/components/medications/dose-history-ledger.tsx",
|
||||
file: "src/components/medications/dose-history/use-dose-history-ledger.ts",
|
||||
why: "The same key shape for `today`, compared against those buckets. A comparison, not a label.",
|
||||
},
|
||||
{
|
||||
|
||||
@@ -524,8 +524,9 @@ const REGISTRY: DestructiveEntry[] = [
|
||||
confirm: ["AlertDialog"],
|
||||
},
|
||||
{
|
||||
file: "components/medications/dose-history-ledger.tsx",
|
||||
file: "components/medications/dose-history/use-dose-history-ledger.ts",
|
||||
destroys: "one intake event",
|
||||
triggers: ["components/medications/dose-history/ledger-confirms.tsx"],
|
||||
recovery: "tombstoned-no-restore",
|
||||
confirm: ["AlertDialog"],
|
||||
},
|
||||
|
||||
@@ -151,7 +151,7 @@ describe("the intake confirmation is decided in one place", () => {
|
||||
expect(posting.length).toBeGreaterThan(2);
|
||||
for (const rel of [
|
||||
"components/medications/use-medication-intake.ts",
|
||||
"components/medications/dose-history-ledger.tsx",
|
||||
"components/medications/dose-history/use-dose-history-ledger.ts",
|
||||
"components/dashboard/medication-intake-quick-add.tsx",
|
||||
"components/medications/dose-history-add-dialog.tsx",
|
||||
]) {
|
||||
|
||||
@@ -248,8 +248,13 @@ const PINNED_AFFORDANCES: Record<
|
||||
"src/components/medications/dose-history-add-dialog.tsx": {
|
||||
"toast.success": 2,
|
||||
},
|
||||
"src/components/medications/dose-history-ledger.tsx": {
|
||||
"text-success": 2,
|
||||
"src/components/medications/dose-history/ledger-row-item.tsx": {
|
||||
"text-success": 1,
|
||||
},
|
||||
"src/components/medications/dose-history/ledger-summary-chart.tsx": {
|
||||
"text-success": 1,
|
||||
},
|
||||
"src/components/medications/dose-history/use-dose-history-ledger.ts": {
|
||||
"toast.success": 4,
|
||||
},
|
||||
"src/components/medications/intake-edit-dialog.tsx": { "toast.success": 1 },
|
||||
|
||||
Reference in new issue
Block a user