Skip to content

Commit

Permalink
Merge pull request #44 from platformatic/complete-quit
Browse files Browse the repository at this point in the history
quit on complete
  • Loading branch information
tonysnowboardunderthebridge authored Nov 30, 2023
2 parents df9beed + 7da027c commit f938398
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/preload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ export const callCreateApp = async (path, project) => {
}

export const logInfo = callback => window.api.onLog(callback)

export const quitApp = () => window.api.quitApp()
6 changes: 4 additions & 2 deletions src/renderer/src/components/steps/GeneratingApplication.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -117,7 +117,9 @@ GeneratingApplication.propTypes = {
}

GeneratingApplication.defaultProps = {
onClickComplete: () => {}
onClickComplete: () => {
quitApp()
}
}

export default GeneratingApplication

0 comments on commit f938398

Please sign in to comment.