frontend: show Error in error dialogs' title
Massimo Melina committed
Jan 8, 2023 at 18:09 UTC
b4a1989af322b8c90dac759380acf39b72e1a86a
2 files changed
+4
-2
frontend/src/dialog.css
+1
-1
@@ -31,7 +31,7 @@
31
border-radius: .8em 0;
32
}
33
.dialog-title {
34
- margin-top: -5px;
34
+ margin-top: -.5em;
35
font-size: 110%;
36
}
37
.dialog-icon ~ .dialog-title {
frontend/src/dialog.ts
+3
-1
@@ -3,6 +3,7 @@
3
import { createElement as h, ReactElement, ReactNode, useEffect, useRef } from 'react'
4
import './dialog.css'
5
import { newDialog, closeDialog } from '@hfs/shared/dialogs'
6
+import _ from 'lodash'
7
export * from '@hfs/shared/dialogs'
8
9
interface PromptOptions { def?:string, type?:string }
@@ -52,11 +53,12 @@ type AlertType = 'error' | 'warning' | 'info'
53
54
export async function alertDialog(msg: ReactElement | string | Error, type:AlertType='info') {
55
if (msg instanceof Error) {
55
- msg = String(msg)
56
+ msg = msg.message
57
type = 'error'
58
}
59
return new Promise(resolve => newDialog({
60
className: 'dialog-alert-'+type,
61
+ title: _.capitalize(type),
62
icon: '!',
63
onClose: resolve,
64
Content