2025-12-27 13:37:37 -08:00
|
|
|
import { defineMessage, type MessageDescriptor } from '../composables/i18n'
|
2025-04-12 22:00:22 -07:00
|
|
|
|
|
|
|
|
export const NOTICE_LEVELS: Record<
|
2025-08-14 21:48:38 +01:00
|
|
|
string,
|
|
|
|
|
{ name: MessageDescriptor; colors: { text: string; bg: string } }
|
2025-04-12 22:00:22 -07:00
|
|
|
> = {
|
2025-08-14 21:48:38 +01:00
|
|
|
info: {
|
|
|
|
|
name: defineMessage({
|
|
|
|
|
id: 'servers.notice.level.info.name',
|
|
|
|
|
defaultMessage: 'Info',
|
|
|
|
|
}),
|
|
|
|
|
colors: {
|
|
|
|
|
text: 'var(--color-blue)',
|
|
|
|
|
bg: 'var(--color-blue-bg)',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
warn: {
|
|
|
|
|
name: defineMessage({
|
|
|
|
|
id: 'servers.notice.level.warn.name',
|
|
|
|
|
defaultMessage: 'Warning',
|
|
|
|
|
}),
|
|
|
|
|
colors: {
|
|
|
|
|
text: 'var(--color-orange)',
|
|
|
|
|
bg: 'var(--color-orange-bg)',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
critical: {
|
|
|
|
|
name: defineMessage({
|
|
|
|
|
id: 'servers.notice.level.critical.name',
|
|
|
|
|
defaultMessage: 'Critical',
|
|
|
|
|
}),
|
|
|
|
|
colors: {
|
|
|
|
|
text: 'var(--color-red)',
|
|
|
|
|
bg: 'var(--color-red-bg)',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
survey: {
|
|
|
|
|
name: defineMessage({
|
|
|
|
|
id: 'servers.notice.level.survey.name',
|
|
|
|
|
defaultMessage: 'Survey',
|
|
|
|
|
}),
|
|
|
|
|
colors: {
|
|
|
|
|
text: 'var(--color-purple)',
|
|
|
|
|
bg: 'var(--color-purple-bg)',
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-04-12 22:00:22 -07:00
|
|
|
}
|
|
|
|
|
|
2025-06-11 23:32:39 +01:00
|
|
|
export const DISMISSABLE = {
|
2025-08-14 21:48:38 +01:00
|
|
|
name: defineMessage({
|
|
|
|
|
id: 'servers.notice.dismissable',
|
|
|
|
|
defaultMessage: 'Dismissable',
|
|
|
|
|
}),
|
|
|
|
|
colors: {
|
|
|
|
|
text: 'var(--color-green)',
|
|
|
|
|
bg: 'var(--color-green-bg)',
|
|
|
|
|
},
|
2025-04-12 22:00:22 -07:00
|
|
|
}
|
|
|
|
|
|
2025-06-11 23:32:39 +01:00
|
|
|
export const UNDISMISSABLE = {
|
2025-08-14 21:48:38 +01:00
|
|
|
name: defineMessage({
|
|
|
|
|
id: 'servers.notice.undismissable',
|
|
|
|
|
defaultMessage: 'Undismissable',
|
|
|
|
|
}),
|
|
|
|
|
colors: {
|
|
|
|
|
text: 'var(--color-red)',
|
|
|
|
|
bg: 'var(--color-red-bg)',
|
|
|
|
|
},
|
2025-04-12 22:00:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getDismissableMetadata(dismissable: boolean) {
|
2025-08-14 21:48:38 +01:00
|
|
|
return dismissable ? DISMISSABLE : UNDISMISSABLE
|
2025-04-12 22:00:22 -07:00
|
|
|
}
|