mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
feat(symptoms): log a symptom in one step and show it on the illness pages
- A new capture kind "symptom" (illness module, illness write grant) in the bottom bar's picker and the dashboard Add menu. The sheet follows the measurement and mood forms: the person's symptoms as chips with the cycle sheet's dashed "new symptom" chip, the 0-10 slider with its anchors, the time prefilled with now, an optional note, and a "during" selector only while an illness episode is open. - "Your symptoms" on the illness page: one line per symptom (how often in 30 days, how strong at worst, when last), the last 30 days grouped by day, edit and delete per entry, rename, icon, hide and delete per symptom. Renders nothing until a symptom exists. - "Symptoms logged" on an episode's page: the entries filed against it or logged while it ran, the filed ones marked. This is the reader of the episode link. - Query keys live under the illness root, so either side's writes refresh both.
This commit is contained in:
1 parent
9d9e1f153c
commit
9272daa59c
17 files changed
+1940
-19
No files matched your search
@@ -153,7 +153,8 @@ describe("<DashboardHeader> — every entry follows its module, as the capture p
|
||||
{ mood: false },
|
||||
{ medications: false },
|
||||
{ workouts: false },
|
||||
{ mood: false, medications: false, workouts: false },
|
||||
{ illness: false },
|
||||
{ mood: false, medications: false, workouts: false, illness: false },
|
||||
];
|
||||
for (const modules of cases) {
|
||||
modulesRef.value = modules;
|
||||
@@ -170,6 +171,7 @@ describe("<DashboardHeader> — every entry follows its module, as the capture p
|
||||
measurement: "Log measurement",
|
||||
medication: "Log medication intake",
|
||||
mood: "Log mood",
|
||||
symptom: "Log symptom",
|
||||
workout: "Log workout",
|
||||
} as const;
|
||||
for (const kind of CAPTURE_KIND_ORDER) {
|
||||
|
||||
@@ -12,7 +12,15 @@
|
||||
*/
|
||||
import { useMemo } from "react";
|
||||
import Link from "next/link";
|
||||
import { Activity, Footprints, Pill, Plus, Waves, Wrench } from "lucide-react";
|
||||
import {
|
||||
Activity,
|
||||
Footprints,
|
||||
Pill,
|
||||
Plus,
|
||||
Stethoscope,
|
||||
Waves,
|
||||
Wrench,
|
||||
} from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -62,6 +70,7 @@ export function DashboardHeader({
|
||||
const canAddMeasurement = offered.includes("measurement");
|
||||
const canAddIntake = offered.includes("medication");
|
||||
const canAddMood = offered.includes("mood");
|
||||
const canAddSymptom = offered.includes("symptom");
|
||||
const canAddWorkout = offered.includes("workout");
|
||||
const canAddAnything = offered.length > 0;
|
||||
|
||||
@@ -198,6 +207,12 @@ export function DashboardHeader({
|
||||
{t("dashboard.quickAddMedicationIntake")}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{canAddSymptom && (
|
||||
<DropdownMenuItem onClick={() => onQuickEntry("symptom")}>
|
||||
<Stethoscope className="mr-2 h-4 w-4" aria-hidden="true" />
|
||||
{t("dashboard.quickAddSymptom")}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{canAddWorkout && (
|
||||
<DropdownMenuItem onClick={() => onQuickEntry("workout")}>
|
||||
<Footprints className="mr-2 h-4 w-4" aria-hidden="true" />
|
||||
|
||||
@@ -25,6 +25,7 @@ import { MeasurementForm } from "@/components/measurements/measurement-form";
|
||||
import { MoodForm } from "@/components/mood/mood-form";
|
||||
import { MedicationIntakeQuickAdd } from "@/components/dashboard/medication-intake-quick-add";
|
||||
import { ManualWorkoutForm } from "@/components/workouts/manual-workout-form";
|
||||
import { SymptomEntryForm } from "@/components/symptoms/symptom-entry-form";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import {
|
||||
useRecordCapabilities,
|
||||
@@ -33,7 +34,7 @@ import {
|
||||
import type { ShareDomain } from "@/lib/sharing/scope";
|
||||
|
||||
export type QuickEntryDialog =
|
||||
"measurement" | "mood" | "medicationIntake" | "workout" | null;
|
||||
"measurement" | "mood" | "medicationIntake" | "symptom" | "workout" | null;
|
||||
|
||||
/**
|
||||
* The section each sheet writes to; see the capture picker. `null` marks a
|
||||
@@ -46,6 +47,7 @@ const QUICK_ENTRY_DOMAIN: Readonly<
|
||||
measurement: "measurements",
|
||||
medicationIntake: "medications",
|
||||
mood: "mind",
|
||||
symptom: "illness",
|
||||
workout: null,
|
||||
};
|
||||
|
||||
@@ -163,6 +165,9 @@ export function QuickEntrySheets({
|
||||
const [workoutFooterEl, setWorkoutFooterEl] = useState<HTMLDivElement | null>(
|
||||
null,
|
||||
);
|
||||
const [symptomFooterEl, setSymptomFooterEl] = useState<HTMLDivElement | null>(
|
||||
null,
|
||||
);
|
||||
// v1.11.3 F3 — when an open quick-entry sheet is dismissed with
|
||||
// unsaved input, hold the close in this flag and surface a confirm
|
||||
// instead of nulling the dialog outright. Cleared once the user
|
||||
@@ -226,6 +231,24 @@ export function QuickEntrySheets({
|
||||
/>
|
||||
</ResponsiveSheet>
|
||||
|
||||
{/* v1.40 — one occurrence of the person's own symptom. Mounted only
|
||||
while open, so every opening starts with "now" and nothing chosen. */}
|
||||
<ResponsiveSheet
|
||||
open={openSheet === "symptom"}
|
||||
onOpenChange={handleQuickEntryOpenChange}
|
||||
title={t("symptoms.entry.sheetTitle")}
|
||||
description={t("symptoms.entry.sheetDescription")}
|
||||
footer={<div ref={setSymptomFooterEl} className="flex w-full" />}
|
||||
>
|
||||
{openSheet === "symptom" && (
|
||||
<SymptomEntryForm
|
||||
onSuccess={onClose}
|
||||
onCancel={onClose}
|
||||
footerSlot={symptomFooterEl}
|
||||
/>
|
||||
)}
|
||||
</ResponsiveSheet>
|
||||
|
||||
{/* Log a workout by hand. Mounted only while open, so every opening
|
||||
is a fresh form with its own external id. */}
|
||||
<ResponsiveSheet
|
||||
|
||||
Reference in new issue
Block a user