From bb68711a482273fc2cf62bbca1c0838a666e2744 Mon Sep 17 00:00:00 2001 From: rift <117926989+Riftriot@users.noreply.github.com> Date: Sun, 10 Dec 2023 19:44:18 -0600 Subject: [PATCH] this timer is stupud im not doing it --- src/components/Clock.tsx | 54 --------------------------------------- src/components/Header.tsx | 10 +++----- 2 files changed, 3 insertions(+), 61 deletions(-) delete mode 100644 src/components/Clock.tsx diff --git a/src/components/Clock.tsx b/src/components/Clock.tsx deleted file mode 100644 index c285152..0000000 --- a/src/components/Clock.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { useState, useEffect } from "preact/hooks"; - -const CurrentTime = () => { - const [currentTime, setCurrentTime] = useState(''); - const [currentMinutes, setCurrentMinutes] = useState(''); - const [opacity, setOpacity] = useState(0); - - useEffect(() => { // LITERAL HELL - const updateCurrentTime = () => { - const now = new Date(); - const dayOfWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][now.getDay()]; - let hours = now.getHours(); - hours = hours % 12 || 12; // 12 hour format - const minutes = now.getMinutes(); - - const formattedTime = `${dayOfWeek}, ${hours < 10 ? '0' : ''}${hours}`; - setCurrentTime(formattedTime); - }; - - const updateCurrentMinutes = () => { - const now = new Date(); - const minutes = now.getMinutes(); - const formattedMinutes = `${minutes < 10 ? '0' : ''}${minutes}`; - setCurrentMinutes(formattedMinutes); - }; - - updateCurrentTime(); - updateCurrentMinutes(); - - const timeIntervalId = setInterval(updateCurrentTime, 60000); - const minutesIntervalId = setInterval(updateCurrentMinutes, 1000); - return () => { - clearInterval(timeIntervalId); - clearInterval(minutesIntervalId); - }; - }, []); - - useEffect(() => { - const intervalId = setInterval(() => { - setOpacity((prevOpacity) => (prevOpacity === 0 ? 1 : 0)); - }, 1000); - return () => clearInterval(intervalId); - }, []); - - return ( -
-
{currentTime}
-
:
-
{currentMinutes} PM
-
- ); - }; - - export default CurrentTime; \ No newline at end of file diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 957fbd2..2ebc128 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -2,21 +2,17 @@ import { useLocation } from "preact-iso"; import LinkSvg from "../assets/link.svg"; import LogoSvg from "../assets/logo.svg"; import { useState, useEffect } from "preact/hooks" -import Clock from "./Clock"; + export function Header() { const { url } = useLocation(); return (