Skip to content

Commit

Permalink
fix: Announcement is not reflecting the latest announcement (#2477)
Browse files Browse the repository at this point in the history
# Description

Add a sort logic for product announcements. Remove "Good Night" when the
user logs in at night.

Fixes #2476 [#250](zesty-io/accounts-ui#250)
## Type of change

Please delete options that are not relevant.

- [x] Bug fix (non-breaking change which fixes an issue)

# How Has This Been Tested?

- [x] Manual Test

# Screenshots / Screen recording

Please add screenshots or recording if applicable
Before:

![image](https://github.com/user-attachments/assets/ca977a94-786b-4219-9522-4ecddbbac870)

After:

![image](https://github.com/user-attachments/assets/a76aeac6-8961-4e56-9b16-bba34f2a968a)
  • Loading branch information
japhethLG authored Aug 5, 2024
1 parent 87e4da6 commit a95eaa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/components/accounts/dashboard/ui/ZInstancesContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
Expand Down
10 changes: 9 additions & 1 deletion src/pages/login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a95eaa5

Please sign in to comment.