missing titles on dialogs #163

Massimo Melina committed Mar 18, 2023 at 16:11 UTC bc9a7c9aea57a0eb557ef8308296bb258970029e
2 files changed +5 -4
frontend/src/dialog.ts
+3 -2
@@ -75,7 +75,7 @@ export async function alertDialog(msg: ReactElement | string | Error, type:Alert
75 }
76 }
77
78 -export interface ConfirmOptions {
78 +export interface ConfirmOptions extends Partial<DialogOptions> {
79 href?: string
80 afterButtons?: ReactNode
81 timeout?: number
@@ -83,7 +83,7 @@ export interface ConfirmOptions {
83 getClose?: (cb: DialogCloser) => unknown
84 }
85 export async function confirmDialog(msg: ReactElement | string, options: ConfirmOptions={}) : Promise<unknown> {
86 - const { href, afterButtons, timeout, timeoutConfirm=false, getClose=_.noop } = options
86 + const { href, afterButtons, timeout, timeoutConfirm=false, getClose=_.noop, ...rest } = options
87 if (typeof msg === 'string')
88 msg = h('p', {}, msg)
89 return new Promise(resolve =>
@@ -91,6 +91,7 @@ export async function confirmDialog(msg: ReactElement | string, options: Confirm
91 className: 'dialog-confirm',
92 icon: '?',
93 onClose: resolve,
94 + ...rest,
95 Content
96 })) )
97
frontend/src/menu.ts
+2 -2
@@ -135,7 +135,7 @@ export function MenuPanel() {
135 label: t`Search`,
136 onClickAnimation: false,
137 async onClick() {
138 - state.remoteSearch = await promptDialog(t('search_msg', "Search this folder and sub-folders")) || ''
138 + state.remoteSearch = await promptDialog(t('search_msg', "Search this folder and sub-folders"), { title: t`Search` }) || ''
139 }
140 }
141 }
@@ -174,7 +174,7 @@ export function MenuLink({ href, target, confirm, confirmOptions, ...rest }: Men
174 async onClick(ev) {
175 if (!confirm) return
176 ev.preventDefault()
177 - await confirmDialog(confirm, { href, ...confirmOptions })
177 + await confirmDialog(confirm, { href, title: t`Confirm`, ...confirmOptions })
178 }
179 }, h(MenuButton, rest))
180 }