From 829dde57ecc3c4f6a403a1e07eb0c2a3f0ada135 Mon Sep 17 00:00:00 2001 From: Antonio Sonis Date: Mon, 4 Dec 2023 12:03:20 +0100 Subject: [PATCH] fix: adding generating application modal Signed-off-by: Antonio Sonis --- .../steps/GeneratingApplication.jsx | 99 +++++++++++++------ 1 file changed, 70 insertions(+), 29 deletions(-) diff --git a/src/renderer/src/components/steps/GeneratingApplication.jsx b/src/renderer/src/components/steps/GeneratingApplication.jsx index c43fd361..434d53a3 100644 --- a/src/renderer/src/components/steps/GeneratingApplication.jsx +++ b/src/renderer/src/components/steps/GeneratingApplication.jsx @@ -1,18 +1,18 @@ 'use strict' import React, { useEffect, useState } from 'react' import PropTypes from 'prop-types' -import { BorderedBox, Button } from '@platformatic/ui-components' +import { BorderedBox, Button, HorizontalSeparator, Modal } from '@platformatic/ui-components' import commonStyles from '~/styles/CommonStyles.module.css' import typographyStyles from '~/styles/Typography.module.css' import styles from './GeneratingApplication.module.css' -import { WHITE, TRANSPARENT, RICH_BLACK, OPACITY_30 } from '@platformatic/ui-components/src/components/constants' +import { WHITE, TRANSPARENT, RICH_BLACK, OPACITY_30, MODAL_POPUP_V2, MARGIN_0 } from '@platformatic/ui-components/src/components/constants' import useStackablesStore from '~/useStackablesStore' import Title from '~/components/ui/Title' import CountDown from '~/components/ui/CountDown' import { callCreateApp, logInfo, quitApp } from '~/api' import { NONE, RUNNING, SUCCESS, ERROR } from '~/ui-constants' -const GeneratingApplication = React.forwardRef(({ onClickComplete, onRestartProcess }, ref) => { +const GeneratingApplication = React.forwardRef(({ onRestartProcess }, ref) => { const globalState = useStackablesStore() const { formData, reset } = globalState const [appGenerated, setAppGenerated] = useState(false) @@ -22,6 +22,7 @@ const GeneratingApplication = React.forwardRef(({ onClickComplete, onRestartProc const [logValue, setLogValue] = useState(null) const [countDownStatus, setCountDownStatus] = useState(NONE) const [restartInProgress, setRestartInProgress] = useState(false) + const [showModalContinue, setShowModalContinue] = useState(false) useEffect(() => { logInfo((_, value) => setLogValue(value)) @@ -62,7 +63,13 @@ const GeneratingApplication = React.forwardRef(({ onClickComplete, onRestartProc navigator.clipboard.writeText(str) } + function onClickComplete () { + setShowModalContinue(false) + quitApp() + } + function onClickRestart () { + setShowModalContinue(false) setRestartInProgress(true) reset() onRestartProcess() @@ -98,38 +105,74 @@ const GeneratingApplication = React.forwardRef(({ onClickComplete, onRestartProc backgroundColor={RICH_BLACK} classes={`${commonStyles.buttonPadding} cy-action-donwload-logs`} /> +