From 6a5ec1b044f35e7ffa537436d0a7caba2f8d488e Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Sat, 16 Nov 2024 23:00:20 +0800 Subject: [PATCH] fix: dialog did not close after confirmation (#1628) * fix: dialog did not close after confirmation * i18n --- apps/main/src/window.ts | 4 ++-- apps/renderer/src/components/ui/modal/stacked/hooks.tsx | 1 + locales/native/en.json | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/main/src/window.ts b/apps/main/src/window.ts index 1091018d2..981db4896 100644 --- a/apps/main/src/window.ts +++ b/apps/main/src/window.ts @@ -120,8 +120,8 @@ export function createWindow( const caller = callWindowExpose(window) const confirm = await caller.dialog.ask({ - title: "Open External App?", - message: t("dialog.openExternalApp", { url, interpolation: { escapeValue: false } }), + title: t("dialog.openExternalApp.title"), + message: t("dialog.openExternalApp.message", { url, interpolation: { escapeValue: false } }), confirmText: t("dialog.open"), cancelText: t("dialog.cancel"), }) diff --git a/apps/renderer/src/components/ui/modal/stacked/hooks.tsx b/apps/renderer/src/components/ui/modal/stacked/hooks.tsx index 90e2d1c5d..74ce912a8 100644 --- a/apps/renderer/src/components/ui/modal/stacked/hooks.tsx +++ b/apps/renderer/src/components/ui/modal/stacked/hooks.tsx @@ -188,6 +188,7 @@ export const useDialog = (): DialogInstance => { onClick={() => { options.onConfirm?.() resolve(true) + dismiss() }} > {options.confirmText ?? t("confirm", { ns: "common" })} diff --git a/locales/native/en.json b/locales/native/en.json index d5224802a..60bf7a6b1 100644 --- a/locales/native/en.json +++ b/locales/native/en.json @@ -23,7 +23,8 @@ "dialog.clearAllData": "Are you sure you want to clear all data?", "dialog.no": "No", "dialog.open": "Open", - "dialog.openExternalApp": "Are you sure you want to open \"{{url}}\" with other apps?", + "dialog.openExternalApp.message": "Are you sure you want to open \"{{url}}\" with other apps?", + "dialog.openExternalApp.title": "Open External App?", "dialog.yes": "Yes", "menu.about": "About {{name}}", "menu.actualSize": "Actual Size",