From 8a85570704f88434d5c15f723c6367f7e4b40a23 Mon Sep 17 00:00:00 2001 From: Tim van Oostrom Date: Sun, 19 Jan 2025 11:35:29 +0100 Subject: [PATCH] Add some logic to welcome --- src/client/pages/Dashboard/WelcomHeading.tsx | 33 +++++++++++++++++-- .../Dashboard/WelcomeHeading.module.scss | 3 ++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/client/pages/Dashboard/WelcomHeading.tsx b/src/client/pages/Dashboard/WelcomHeading.tsx index 20573ae92b..10641618a9 100644 --- a/src/client/pages/Dashboard/WelcomHeading.tsx +++ b/src/client/pages/Dashboard/WelcomHeading.tsx @@ -1,13 +1,42 @@ +import styles from './WelcomeHeading.module.scss'; import { ProfileName } from '../../components/MainHeader/ProfileName'; import { PageHeadingV2 } from '../../components/PageHeading/PageHeadingV2'; const HELLO = 'Welkom,'; +const NOON = 12; +const EVENING = 18; +const NIGHT = 5; export function WelcomeHeading() { + const hours = new Date().getHours(); + const isMorning = hours < NOON && hours >= NIGHT; + const isEvening = hours >= EVENING; + const isNight = hours < NIGHT; + const isAfternoon = hours >= NOON && hours < EVENING; + + let hello = HELLO; + + switch (true) { + case isMorning: + hello = 'Goedemorgen,'; + break; + case isAfternoon: + hello = 'Goedemiddag,'; + break; + case isEvening: + hello = 'Goedenavond,'; + break; + case isNight: + hello = 'Goedenacht,'; + break; + } + return ( - {HELLO} -
+ {hello}{' '} + + +
); } diff --git a/src/client/pages/Dashboard/WelcomeHeading.module.scss b/src/client/pages/Dashboard/WelcomeHeading.module.scss index e69de29bb2..480c262363 100644 --- a/src/client/pages/Dashboard/WelcomeHeading.module.scss +++ b/src/client/pages/Dashboard/WelcomeHeading.module.scss @@ -0,0 +1,3 @@ +.ProfileNameWrap { + white-space: nowrap; +}