From d6929a58fcdd5accf49ce8fc5f15bd06716d290d Mon Sep 17 00:00:00 2001 From: Muhammad Izza Alfiansyah Date: Fri, 19 Apr 2024 20:46:20 +0700 Subject: [PATCH] fixed dashboard --- website/src/pages/Index.tsx | 44 +++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/website/src/pages/Index.tsx b/website/src/pages/Index.tsx index 3b1c829..7fcf720 100644 --- a/website/src/pages/Index.tsx +++ b/website/src/pages/Index.tsx @@ -1,4 +1,4 @@ -import { createSignal, onMount } from "solid-js"; +import { createSignal, onMount, Show } from "solid-js"; import BeakerIcon from "../icons/BeakerIcon"; import EyeDropperIcon from "../icons/EyeDropperIcon"; import { Chart, registerables } from "chart.js"; @@ -20,7 +20,7 @@ export default function () { .order("created_at", { ascending: false }) .limit(10); - if (data != null) { + if (data != null && data.length > 0) { const lastItem = data[0]; setSuhu(lastItem.suhu); @@ -117,24 +117,36 @@ export default function () { return (
-
-
-
belum matang
+ +
Data tidak terdeteksi
+
+
-
-
- -
{suhu()} °C
+ +
0 ? "" : "hidden")}> +
+
+
belum matang
-
- -
{kelembaban()} %
+
+
+ +
{suhu()} °C
+
+
+ +
{kelembaban()} %
+
-
-
-
Grafik Kadar Gas
- +
+
Grafik Kadar Gas
+ +
);