Skip to content

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

Merged
merged 9 commits into from
Mar 31, 2025
Merged

Conversation

BrunoQuaresma
Copy link
Collaborator

Each notification type will have an icon to represent the context:

Screenshot 2025-03-26 at 13 44 35

This depends on #17013

@BrunoQuaresma BrunoQuaresma requested review from defelmnq and a team March 26, 2025 16:46
@BrunoQuaresma BrunoQuaresma self-assigned this Mar 26, 2025
@BrunoQuaresma BrunoQuaresma requested review from brettkolodny and removed request for a team March 26, 2025 16:46
@BrunoQuaresma BrunoQuaresma added the hotfix PRs only. Harmless small change. Only humans may set this. label Mar 26, 2025
cdr-bot[bot]
cdr-bot bot previously approved these changes Mar 26, 2025
Copy link

@cdr-bot cdr-bot bot left a 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

@BrunoQuaresma BrunoQuaresma removed the request for review from brettkolodny March 26, 2025 16:47
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

@defelmnq merged the backend side here. Please rebase this PR to verify if icons are rendered correctly.

@@ -61,6 +61,7 @@ export const Markdown: Story = {
url: "https://dev.coder.com/workspaces?filter=template%3Acoder-with-ai",
},
],
icon: "DEFAULT_TEMPLATE_ICON",
Copy link
Member

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>;
Copy link
Member

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_*"

Copy link
Collaborator Author

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.

Copy link
Member

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.

@cdr-bot cdr-bot bot dismissed their stale review March 28, 2025 19:30

This PR is no longer a hotfix.

@BrunoQuaresma
Copy link
Collaborator Author

@mtojek I updated the codersdk types to better represent the logic and values.

@BrunoQuaresma BrunoQuaresma requested a review from mtojek March 28, 2025 19:34
Targets []uuid.UUID `json:"targets" format:"uuid"`
Title string `json:"title"`
Content string `json:"content"`
Icon InboxNotificationFallbackIcon `json:"icon"`
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Reverting the enums....

Copy link
Member

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.

Copy link
Member

@mtojek mtojek left a 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!

Copy link
Contributor

@defelmnq defelmnq left a 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 ! ✅

@BrunoQuaresma BrunoQuaresma merged commit 489641d into main Mar 31, 2025
33 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/notification-icons branch March 31, 2025 12:40
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2025
@coder coder deleted a comment from BrunoQuaresma Mar 31, 2025
@matifali
Copy link
Member

/cherry-pick release/2.21

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hotfix PRs only. Harmless small change. Only humans may set this.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants