Fixed missing greeting when no custom messages present
This commit is contained in:
@@ -39,7 +39,7 @@ export function Homepage() {
|
||||
} = useCommonHooks();
|
||||
const [personal, setPersonal] = useState<PersonalData>();
|
||||
const [message, setMessage] = useState<Message>();
|
||||
const [displayedGreeting, setDisplayedGreeting] = useState('');
|
||||
const [displayedGreeting, setDisplayedGreeting] = useState<string | undefined>('');
|
||||
const [weatherModalOpened, { open: openWeatherModal, close: closeWeatherModal }] =
|
||||
useDisclosure(false);
|
||||
const dateOptions: Intl.DateTimeFormatOptions = !isMobile
|
||||
@@ -63,7 +63,7 @@ export function Homepage() {
|
||||
}
|
||||
}, [personalData, personalIsFetched]);
|
||||
useEffect(() => {
|
||||
if (message !== undefined && personal) {
|
||||
if (personal) {
|
||||
setDisplayedGreeting(() => {
|
||||
if (Math.floor(Math.random() * 100) > 10 || message === undefined) {
|
||||
switch (Math.floor(new Date().getHours() / 6)) {
|
||||
@@ -77,7 +77,7 @@ export function Homepage() {
|
||||
return `Good evening, ${personal?.firstName}!`;
|
||||
}
|
||||
}
|
||||
return message.message;
|
||||
return message?.message;
|
||||
});
|
||||
}
|
||||
}, [message, personal, isMessagesFetching]);
|
||||
|
||||
Reference in New Issue
Block a user