diff --git a/src/barchart/barchart.html b/src/barchart/barchart.html index 5d696c9..7ac768d 100644 --- a/src/barchart/barchart.html +++ b/src/barchart/barchart.html @@ -4,7 +4,7 @@ BMI History Tracker - + diff --git a/src/barchart/script.js b/src/barchart/script.js index 23efb32..f6800de 100644 --- a/src/barchart/script.js +++ b/src/barchart/script.js @@ -1,7 +1,7 @@ const ctx = document.getElementById("bmiChart"); const bmiData = JSON.parse(localStorage.getItem("bmiData")) || []; -function getBMIColor(bmi) { +function getBMIColour(bmi) { if (bmi < 18.5) return "#74c0fc"; // Underweight if (bmi < 25) return "#51cf66"; // Normal if (bmi < 30) return "#ffa94d"; // Overweight @@ -43,4 +43,19 @@ const bmiChart = new Chart(ctx, { }, }, }, +}); + +const duplicateChart = new Chart(ctx, { + type: "bar", + data: { + labels: bmiData?.map((e) => e.timestamp), + datasets: [ + { + label: "BMI Duplicate", + data: bmiData.map((e) => e.bmi), + backgroundColor: bmiData.map((e) => getBMIColour(e.bmi)), + borderRadius: 6, + }, + ], + }, }); \ No newline at end of file diff --git a/src/dashboard/dashboard.css b/src/dashboard/dashboard.css index 47f2ee4..a784d7e 100644 --- a/src/dashboard/dashboard.css +++ b/src/dashboard/dashboard.css @@ -8,7 +8,10 @@ body { background: #fdfdfd; } -/* Layout helpers */ +body { + background: #000; +} + .box { background: #fff; border: 2px solid #333; @@ -20,6 +23,10 @@ body { height: 600px; } +.box-chart { + height: 400px; +} + .page-title { padding: 10px 14px; text-align: center; @@ -60,7 +67,6 @@ body { background: #f2f2f2; } -/* Placeholders */ .ph { background: #f1f1f1; border: 2px solid #999; @@ -83,7 +89,6 @@ body { height: 936px; } -/* Embedded pages (iframes) */ .embed-title { font-weight: 600; margin-bottom: 10px; @@ -93,13 +98,13 @@ body { .embed-box { border: 2px solid #999; background: #f9f9f9; - height: 320px; /* Controls visible height of embedded page */ + height: 320px; / } .embed-frame { width: 100%; height: 100%; - border: 0; /* No iframe border */ + border: 0; /* display: block; } diff --git a/src/dashboard/dashboard.html b/src/dashboard/dashboard.html index b5abd1b..cc68dd9 100644 --- a/src/dashboard/dashboard.html +++ b/src/dashboard/dashboard.html @@ -1,4 +1,4 @@ - + @@ -20,7 +19,6 @@
Line Chart
- @@ -31,6 +29,14 @@
+
+
+
Bar Chart Duplicate
+ +
+
+
Tables
@@ -40,4 +46,12 @@ loading="lazy">
+ +
+
+
Tables Copy
+ +
+
\ No newline at end of file diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js index d84f6a1..4e8b8b0 100644 --- a/src/dashboard/dashboard.js +++ b/src/dashboard/dashboard.js @@ -12,6 +12,12 @@ const SIDEBAR_ID = "sidebarNav"; const loadedScripts = new Set(); +const routes = { + dashboard: "./dashboard/dashboard.html", + formular: "./formular/formular.html", + tables: "./tables/tables.html", +}; + /* ========================================================= Routing ========================================================= */ @@ -25,6 +31,12 @@ function getRouteFile(route) { return ROUTES[route]; } +// Duplicate function with slight change +function getCurrentRouteDuplicate() { + const hash = location.hash.replace("#", "").trim(); + return routes[hash] ? hash : DEFAULT_ROUTE; // uses routes instead of ROUTES +} + /* ========================================================= Path Utilities ========================================================= */ diff --git a/src/data/mock.json b/src/data/mock.json index 6182050..8485d0f 100644 --- a/src/data/mock.json +++ b/src/data/mock.json @@ -19,6 +19,11 @@ "weight": 76, "height": 180 } + { + "date": "2025-10-15", + "weight": 78, + "height": 180 + } ] } } diff --git a/src/formular/formular.html b/src/formular/formular.html index a0dc016..7014633 100644 --- a/src/formular/formular.html +++ b/src/formular/formular.html @@ -13,7 +13,7 @@

BMI Formular

- + @@ -22,6 +22,7 @@

BMI Formular

+