diff --git a/wasp-ai/src/client/pages/ResultPage.jsx b/wasp-ai/src/client/pages/ResultPage.jsx
index e72dc5efe1..fc855b4c3d 100644
--- a/wasp-ai/src/client/pages/ResultPage.jsx
+++ b/wasp-ai/src/client/pages/ResultPage.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useMemo } from "react";
import getAppGenerationResult from "@wasp/queries/getAppGenerationResult";
import startGeneratingNewApp from "@wasp/actions/startGeneratingNewApp";
import registerZipDownload from "@wasp/actions/registerZipDownload";
-import createFeedback from "@wasp/actions/createFeedback"
+import createFeedback from "@wasp/actions/createFeedback";
import { useQuery } from "@wasp/queries";
import { CodeHighlight } from "../components/CodeHighlight";
import { FileTree } from "../components/FileTree";
@@ -10,7 +10,7 @@ import { createFilesAndDownloadZip } from "../zip/zipHelpers";
import { useParams } from "react-router-dom";
import { Link } from "react-router-dom";
import { useHistory } from "react-router-dom";
-import { RadioGroup } from '@headlessui/react'
+import { RadioGroup } from "@headlessui/react";
import { Loader } from "../components/Loader";
import { MyDialog } from "../components/Dialog";
import { Logs } from "../components/Logs";
@@ -24,30 +24,28 @@ import {
PiCheckDuotone,
PiGithubLogoDuotone,
PiStarDuotone,
-} from 'react-icons/pi';
+} from "react-icons/pi";
import { RxQuestionMarkCircled } from "react-icons/rx";
-import JSConfetti from 'js-confetti';
+import JSConfetti from "js-confetti";
import getNumProjects from "@wasp/queries/getNumProjects";
+import { StatusPill } from "../components/StatusPill";
+import { HomeButton, ProfileButton, FaqButton } from "../components/Header";
const jsConfetti = new JSConfetti();
export const ResultPage = () => {
const { appId } = useParams();
const [generationDone, setGenerationDone] = useState(false);
- const [isRunning, setIsRunning] = useState(false);
+ const [isRunning, setIsRunning] = useState(false);
const [isSuccessModalOpen, setIsSuccessModalOpen] = useState(false);
const {
data: appGenerationResult,
isError,
isLoading,
- } = useQuery(
- getAppGenerationResult,
- { appId },
- { enabled: !!appId && !generationDone, refetchInterval: 3000 }
- );
+ } = useQuery(getAppGenerationResult, { appId }, { enabled: !!appId && !generationDone, refetchInterval: 3000 });
const [activeFilePath, setActiveFilePath] = useState(null);
const [currentStatus, setCurrentStatus] = useState({
- status: "idle",
+ status: "idle",
message: "Waiting",
});
const [currentFiles, setCurrentFiles] = useState({});
@@ -74,16 +72,15 @@ export const ResultPage = () => {
}, [appId]);
useEffect(() => {
+ const wasRunning = isRunning;
const currentAppStatus = appGenerationResult?.project?.status;
- if (currentAppStatus === "in-progress") {
- setIsRunning(true)
- } else if (currentAppStatus === "success" && isRunning) {
- setIsSuccessModalOpen(true)
- setIsRunning(false)
- } else if (isRunning) {
- setIsRunning(false)
+
+ setIsRunning(currentAppStatus === "in-progress");
+
+ if (wasRunning && currentAppStatus === "success") {
+ setIsSuccessModalOpen(true);
}
- }, [appGenerationResult?.project?.status])
+ }, [appGenerationResult?.project?.status]);
const logs = appGenerationResult?.project?.logs.map((log) => log.content);
@@ -104,15 +101,12 @@ export const ResultPage = () => {
return [];
}
- const updatedFilePaths = Object.entries(files).reduce(
- (updatedPaths, [path, newContent]) => {
- if (newContent === previousFiles[path]) {
- return updatedPaths;
- }
- return [...updatedPaths, path];
- },
- []
- );
+ const updatedFilePaths = Object.entries(files).reduce((updatedPaths, [path, newContent]) => {
+ if (newContent === previousFiles[path]) {
+ return updatedPaths;
+ }
+ return [...updatedPaths, path];
+ }, []);
return updatedFilePaths;
}, [files]);
@@ -178,10 +172,7 @@ export const ResultPage = () => {
}
function getUniqueZipName() {
- const safeAppName = appGenerationResult?.project?.name.replace(
- /[^a-zA-Z0-9]/g,
- "_"
- );
+ const safeAppName = appGenerationResult?.project?.name.replace(/[^a-zA-Z0-9]/g, "_");
const randomSuffix = Math.random().toString(36).substring(2, 7);
return `${safeAppName}-${randomSuffix}`;
}
@@ -205,7 +196,7 @@ export const ResultPage = () => {
appDesc: project.description,
appPrimaryColor: project.primaryColor,
appAuthMethod: project.authMethod,
- appCreativityLevel: project.creativityLevel
+ appCreativityLevel: project.creativityLevel,
});
alert("Now I will go to " + appId);
history.push(`/result/${appId}`);
@@ -220,17 +211,21 @@ export const ResultPage = () => {
return (
-
+
-
{isError && (
- We couldn't find the app generation result. Maybe the link is
- incorrect or the app generation has failed.
+ We couldn't find the app generation result. Maybe the link is incorrect or the app generation has failed.
Generate a new one
@@ -269,43 +264,31 @@ export const ResultPage = () => {
onClick={() => window.open("https://github.com/wasp-lang/wasp/tree/wasp-ai")}
>
- 🔮 This is a Wasp powered project. If you like it,{" "}
- star us on GitHub!
+ 🔮 This is a Wasp powered project. If you like it, star us on GitHub!
{currentStatus.status === "pending" && (
-
+
)}
{interestingFilePaths.length > 0 && (
<>
-
- {appGenerationResult?.project?.name}
-
+ {appGenerationResult?.project?.name}
-