From 8e2c4bf902f6a683047b2dfcc9c4541e19840139 Mon Sep 17 00:00:00 2001 From: japhethLG Date: Sat, 3 Aug 2024 02:01:41 +0800 Subject: [PATCH] fix: Announcement is not reflecting the latest announcement --- .../accounts/dashboard/ui/ZInstancesContainer.js | 6 ++---- src/pages/login/index.js | 10 +++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/accounts/dashboard/ui/ZInstancesContainer.js b/src/components/accounts/dashboard/ui/ZInstancesContainer.js index 48f358685..63ec39ff3 100644 --- a/src/components/accounts/dashboard/ui/ZInstancesContainer.js +++ b/src/components/accounts/dashboard/ui/ZInstancesContainer.js @@ -12,11 +12,9 @@ const ZInstancesContainer = ({ }) => { const dayTime = () => { const hour = new Date().getHours(); - if (hour >= 5 && hour <= 12) return 'Good Morning, '; + if (hour >= 0 && hour <= 12) return 'Good Morning, '; else if (hour > 12 && hour <= 17) return 'Good Afternoon, '; - else if (hour > 17 && hour <= 21) return 'Good Evening, '; - else if ((hour > 21 && hour <= 23) || (hour >= 0 && hour <= 4)) - return 'Good Night, '; + else if (hour > 17 && hour <= 23) return 'Good Evening, '; }; return ( <> diff --git a/src/pages/login/index.js b/src/pages/login/index.js index 365518cd2..62d5cab91 100644 --- a/src/pages/login/index.js +++ b/src/pages/login/index.js @@ -15,7 +15,15 @@ const site = 'https://www.zesty.io'; const Login = (props) => { const router = useRouter(); - const content = props.data.data[0].content; + const content = + props.data.data + .sort( + (a, b) => + new Date(b.content.start_date_and_time) - + new Date(a.content.start_date_and_time), + ) + .map((item) => item.content)[0] || null; + const loginContent = props.loginData.data[0].content; const ogimage = content?.feature_image?.data[0]?.url;