Skip to content

Commit

Permalink
Add some logic to welcome
Browse files Browse the repository at this point in the history
  • Loading branch information
timvanoostrom committed Jan 19, 2025
1 parent 9efddd1 commit 8a85570
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/client/pages/Dashboard/WelcomHeading.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<PageHeadingV2 showBacklink={false}>
{HELLO}
<br /> <ProfileName />
{hello}{' '}
<span className={styles.ProfileNameWrap}>
<ProfileName />
</span>
</PageHeadingV2>
);
}
3 changes: 3 additions & 0 deletions src/client/pages/Dashboard/WelcomeHeading.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.ProfileNameWrap {
white-space: nowrap;
}

0 comments on commit 8a85570

Please sign in to comment.