diff --git a/ivette/src/ivette/display.tsx b/ivette/src/ivette/display.tsx index 6e7e68c4234b646ad3580a1f45ea6ffb1dd6c416..af1bdad3bd5bdcc017b609a56550e7d7129599bf 100644 --- a/ivette/src/ivette/display.tsx +++ b/ivette/src/ivette/display.tsx @@ -124,14 +124,15 @@ export function useComponentStatus( return Laboratory.getComponentStatus(state, id ?? ''); } -export type ShortMessage = undefined | null | string; -export type Message = ShortMessage | Laboratory.Notification; -export type Warning = ShortMessage | { label: string, title: string }; +export type Message = string | { label: string, title: string }; /** Message notification */ export function showMessage(msg: Message): void { if (!msg) return; - Laboratory.showMessage(typeof msg === 'string' ? { label: msg } : msg); + const short = typeof msg === 'string'; + const label = short ? msg : msg.label; + const title = short ? msg : msg.title; + Laboratory.showMessage({ kind: "message", label, title }); } /** Warning notification. */ @@ -139,7 +140,7 @@ export function showWarning(msg: Message): void { if (!msg) return; const short = typeof msg === 'string'; const label = short ? msg : msg.label; - const title = short ? msg : undefined; + const title = short ? msg : msg.title; Laboratory.showMessage({ kind: 'warning', label, title }); } @@ -148,7 +149,7 @@ export function showError(msg: Message): void { if (!msg) return; const short = typeof msg === 'string'; const label = short ? msg : msg.label; - const title = short ? msg : undefined; + const title = short ? msg : msg.title; Laboratory.showMessage({ kind: 'error', label, title }); } diff --git a/ivette/src/ivette/laboratory.tsx b/ivette/src/ivette/laboratory.tsx index 6413e13781119605b2595ca0f5c5d05cc9b1d9f4..5b56d653195ed7df3bba208426e9b3d7c8de1e3d 100644 --- a/ivette/src/ivette/laboratory.tsx +++ b/ivette/src/ivette/laboratory.tsx @@ -913,7 +913,7 @@ function LayoutMenu(): JSX.Element | null { type NotificationKind = 'message' | 'warning' | 'error'; export interface Notification { - kind?: NotificationKind; + kind: NotificationKind; label: string; title?: string; }