From 4f89753ff7b995f0554cf4997078c5aa36483d17 Mon Sep 17 00:00:00 2001 From: Martin Sosic Date: Thu, 13 Jul 2023 17:31:12 +0200 Subject: [PATCH] Added estimation of waiting time + changed how GH stars banner is shown on results page. --- wasp-ai/src/client/RootComponent.jsx | 82 +++++++++++-------- wasp-ai/src/client/components/Logs.jsx | 2 +- .../client/components/WaitingRoomContent.jsx | 34 ++++++-- wasp-ai/src/client/pages/ResultPage.jsx | 29 ++++++- 4 files changed, 105 insertions(+), 42 deletions(-) diff --git a/wasp-ai/src/client/RootComponent.jsx b/wasp-ai/src/client/RootComponent.jsx index 340b709ac..929dbf9d3 100644 --- a/wasp-ai/src/client/RootComponent.jsx +++ b/wasp-ai/src/client/RootComponent.jsx @@ -1,4 +1,5 @@ -import { useEffect } from "react"; +import { useEffect, useMemo } from "react"; +import { useLocation } from "react-router-dom"; import Prism from "prismjs"; import "prismjs/components/prism-json"; import addWaspLangauge from "./prism/wasp"; @@ -12,6 +13,13 @@ addWaspLangauge(Prism); export function RootComponent({ children }) { // const { isAlreadyShown } = useWelcomeDialog(); // const [isDialogOpen, setIsDialogOpen] = useState(!isAlreadyShown); + const location = useLocation(); + + const shouldDisplayTopBanner = useMemo(() => { + return !(location.pathname.startsWith("/result/")); + }, [location]); + + useEffect(() => { const script = document.createElement("script"); @@ -24,47 +32,51 @@ export function RootComponent({ children }) { document.body.removeChild(script); }; }, []); + return ( <> -
window.open("https://github.com/wasp-lang/wasp")} - > + { shouldDisplayTopBanner && (
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! + + + + - Star - - + + Star + + +
- + )} +
{children}