From dee84f18cbb9878aea0c8fd39454b3a299c49237 Mon Sep 17 00:00:00 2001 From: Vivian Phung Date: Mon, 24 Jun 2024 18:44:34 -0400 Subject: [PATCH] feat: dynamic project success page and update links (#220) ### TL;DR Integrates project data fetching for dynamic subdomain display on the Project Deployment Success page and the OverviewTabPanel. ### What changed? - Updated `Id.tsx` to fetch project data and dynamically display project's subdomain after deployment. - Modified `Overview.tsx` to make project's subdomain a clickable link. ### How to test? 1. Deploy a new project and check the deployment success page for correct subdomain display. 2. Open a project's overview tab and click the subdomain link to ensure it navigates correctly. ### Why make this change? Improves user experience by displaying the actual subdomain and making it clickable, ensuring users can conveniently verify their deployment and access project domain. --- --- .../org-slug/projects/create/success/Id.tsx | 190 ++++++++++-------- .../pages/org-slug/projects/id/Overview.tsx | 7 +- 2 files changed, 115 insertions(+), 82 deletions(-) diff --git a/packages/frontend/src/pages/org-slug/projects/create/success/Id.tsx b/packages/frontend/src/pages/org-slug/projects/create/success/Id.tsx index b7f98c76..7e8deb3b 100644 --- a/packages/frontend/src/pages/org-slug/projects/create/success/Id.tsx +++ b/packages/frontend/src/pages/org-slug/projects/create/success/Id.tsx @@ -11,98 +11,128 @@ import { import { Heading } from 'components/shared/Heading'; import logoAnimation from 'components/../../public/lottie/logo.json'; +import { useGQLClient } from 'context/GQLClientContext'; +import { Project } from 'gql-client'; +import { useEffect, useState } from 'react'; const Id = () => { const { id, orgSlug } = useParams(); + const client = useGQLClient(); + const [project, setProject] = useState(null); - const handleSetupDomain = () => { - //TODO: Implement this + const handleSetupDomain = async () => { + if (id) { + // console.log('id', id); + // console.log('getting project for id', id); + const project = await client.getProject(id); + // console.log('project found:', project); + if (project && project.project) { + // console.log('project:', project.project); + setProject(project.project); + } + } else { + window.location.href = '/'; + } }; + + useEffect(() => { + handleSetupDomain(); + }); + return ( -
- {/* Icon */} -
- -
- - {/* Heading */} -
- - Project deployed successfully. - -

- Your project has been deployed at{' '} - -

-
- - {/* Card */} -
- {/* Trigger question */} -
-
- + <> + {project ? ( +
+ {/* Icon */} +
+
- - {`Wondering what's next?`} - -
- {/* CTA card */} -
-
- 1 -
-
- - Add a custom domain - -

- Make it easy for your visitors to remember your URL with a - custom domain. -

-
- +

+
+ + {/* Card */} +
+ {/* Trigger question */} +
+
+ +
+ + {`Wondering what's next?`} + +
+ + {/* CTA card */} +
+
+ 1 +
+
+ + Add a custom domain + +

+ Make it easy for your visitors to remember your URL with a + custom domain. +

+
+ +
+
+
+
+ + {/* CTA Buttons */} +
+
+ + + +
+
+ + +
-
- - {/* CTA Buttons */} -
-
- - - -
-
- - - -
-
-
+ ) : ( + <> + )} + ); }; diff --git a/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx b/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx index 2de55d8c..367b348d 100644 --- a/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx +++ b/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx @@ -131,9 +131,12 @@ const OverviewTabPanel = () => { {project.name} -

+ {project.subDomain} -

+
}>