add cringe home message
This commit is contained in:
@@ -2,6 +2,48 @@ import {useAuth} from "../utils/AuthContext.tsx";
|
|||||||
import NoAccessPage from "../components/NoAccessPage.tsx";
|
import NoAccessPage from "../components/NoAccessPage.tsx";
|
||||||
import {Link} from "react-router-dom";
|
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<TimeOfDay, string[]> = {
|
||||||
|
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 Home = () => {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@@ -21,7 +63,7 @@ const Home = () => {
|
|||||||
<div className={"p-10 flex flex-row justify-between"}>
|
<div className={"p-10 flex flex-row justify-between"}>
|
||||||
<div>
|
<div>
|
||||||
<p className={"font-data text-faint-mono text-sm tracking-widest"}>{formatted.toLocaleUpperCase()}</p>
|
<p className={"font-data text-faint-mono text-sm tracking-widest"}>{formatted.toLocaleUpperCase()}</p>
|
||||||
<h1 className={"font-heading font text-5xl text-text-strong tracking-[-0.015em]"}>Good evening, {user.name.split(" ", 1)}</h1>
|
<h1 className={"font-heading font text-5xl text-text-strong tracking-[-0.015em]"}>{getGreetingSubtext(new Date())}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Link to={"/stream"}>
|
<Link to={"/stream"}>
|
||||||
|
|||||||
Reference in New Issue
Block a user