diff --git a/src/main/index.mjs b/src/main/index.mjs index 4bdfc81a..27a466ef 100644 --- a/src/main/index.mjs +++ b/src/main/index.mjs @@ -112,6 +112,10 @@ app.whenReady().then(() => { ipcMain.handle('create-app', async (_, path, project) => { return createApp(path, project, logger) }) + + ipcMain.handle('quit-app', () => { + app.quit() + }) }) // Quit when all windows are closed, except on macOS. There, it's common diff --git a/src/preload/index.js b/src/preload/index.js index 4aeeab89..5d31871f 100644 --- a/src/preload/index.js +++ b/src/preload/index.js @@ -19,7 +19,8 @@ if (process.contextIsolated) { getPlugins: () => (ipcRenderer.invoke('get-plugins')), prepareFolder: (folder, templates) => (ipcRenderer.invoke('prepare-folder', folder, templates)), onLog: callback => ipcRenderer.on('log', callback), - createApp: (folder, project) => (ipcRenderer.invoke('create-app', folder, project)) + createApp: (folder, project) => (ipcRenderer.invoke('create-app', folder, project)), + quitApp: () => (ipcRenderer.invoke('quit-app')) }) } catch (error) { console.error(error) diff --git a/src/renderer/src/api.js b/src/renderer/src/api.js index d75ed93b..c9265f20 100644 --- a/src/renderer/src/api.js +++ b/src/renderer/src/api.js @@ -14,3 +14,5 @@ export const callCreateApp = async (path, project) => { } export const logInfo = callback => window.api.onLog(callback) + +export const quitApp = () => window.api.quitApp() diff --git a/src/renderer/src/components/steps/GeneratingApplication.jsx b/src/renderer/src/components/steps/GeneratingApplication.jsx index ce6a5b39..88033b74 100644 --- a/src/renderer/src/components/steps/GeneratingApplication.jsx +++ b/src/renderer/src/components/steps/GeneratingApplication.jsx @@ -8,7 +8,7 @@ import styles from './GeneratingApplication.module.css' import { WHITE, TRANSPARENT, RICH_BLACK, OPACITY_30, OPACITY_100, SMALL } from '@platformatic/ui-components/src/components/constants' import useStackablesStore from '~/useStackablesStore' import Title from '~/components/ui/Title' -import { callCreateApp, logInfo } from '~/api' +import { callCreateApp, logInfo, quitApp } from '~/api' /* function dateDifferences(millisStartDate, millisEndDate) { const s = new Date(millisStartDate); @@ -117,7 +117,9 @@ GeneratingApplication.propTypes = { } GeneratingApplication.defaultProps = { - onClickComplete: () => {} + onClickComplete: () => { + quitApp() + } } export default GeneratingApplication