diff --git a/src/components/settings/services/EditServiceForm.tsx b/src/components/settings/services/EditServiceForm.tsx index 00629b6b69..0844789827 100644 --- a/src/components/settings/services/EditServiceForm.tsx +++ b/src/components/settings/services/EditServiceForm.tsx @@ -1,3 +1,4 @@ +import { app, dialog } from '@electron/remote'; import { mdiInformation } from '@mdi/js'; import { noop } from 'lodash'; import { observer } from 'mobx-react'; @@ -34,6 +35,10 @@ const messages = defineMessages({ id: 'settings.service.form.deleteButton', defaultMessage: 'Delete service', }, + confirmDeleteService: { + id: 'settings.service.form.confirmDeleteService', + defaultMessage: 'Do you really want to delete the {serviceName} service?', + }, openDarkmodeCss: { id: 'settings.service.form.openDarkmodeCss', defaultMessage: 'Open darkmode.css', @@ -248,7 +253,23 @@ class EditServiceForm extends Component { buttonType="danger" label={intl.formatMessage(messages.deleteService)} className="settings__delete-button" - onClick={onDelete} + onClick={() => { + // @ts-expect-error Fix me + const selection = dialog.showMessageBoxSync(app.mainWindow, { + type: 'question', + message: intl.formatMessage(messages.deleteService), + detail: intl.formatMessage(messages.confirmDeleteService, { + serviceName: service?.name || recipe.name, + }), + buttons: [ + intl.formatMessage(globalMessages.yes), + intl.formatMessage(globalMessages.no), + ], + }); + if (selection === 0) { + onDelete(); + } + }} /> ); diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index cb0f4369c4..9ea73cf2a7 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -356,6 +356,7 @@ "settings.service.error.message": "Could not load service recipe.", "settings.service.form.addServiceHeadline": "Add {name}", "settings.service.form.availableServices": "Available services", + "settings.service.form.confirmDeleteService": "Do you really want to delete the {serviceName} service?", "settings.service.form.customUrl": "Custom server", "settings.service.form.customUrlValidationError": "Could not validate custom {name} server.", "settings.service.form.darkReaderBrightness": "Dark Reader Brightness",