From 38e18c12f357a8514b12ac10bfb7cd20d597fcaf Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 17 May 2026 14:54:00 +0530 Subject: [PATCH] style(growth): collapsible WHO+Chart card, form after latest - Merge WHO Standards and Chart into single collapsible card - Add +Add button shows form below Latest Reading - Collapsible sections with expand/collapse toggle Co-Authored-By: Claude Sonnet 4.6 --- src/app/growth/page.tsx | 203 +++++++++++++++++++++------------------- 1 file changed, 107 insertions(+), 96 deletions(-) diff --git a/src/app/growth/page.tsx b/src/app/growth/page.tsx index c3a42a7..87e5f78 100644 --- a/src/app/growth/page.tsx +++ b/src/app/growth/page.tsx @@ -66,6 +66,9 @@ export default function GrowthPage() { const [chartMetric, setChartMetric] = useState<"weight" | "height" | "head">("weight"); const [saving, setSaving] = useState(false); const [saveError, setSaveError] = useState(null); + const [showWhoStandards, setShowWhoStandards] = useState(true); + const [showChart, setShowChart] = useState(true); + const [showHistory, setShowHistory] = useState(true); // Goals state const [goal, setGoal] = useState({}); @@ -468,115 +471,123 @@ export default function GrowthPage() { )} - {/* WHO Standards Card - Enhanced with age-wise targets */} + {/* WHO Standards + Chart Card - Collapsible */} {child && standard && ( -
-
-
-
{child.name}
+
+ {/* WHO Standards Header - Clickable */} +
- - {/* Color-coded percentile zones legend */} -
- - - Normal - - - - Watch - - - - Alert - -
- -
-
standard.weight.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> -
Weight
-
{standard.weight.p50} kg
-
{standard.weight.p3}-{standard.weight.p97}
- {latest?.weight_kg && ( -
- {latest.weight_kg}kg ({weightPercentile}) -
+
+ {savedGoals.weightKg && ( +
Goal: {savedGoals.weightKg}kg
)} +
-
standard.height.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> -
Height
-
{standard.height.p50} cm
-
{standard.height.p3}-{standard.height.p97}
- {latest?.height_cm && ( -
- {latest.height_cm}cm ({heightPercentile}) -
- )} -
-
standard.headCircumference.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> -
Head
-
{standard.headCircumference.p50} cm
-
{standard.headCircumference.p3}-{standard.headCircumference.p97}
- {latest?.head_circumference_cm && ( -
- {latest.head_circumference_cm}cm ({headPercentile}) -
- )} -
-
+ - {/* Growth velocity indicator */} - {velocity && ( -
-
- Velocity: - - {velocity.weight} kg/month {velocity.direction === "up" ? "↑" : "↓"} + {/* WHO Standards Content - Collapsible */} + {showWhoStandards && ( +
+ {/* Color-coded percentile zones legend */} +
+ + + Normal + + + + Watch + + + + Alert
+ + {/* WHO Standards Cards */} +
+
standard.weight.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> +
Weight
+
{standard.weight.p50} kg
+
{standard.weight.p3}-{standard.weight.p97}
+ {latest?.weight_kg && ( +
+ {latest.weight_kg}kg ({weightPercentile}) +
+ )} +
+
standard.height.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> +
Height
+
{standard.height.p50} cm
+
{standard.height.p3}-{standard.height.p97}
+ {latest?.height_cm && ( +
+ {latest.height_cm}cm ({heightPercentile}) +
+ )} +
+
standard.headCircumference.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> +
Head
+
{standard.headCircumference.p50} cm
+
{standard.headCircumference.p3}-{standard.headCircumference.p97}
+ {latest?.head_circumference_cm && ( +
+ {latest.head_circumference_cm}cm ({headPercentile}) +
+ )} +
+
+ + {/* Growth velocity indicator */} + {velocity && ( +
+ Velocity: + + {velocity.weight} kg/month {velocity.direction === "up" ? "↑" : "↓"} + +
+ )} + + {/* Growth Chart - Inside collapsible card */} + {chartData && growthData.length > 0 && ( +
+
+

Growth Chart

+
+ + + +
+
+ +
+ )}
)}
)} - {/* Growth Chart */} - {chartData && growthData.length > 0 && ( -
-
-

Growth Chart

-
- - - -
-
- -
- )} - {/* Add/Edit Form */} {showAdd && (