diff --git a/package.json b/package.json index 21d24a330..015306f40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calckey", - "version": "12.119.0-calc.4.2", + "version": "12.119.0-calc.4.3", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/client/src/components/MkDialog.vue b/packages/client/src/components/MkDialog.vue index 155473cd7..e7867292a 100644 --- a/packages/client/src/components/MkDialog.vue +++ b/packages/client/src/components/MkDialog.vue @@ -28,8 +28,14 @@
- {{ (showCancelButton || input || select) ? i18n.ts.ok : i18n.ts.gotIt }} - {{ i18n.ts.cancel }} +
+ {{ (showCancelButton || input || select) ? i18n.ts.ok : i18n.ts.gotIt }} + {{ i18n.ts.cancel }} +
+
+ {{ (showCancelButton || input || select) ? i18n.ts.ok : i18n.ts.yes }} + {{ i18n.ts.no }} +
{{ action.text }} @@ -81,11 +87,13 @@ const props = withDefaults(defineProps<{ }[]; showOkButton?: boolean; showCancelButton?: boolean; + isYesNo?: boolean; cancelableByBgClick?: boolean; }>(), { type: 'info', showOkButton: true, showCancelButton: false, + isYesNo: false, cancelableByBgClick: true, }); diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 6759a94e5..9cccab228 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -238,6 +238,24 @@ export function confirm(props: { }); } +export function yesno(props: { + type: 'error' | 'info' | 'success' | 'warning' | 'waiting' | 'question'; + title?: string | null; + text?: string | null; +}): Promise<{ canceled: boolean }> { + return new Promise((resolve, reject) => { + popup(defineAsyncComponent(() => import('@/components/MkDialog.vue')), { + ...props, + showCancelButton: true, + isYesNo: true, + }, { + done: result => { + resolve(result ? result : { canceled: true }); + }, + }, 'closed'); + }); +} + export function inputText(props: { type?: 'text' | 'email' | 'password' | 'url'; title?: string | null; diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index aaf60c8d5..db3c0fd72 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -130,7 +130,7 @@ function changeAvatar(ev) { selectFile(ev.currentTarget ?? ev.target, i18n.ts.avatar).then(async (file) => { let originalOrCropped = file; - const { canceled } = await os.confirm({ + const { canceled } = await os.yesno({ type: 'question', text: i18n.t('cropImageAsk'), }); @@ -153,7 +153,7 @@ function changeBanner(ev) { selectFile(ev.currentTarget ?? ev.target, i18n.ts.banner).then(async (file) => { let originalOrCropped = file; - const { canceled } = await os.confirm({ + const { canceled } = await os.yesno({ type: 'question', text: i18n.t('cropImageAsk'), });