-
Notifications
You must be signed in to change notification settings - Fork 874
feat: set icons for each type of notification #17115
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is no longer a hotfix.
- ✅ Base is main or release branch
- ✅ Has hotfix label
- ✅ Head is from coder/coder
- ❌ Less than 100 lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -61,6 +61,7 @@ export const Markdown: Story = { | |||
url: "https://dev.coder.com/workspaces?filter=template%3Acoder-with-ai", | |||
}, | |||
], | |||
icon: "DEFAULT_TEMPLATE_ICON", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BrunoQuaresma We changed the format to "DEFAULT_ICON_*".
}; | ||
|
||
export const InboxAvatar: FC<InboxAvatarProps> = ({ icon }) => { | ||
return <Avatar variant="icon">{inboxIcons[icon]}</Avatar>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make it future proof, so theoretically icon can be either a custom image link or "DEFAULT_ICON_*"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't have plans for that I would not add that. I really like to avoid adding code to handle scenarios were are not planned to happen any time soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is how backend is implemented, so when the notification icon has custom url, backend will return it. Frontend must be compliant here.
@mtojek I updated the codersdk types to better represent the logic and values. |
codersdk/inboxnotification.go
Outdated
Targets []uuid.UUID `json:"targets" format:"uuid"` | ||
Title string `json:"title"` | ||
Content string `json:"content"` | ||
Icon InboxNotificationFallbackIcon `json:"icon"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the idea behind - and love it. Unfortunately due to the fact that it can be a value different from the const list defined - I am not sure we want to keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you're right! I missed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverting the enums....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative option could be introducing a second property IconPath
. Then, Icon
can be used for default/fallback icons, and IconPath
for custom src.
We can think about it in a follow up, not sure if this will make the API clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much, Bruno!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good for backend ! ✅
/cherry-pick release/2.21 |
Each notification type will have an icon to represent the context:
This depends on #17013