From 3c50d6aaf4886aeb92b05faf0fbc2a5fc6d48c94 Mon Sep 17 00:00:00 2001 From: Dylan De Faoite Date: Wed, 29 Jul 2026 21:28:34 +0100 Subject: [PATCH] add cringe home message --- frontend/src/pages/Home.tsx | 44 ++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index ee7959a..870cec6 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -2,6 +2,48 @@ import {useAuth} from "../utils/AuthContext.tsx"; import NoAccessPage from "../components/NoAccessPage.tsx"; import {Link} from "react-router-dom"; +type TimeOfDay = "morning" | "afternoon" | "evening" | "night"; + +function getTimeOfDay(date: Date = new Date()): TimeOfDay { + const hour = date.getHours(); + + if (hour >= 5 && hour < 12) return "morning"; + if (hour >= 12 && hour < 17) return "afternoon"; + if (hour >= 17 && hour < 22) return "evening"; + return "night"; +} + +function getGreetingSubtext(date: Date = new Date()): string { + const timeOfDay = getTimeOfDay(date); + + const messages: Record = { + morning: [ + "Good morning.", + "Coffee first, then clips.", + "Here's what's waiting for you.", + ], + afternoon: [ + "Good afternoon.", + "A quiet moment for your clips.", + "Catching up?", + ], + evening: [ + "Good evening.", + "Settle in.", + "Time to unwind.", + ], + night: [ + "Still up?", + "Quiet night for it.", + "Good night, when you're ready.", + ] + } + + const options = messages[timeOfDay]; + return options[Math.floor(Math.random() * options.length)]; +} + + const Home = () => { const { user } = useAuth(); const now = new Date(); @@ -21,7 +63,7 @@ const Home = () => {

{formatted.toLocaleUpperCase()}

-

Good evening, {user.name.split(" ", 1)}

+

{getGreetingSubtext(new Date())}