diff --git a/src/App.tsx b/src/App.tsx index a8fd475..c267e4a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -14,7 +14,7 @@ const AppRoot = () => { const opacity = clamp(0.5 - (0.5 * brightness) / 100, 0, 0.5); - if (state === "off") { + if (state === "off" || state === "reboot" || state === "suspend") { return ; } diff --git a/src/components/Boot.tsx b/src/components/Boot.tsx index 1e6fa7a..ae0c6cb 100644 --- a/src/components/Boot.tsx +++ b/src/components/Boot.tsx @@ -22,7 +22,11 @@ export const Boot = () => { const timeout = setTimeout( () => setLine(line + 1), - Math.random() * 750 + 200, + line === 0 + ? 3500 + : line === LINES.length - 1 + ? 1200 + : Math.random() * 750 + 200, ); return () => clearTimeout(timeout); }, [setState, line]); diff --git a/src/components/Off.tsx b/src/components/Off.tsx index 7620671..044f60b 100644 --- a/src/components/Off.tsx +++ b/src/components/Off.tsx @@ -1,25 +1,31 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import { useApp } from "~/hooks/useApp"; export const Off = () => { - const { setState } = useApp(); - const [clicked, setClicked] = useState(false); + const { state, setState } = useApp(); + const [booting, setBooting] = useState(state === "reboot"); - const handleClick = () => { - setClicked(true); + useEffect(() => { + if (booting) { + const timout = setTimeout(() => { + if (state === "suspend") { + setState("login"); + } else { + setState("boot"); + } + }, 1000); - setTimeout(() => { - setState("boot"); - }, 1000); - }; + return () => clearTimeout(timout); + } + }, [booting]); return (