From f82fca224d91f0f1104ad8f1c7f159c152b2c9f1 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 17 May 2026 15:05:01 +0530 Subject: [PATCH] style(growth): collapsible WHO+Chart, collapsed view with icons, collapsible history MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - WHO card shows icons + values when collapsed (⚖️ 📏 ⭕) - Chart is collapsible inside expanded WHO view - History is collapsible with scroll for many records - Add formatAge to history items Co-Authored-By: Claude Sonnet 4.6 --- src/app/growth/page.tsx | 149 +++++++++++++++++++++------------------- 1 file changed, 80 insertions(+), 69 deletions(-) diff --git a/src/app/growth/page.tsx b/src/app/growth/page.tsx index 3680bf6..3e7d581 100644 --- a/src/app/growth/page.tsx +++ b/src/app/growth/page.tsx @@ -510,7 +510,30 @@ export default function GrowthPage() { - {/* WHO Standards Content - Collapsible */} + {/* When collapsed - Show recommended values with icons */} + {!showWhoStandards && ( +
+
+
standard.weight.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> +
⚖️
+
{standard.weight.p50} kg
+
{standard.weight.p3}-{standard.weight.p97}
+
+
standard.height.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> +
📏
+
{standard.height.p50} cm
+
{standard.height.p3}-{standard.height.p97}
+
+
standard.headCircumference.p85 ? "bg-amber-100 dark:bg-amber-900" : "bg-green-50 dark:bg-green-900"}`}> +
+
{standard.headCircumference.p50} cm
+
{standard.headCircumference.p3}-{standard.headCircumference.p97}
+
+
+
+ )} + + {/* When expanded - Show full details + chart */} {showWhoStandards && (
{/* Color-coded percentile zones legend */} @@ -573,33 +596,17 @@ export default function GrowthPage() {
)} - {/* Growth Chart - Inside collapsible card */} + {/* Growth Chart - Collapsible inside expanded view */} {chartData && growthData.length > 0 && (
-
-

Growth Chart

-
- - - -
-
- + + {showChart && }
)} @@ -685,51 +692,55 @@ export default function GrowthPage() { ) : ( - /* History List */ -
-

History

- {growthData.map((record: any, i: number) => ( -
-
-
- {new Date(record.measured_at).toLocaleDateString()} + /* History List - Collapsible */ +
+ + {showHistory && ( +
+ {growthData.map((record, i) => ( +
+
+
+ {new Date(record.measured_at).toLocaleDateString()} ({child ? formatAge(child.birthDate, record.measured_at) : ""}) +
+
+ {record.weight_kg && ( + ⚖️ {record.weight_kg}kg + )} + {record.height_cm && ( + 📏 {record.height_cm}cm + )} + {record.head_circumference_cm && ( + ⭕ {record.head_circumference_cm}cm + )} +
+
+
+ + +
-
- {record.weight_kg && ( -
- ⚖️ {record.weight_kg} kg -
- )} - {record.height_cm && ( -
- 📏 {record.height_cm} cm -
- )} - {record.head_circumference_cm && ( -
- ⭕ {record.head_circumference_cm} cm -
- )} -
-
-
- - -
+ ))}
- ))} + )}
)}