diff --git a/website/src/App.tsx b/website/src/App.tsx index ae8f421..ca3d971 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -9,6 +9,7 @@ import { Histori } from "./types/Histori"; import { Pengaturan } from "./types/Pengaturan"; import BarsIcon from "./icons/BarsIcon"; import AdjusmentIcon from "./icons/AdjusmentIcon"; +import BellAlert from "./icons/BellAlert"; export default function (props: JSX.HTMLAttributes) { const menus = [ @@ -52,7 +53,6 @@ export default function (props: JSX.HTMLAttributes) { .from("histori_fermentasi") .select("*") .limit(1) - .eq("selesai", false) .order("created_at", { ascending: false }); if (!!data) { @@ -60,8 +60,8 @@ export default function (props: JSX.HTMLAttributes) { } }; - const deleteAllData = async () => { - await supabase.from("pengaturan").update({ running: false }).eq("id", 1); + const fermentasiSelesai = async () => { + // await supabase.from("pengaturan").update({ running: false }).eq("id", 1); await supabase.from("kondisi_tapai").delete().neq("id", "0"); await supabase .from("realtime_data") @@ -74,9 +74,6 @@ export default function (props: JSX.HTMLAttributes) { .eq("id", 1); setLastHistori(null); - - window.alert("Aksi berhasil dilakukan"); - window.location.reload(); }; const saveHistori = async () => { @@ -94,7 +91,7 @@ export default function (props: JSX.HTMLAttributes) { }) .eq("id", lastHistori()?.id); - await deleteAllData(); + await fermentasiSelesai(); }; const noSaveHistori = async () => { @@ -103,7 +100,7 @@ export default function (props: JSX.HTMLAttributes) { .delete() .eq("id", lastHistori()?.id); - await deleteAllData(); + await fermentasiSelesai(); }; const checkStatusDevice = async () => { @@ -142,13 +139,11 @@ export default function (props: JSX.HTMLAttributes) { // .order("created_time", { ascending: false }) // .limit(1); - if (lastData1![0] == lastData2![0]) { - alert("Device offline!"); - } else if (lastData1![0].created_time == lastData2![0].created_time) { - alert("Device offline!"); - } - - await checkStatusDevice(); + // if (lastData1![0] == lastData2![0]) { + // alert("Device offline!"); + // } else if (lastData1![0].created_time == lastData2![0].created_time) { + // alert("Device offline!"); + // } } }; @@ -165,10 +160,16 @@ export default function (props: JSX.HTMLAttributes) { } else { setCanNavigate(true); await checkStatusDevice(); + await checkPengaturan(); } } }; + const turnOffBuzzer = async () => { + await supabase.from("pengaturan").update({ buzzer_on: false }).eq("id", 1); + await checkPengaturan(); + }; + const toggleSidebar = () => { setShowSidebar(!showSidebar()); }; @@ -186,9 +187,11 @@ export default function (props: JSX.HTMLAttributes) {
Fermonitor
- - - +
+ + + +
) {
- -
+ + ); } diff --git a/website/src/icons/BellAlert.tsx b/website/src/icons/BellAlert.tsx new file mode 100644 index 0000000..1ffb0bc --- /dev/null +++ b/website/src/icons/BellAlert.tsx @@ -0,0 +1,21 @@ +import IconProps from "./type"; + +export default function (props: IconProps) { + return ( + + + + ); +} diff --git a/website/src/icons/BellSnooze.tsx b/website/src/icons/BellSnooze.tsx new file mode 100644 index 0000000..7e04a63 --- /dev/null +++ b/website/src/icons/BellSnooze.tsx @@ -0,0 +1,21 @@ +import IconProps from "./type"; + +export default function (props: IconProps) { + return ( + + + + ); +} diff --git a/website/src/index.css b/website/src/index.css index d6275ab..8384b31 100644 --- a/website/src/index.css +++ b/website/src/index.css @@ -10,4 +10,16 @@ .input { @apply border border-gray-200 rounded h-12 w-full block transition outline-none px-3; +} + +.animate-wiggle { + animation: wiggle .35s infinite alternate-reverse; +} + +@keyframes wiggle { + 0% { transform: rotate(0deg); } + 25% { transform: rotate(20deg); } + 50% { transform: rotate(0eg); } + 75% { transform: rotate(-20deg); } + 100% { transform: rotate(0deg); } } \ No newline at end of file diff --git a/website/src/types/Pengaturan.ts b/website/src/types/Pengaturan.ts index 631ccad..e9d7e83 100644 --- a/website/src/types/Pengaturan.ts +++ b/website/src/types/Pengaturan.ts @@ -9,4 +9,5 @@ export interface Pengaturan { fan_on: boolean; lamp_on: boolean; buzzer_timer: number; + buzzer_on: boolean; } \ No newline at end of file