Skip to content

Commit

Permalink
Don't display details button if message is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Nov 16, 2023
1 parent d409e0c commit d32f242
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@ export function showError(
};
}

/**
* Display additional information in a dialog from a notification
* button.
*
* Note: it will not add a button if the message is empty.
*
* @param message Details to display
* @param trans Translation object
* @returns Notification option to display the message
*/
export function showDetails(
message: string,
trans: TranslationBundle
): Notification.IOptions<null> {
return {
return message ? {
autoClose: 5000,
actions: [
{
Expand All @@ -45,5 +55,5 @@ export function showDetails(
displayType: 'warn'
} as Notification.IAction
]
};
} : {};
}

0 comments on commit d32f242

Please sign in to comment.