mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
use yes/no buttons for reloadAsk
This commit is contained in:
parent
3d3846ec85
commit
c6aaf721cd
1 changed files with 10 additions and 7 deletions
|
@ -12,6 +12,10 @@ let isReloadConfirming = false;
|
||||||
export async function reloadAsk(opts: {
|
export async function reloadAsk(opts: {
|
||||||
unison?: boolean;
|
unison?: boolean;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
|
type?: 'error' | 'info' | 'success' | 'warning' | 'waiting' | 'question';
|
||||||
|
title?: string;
|
||||||
|
okText?: string;
|
||||||
|
cancelText?: string;
|
||||||
}) {
|
}) {
|
||||||
if (isReloadConfirming) {
|
if (isReloadConfirming) {
|
||||||
return;
|
return;
|
||||||
|
@ -19,13 +23,12 @@ export async function reloadAsk(opts: {
|
||||||
|
|
||||||
isReloadConfirming = true;
|
isReloadConfirming = true;
|
||||||
|
|
||||||
const { canceled } = await os.confirm(opts.reason == null ? {
|
const { canceled } = await os.confirm({
|
||||||
type: 'info',
|
type: opts.type ?? 'question',
|
||||||
text: i18n.ts.reloadConfirm,
|
title: opts.title ?? i18n.ts.reloadConfirm,
|
||||||
} : {
|
text: opts.reason ?? undefined,
|
||||||
type: 'info',
|
okText: opts.okText ?? i18n.ts.yes,
|
||||||
title: i18n.ts.reloadConfirm,
|
cancelText: opts.cancelText ?? i18n.ts.no,
|
||||||
text: opts.reason,
|
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
isReloadConfirming = false;
|
isReloadConfirming = false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue