Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quit on complete #44

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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