Skip to content
Snippets Groups Projects
Commit 0fe55cab authored by David Bühler's avatar David Bühler
Browse files

[Ivette] Fixes icon of notifications, that have always the proper kind.

parent 43ef71a9
No related branches found
No related tags found
No related merge requests found
......@@ -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 });
}
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment