Skip to content

feat: Global: Notification Alert Revamp #2555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 30, 2024
Merged

Conversation

glespinosa
Copy link
Contributor

@glespinosa glespinosa commented Feb 16, 2024

Will close #2176

Resolved issues:

  • new revamp design of notifcation
  • stacking of notification (note the order of the notification is the bottom is always the latest) there's no currently functionality that will reverse that order in notistack
  • top center positioning of notification
  • there's a secondary type notification if the other properties will be available

image
image

screencast-8-aaeffee09b-7w6v22.manager.dev.zesty.io_8080-2024.02.16-10_04_07.webm

@glespinosa glespinosa self-assigned this Feb 16, 2024
@glespinosa glespinosa changed the title revamp alert notification feat: Global: Notification Alert Revamp Feb 16, 2024
@glespinosa glespinosa marked this pull request as ready for review February 19, 2024 23:35
@agalin920
Copy link
Contributor

agalin920 commented Feb 20, 2024

@zcolah are we really going with stacking snack bars? Just making sure you are aware that strictly goes against the material design guidelines.

Copy link
Contributor

@agalin920 agalin920 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@@ -33,10 +48,49 @@ export default connect((state) => {
setDrawerOpen(false);
});

const alertDetails = (kind) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be converted into a map and moved outside of the component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is now moved outside of a component

"& .MuiAlert-icon, .MuiAlert-message, .MuiAlert-action ": {
color: "#fff",
},
"& .MuiAlert-action": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes should be done at the theme level

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do these changes one off for this component for now? Just thinking if this will affect on other part of website that are using Alert Component..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the expected process unless Zosh specifically asks otherwise

severity,
icon,
bgColor,
});
// On every render set timeout to hide notices
const token = setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this still needed/how does this interact with the autoHideDuration={8000} prop passed to the snackBarProvider?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It interacts in SnackbarProvider by passing this custom component prop
Components={{ custom: CustomNotification }}
With the use of these props I can get their value in CustomNotification Component which needs those values to display the data in a snackbar and by using the enqueSnackbar it connects to the Provider. Hope that answers the questions.

@zcolah
Copy link

zcolah commented Feb 20, 2024

@zcolah are we really going with stacking snack bars? Just making sure you are aware that strictly goes against the material design guidelines.

@agalin920 You are correct that Material UI guidelines state that the "snackbar" should appear one at a time. They also do state they should be at the bottom center. However showing one toast at a time can lead to a scenario where a user does not immediately see an error message since the previous snackbar is still being shown.

Hence we have instead decided to take the approach the Github Primer system is taking: https://primer.style/components/toast

Also you can see this discussion thread created to discuss this change: https://zesty-io.slack.com/archives/C03TKNN7XRN/p1704812236712669

maxWidth: "516px",
whiteSpace: props.severity === "success" ? "nowrap" : "normal",
overflow: "hidden",
textOverflow: "ellipsis",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typography has a noWrap prop that does this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done using noWrap prop on typography

@zcolah
Copy link

zcolah commented Feb 21, 2024

Note: This project cannot deploy until we improve the microcopy for the alerts.
For us to improve the microcopy we need to complete the following issue first: #2416

So please mark this as blocked.

@glespinosa glespinosa marked this pull request as draft February 22, 2024 04:18
@agalin920
Copy link
Contributor

agalin920 commented Feb 28, 2024

Note: This project cannot deploy until we improve the microcopy for the alerts. For us to improve the microcopy we need to complete the following issue first: #2416

So please mark this as blocked.

I would NOT want this to be in the same body of work just fyi. I also don't see how this blocks this current ticket.

@agalin920
Copy link
Contributor

agalin920 commented Feb 28, 2024

@zcolah are we really going with stacking snack bars? Just making sure you are aware that strictly goes against the material design guidelines.

@agalin920 You are correct that Material UI guidelines state that the "snackbar" should appear one at a time. They also do state they should be at the bottom center. However showing one toast at a time can lead to a scenario where a user does not immediately see an error message since the previous snackbar is still being shown.

Hence we have instead decided to take the approach the Github Primer system is taking: https://primer.style/components/toast

Also you can see this discussion thread created to discuss this change: https://zesty-io.slack.com/archives/C03TKNN7XRN/p1704812236712669

I disagree with us taking the approach of a completely different design system that we have not been abiding to. If you have specific product needs for it thats fine but I don't expect the justification to be in another design system

@zcolah
Copy link

zcolah commented Feb 28, 2024 via email

@shrunyan shrunyan changed the base branch from master to dev March 25, 2024 19:20
@glespinosa glespinosa marked this pull request as ready for review April 30, 2024 06:13
@zcolah
Copy link

zcolah commented May 6, 2024

What is the status of this coming into Beta?

@glespinosa glespinosa linked an issue May 6, 2024 that may be closed by this pull request
@shrunyan shrunyan enabled auto-merge (squash) May 6, 2024 23:39
@glespinosa glespinosa removed the blocked label May 6, 2024
@glespinosa glespinosa added the ready PR is complete and ready for deployment label May 6, 2024
@@ -76,6 +76,7 @@
"lodash": "^4.17.20",
"moment-timezone": "^0.5.33",
"monaco-editor": "^0.25.2",
"notistack": "^3.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much file size does this add to our bundle?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

24.3 kB minified, 8.4kb minified + gzipped

@glespinosa glespinosa requested review from agalin920 and shrunyan May 7, 2024 10:42
Copy link
Contributor

@agalin920 agalin920 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove all the commented code?

})
);
}
} else {
props.dispatch(
notify({
kind: "warn",
message: `API failed to return data ${res.status}`,
message: `API failed to return data.Try Again.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after period

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done fixing.

})
);
}
} else {
props.dispatch(
notify({
kind: "warn",
message: `API failed to return response when searching for ${parentZUID}`,
heading: `"Cannot Save: [${props.metaTitle}]`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this message hold the metaTitle in brackets but others don't. Shouldn't we be consistent?

Copy link
Contributor Author

@glespinosa glespinosa May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad on that one, i didn't see that it has [ ]. I removed that now also

"& .MuiAlert-icon, .MuiAlert-message, .MuiAlert-action ": {
color: "#fff",
},
"& .MuiAlert-action": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the expected process unless Zosh specifically asks otherwise

},
padding: "8px 12px",
borderRadius: "8px",
bgcolor: props.bgColor,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bgColor should be applied by the severity not custom applied. Is there a reason we are doing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed now also the bgColor i moved it in the theme level. but the reason why i use a bgcolor because the background that variant filled, severity success and other severities are not using the colors that i wanted.

pl: 2,
mr: 0,
},
padding: "8px 12px",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned lots of custom css on this. We should move this all to the theme

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the styling now in theme for your review also @agalin920
zesty-io/material#99

Thank you

key={i}
className={cx(styles.Notification, styles.bodyText)}
>
<p className={styles.Message}>
Copy link
Contributor

@finnar-bin finnar-bin May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to convert the elements in this component to MUI components instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I update this to MUI Components it will update also the designs cause its using old design. If that won't be an issue I can proceed to update it?

- remove [ ] characters in between of text
- remove setting bgColor, it will now depend on severity base on the theme change
@glespinosa glespinosa requested review from agalin920 and finnar-bin May 9, 2024 22:13
useSnackbar,
} from "notistack";

const alertDetails = (kind) => {
Copy link
Contributor

@agalin920 agalin920 May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A static object seems like a better solution for this use case

const alertDetails = {
'warn': {
icon: ...
severity: ...
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agalin920 done updating to it to static object

message = "Please Add Display Name";
heading = "Cannot Create Model";
// @ts-ignore
} else if (error?.data?.error.includes("name is already in use")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this. Would prefer BE messaging changes. But approving

agalin920
agalin920 previously approved these changes May 17, 2024
@glespinosa glespinosa requested a review from agalin920 May 22, 2024 21:55
@glespinosa
Copy link
Contributor Author

@agalin920 for your review regarding the fix on test suite. thank you

@shrunyan shrunyan merged commit ba9f951 into dev May 30, 2024
1 check passed
@shrunyan shrunyan deleted the feat/revamp-alert-notification branch May 30, 2024 23:44
shrunyan added a commit that referenced this pull request May 31, 2024
Will close #2176

Resolved issues:
- [x] new revamp design of notifcation
- [x] stacking of notification (note the order of the notification is
the bottom is always the latest) there's no currently functionality that
will reverse that order in notistack
- [x] top center positioning of notification
- [x] there's a secondary type notification if the other properties will
be available


![image](https://github.com/zesty-io/manager-ui/assets/44116036/85b12c3f-c130-4e86-bac3-976c1e054ecd)

![image](https://github.com/zesty-io/manager-ui/assets/44116036/bf0b8c65-40b1-4302-8072-a36de3c03988)


[screencast-8-aaeffee09b-7w6v22.manager.dev.zesty.io_8080-2024.02.16-10_04_07.webm](https://github.com/zesty-io/manager-ui/assets/44116036/68ce2563-a155-4749-bc03-fcaa93a8331d)

---------

Co-authored-by: Stuart Runyan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PR is complete and ready for deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content: Improved Microcopy for Notifications Global: Notification Alert Revamp
5 participants