From d691fd57704a99094b3ff8b8b724aa3222dcb1b5 Mon Sep 17 00:00:00 2001 From: Muhammad Izza Alfiansyah Date: Sat, 11 May 2024 09:41:32 +0700 Subject: [PATCH] add toggle sidebar website --- website/src/App.tsx | 19 +++++++++++++++++-- website/src/icons/BarsIcon.tsx | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 website/src/icons/BarsIcon.tsx diff --git a/website/src/App.tsx b/website/src/App.tsx index 2c351b8..c5526d0 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -7,6 +7,7 @@ import ClockIcon from "./icons/ClockIcon"; import supabase from "./utils/supabase"; import { Histori } from "./types/Histori"; import { Pengaturan } from "./types/Pengaturan"; +import BarsIcon from "./icons/BarsIcon"; export default function (props: JSX.HTMLAttributes) { const menus = [ @@ -34,6 +35,7 @@ export default function (props: JSX.HTMLAttributes) { const [lastHistori, setLastHistori] = createSignal(null); const [canNavigate, setCanNavigate] = createSignal(false); + const [showSidebar, setShowSidebar] = createSignal(false); const location = useLocation(); const navigate = useNavigate(); @@ -100,7 +102,9 @@ export default function (props: JSX.HTMLAttributes) { .limit(1); if (lastHistori()?.selesai != false) { - if (lastData1![0].created_time == lastData2![0].created_time) { + if (lastData1![0] == lastData2![0]) { + alert("Device offline!"); + } else if (lastData1![0].created_time == lastData2![0].created_time) { alert("Device offline!"); } } @@ -123,6 +127,10 @@ export default function (props: JSX.HTMLAttributes) { } }; + const toggleSidebar = () => { + setShowSidebar(!showSidebar()); + }; + onMount(async () => { await checkPengaturan(); await getLastHistori(); @@ -132,6 +140,9 @@ export default function (props: JSX.HTMLAttributes) { return (
-