mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: set icons for each type of notification (#17115)
Each notification type will have an icon to represent the context: <img width="503" alt="Screenshot 2025-03-26 at 13 44 35" src="https://github.com/user-attachments/assets/1187c1c0-1043-4a32-b105-a7f91b52f8ca" /> This depends on https://github.com/coder/coder/pull/17013
This commit is contained in:
@ -31,30 +31,30 @@ const (
|
||||
|
||||
var fallbackIcons = map[uuid.UUID]string{
|
||||
// workspace related notifications
|
||||
notifications.TemplateWorkspaceCreated: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceManuallyUpdated: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceDeleted: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceAutobuildFailed: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceDormant: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceAutoUpdated: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceMarkedForDeletion: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceManualBuildFailed: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceOutOfMemory: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceOutOfDisk: codersdk.FallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceCreated: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceManuallyUpdated: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceDeleted: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceAutobuildFailed: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceDormant: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceAutoUpdated: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceMarkedForDeletion: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceManualBuildFailed: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceOutOfMemory: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
notifications.TemplateWorkspaceOutOfDisk: codersdk.InboxNotificationFallbackIconWorkspace,
|
||||
|
||||
// account related notifications
|
||||
notifications.TemplateUserAccountCreated: codersdk.FallbackIconAccount,
|
||||
notifications.TemplateUserAccountDeleted: codersdk.FallbackIconAccount,
|
||||
notifications.TemplateUserAccountSuspended: codersdk.FallbackIconAccount,
|
||||
notifications.TemplateUserAccountActivated: codersdk.FallbackIconAccount,
|
||||
notifications.TemplateYourAccountSuspended: codersdk.FallbackIconAccount,
|
||||
notifications.TemplateYourAccountActivated: codersdk.FallbackIconAccount,
|
||||
notifications.TemplateUserRequestedOneTimePasscode: codersdk.FallbackIconAccount,
|
||||
notifications.TemplateUserAccountCreated: codersdk.InboxNotificationFallbackIconAccount,
|
||||
notifications.TemplateUserAccountDeleted: codersdk.InboxNotificationFallbackIconAccount,
|
||||
notifications.TemplateUserAccountSuspended: codersdk.InboxNotificationFallbackIconAccount,
|
||||
notifications.TemplateUserAccountActivated: codersdk.InboxNotificationFallbackIconAccount,
|
||||
notifications.TemplateYourAccountSuspended: codersdk.InboxNotificationFallbackIconAccount,
|
||||
notifications.TemplateYourAccountActivated: codersdk.InboxNotificationFallbackIconAccount,
|
||||
notifications.TemplateUserRequestedOneTimePasscode: codersdk.InboxNotificationFallbackIconAccount,
|
||||
|
||||
// template related notifications
|
||||
notifications.TemplateTemplateDeleted: codersdk.FallbackIconTemplate,
|
||||
notifications.TemplateTemplateDeprecated: codersdk.FallbackIconTemplate,
|
||||
notifications.TemplateWorkspaceBuildsFailedReport: codersdk.FallbackIconTemplate,
|
||||
notifications.TemplateTemplateDeleted: codersdk.InboxNotificationFallbackIconTemplate,
|
||||
notifications.TemplateTemplateDeprecated: codersdk.InboxNotificationFallbackIconTemplate,
|
||||
notifications.TemplateWorkspaceBuildsFailedReport: codersdk.InboxNotificationFallbackIconTemplate,
|
||||
}
|
||||
|
||||
func ensureNotificationIcon(notif codersdk.InboxNotification) codersdk.InboxNotification {
|
||||
@ -64,7 +64,7 @@ func ensureNotificationIcon(notif codersdk.InboxNotification) codersdk.InboxNoti
|
||||
|
||||
fallbackIcon, ok := fallbackIcons[notif.TemplateID]
|
||||
if !ok {
|
||||
fallbackIcon = codersdk.FallbackIconOther
|
||||
fallbackIcon = codersdk.InboxNotificationFallbackIconOther
|
||||
}
|
||||
|
||||
notif.Icon = fallbackIcon
|
||||
|
Reference in New Issue
Block a user