Skip to content
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

[40147] Snackbar/toast informing users of new notifications has the wrong icon #14977

Conversation

bsatarnejad
Copy link
Contributor

@bsatarnejad bsatarnejad commented Mar 11, 2024

https://community.openproject.org/work_packages/40147/activity

  • Add a new toast type for notifications in notification center
  • add a period at the end of the toast text.

@bsatarnejad bsatarnejad marked this pull request as ready for review March 12, 2024 07:08
@bsatarnejad bsatarnejad requested a review from a team March 12, 2024 07:19
Copy link
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Although that works, I think the solution is a bit too much. It feels weird to introduce a new type because we want to change the icon. I don't want to add new types whenever I want a new icon on a toast. I left some comments, maybe there is a way around that.
Further, please rebase the branch to the dev branch.

@@ -57,6 +57,7 @@ $nm-pb-regress-color: whiteSmoke
$nm-pb-regress-fill-color: #00558b
$nm-pb-border-radius: rem-calc(6)
$nm-pb-height: rem-calc(20)
$nm-pb-background-color: #155282
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the name is a bit unfortunate, as pb stands for "progress" and this is not a progress toast.

@@ -204,6 +217,9 @@ $nm-upload-box-padding: rem-calc(15) rem-calc(25)
&.-info
color: $nm-color-info-icon

&.-notification
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that section really needed?

@@ -41,7 +41,7 @@ export function removeSuccessFlashMessages():void {
jQuery('.op-toast.-success').remove();
}

export type ToastType = 'success'|'error'|'warning'|'info'|'upload'|'loading';
export type ToastType = 'success'|'error'|'warning'|'info'|'upload'|'loading'|'notification';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the name is a bit overloaded. In our system, a notification is something different than a toast. In my eyes, it is kind of a bad style to introduce a whole new type, just to change the icon. Could you please check whether you can simply use the info type and pass an additional class to it, which overrides the icon?

@bsatarnejad bsatarnejad force-pushed the 40147-toast-informing-users-of-new-notifications-has-the-wrong-icon branch from 1d139d0 to f0c0538 Compare March 18, 2024 14:10
@bsatarnejad bsatarnejad changed the base branch from release/13.4 to dev March 18, 2024 14:11
Copy link

1 Warning
⚠️ This PR has migration-related changes on a release branch. Ping @opf/operations

Generated by 🚫 Danger

@bsatarnejad bsatarnejad force-pushed the 40147-toast-informing-users-of-new-notifications-has-the-wrong-icon branch from 1b14ddf to 1894812 Compare March 19, 2024 06:43
@bsatarnejad bsatarnejad requested a review from HDinger March 19, 2024 07:04
Copy link
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Please have a look at my comments. I think we can do it more clean to be also more useful for future use cases.

Comment on lines 177 to 181
&.-notification-icon
&::before
@include messages-icon
@extend %nm-icon-notification

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you are over complicating things here. By creating a specific -{{icon}}-icon class, you have to add a CSS rule for every possible icon that you want to pass. Further, the modifier for an icon should only change the icon itself and not the whole toast. Why don't you simply use the classes we already have to render icons?The -infoclass is still set on the toast, so there is no need for the syling if you adapt the rules above so thattoast-icon` also only affects the icon and not the styling.

@@ -72,6 +72,10 @@ $nm-upload-box-padding: rem-calc(15) rem-calc(25)
@include icon-mixin-checkmark
color: $nm-color-success-icon

%nm-icon-notification
@include icon-mixin-bell
color: $nm-pb-background-color
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a semantic mismatch here. It is kind of a bad style to use the variable for the progress toast for the notification toast as we cannot assure that these will always be of the same color. However, regarding my other ocmment, I think we can remove this whole block altogether.

@bsatarnejad bsatarnejad deleted the 40147-toast-informing-users-of-new-notifications-has-the-wrong-icon branch April 15, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants