Compare commits

...

1 Commits

Author SHA1 Message Date
Vivian Phung
2b81561a63 project for id 2024-06-24 22:42:28 +00:00
2 changed files with 115 additions and 82 deletions

View File

@ -11,14 +11,37 @@ import {
import { Heading } from 'components/shared/Heading'; import { Heading } from 'components/shared/Heading';
import logoAnimation from 'components/../../public/lottie/logo.json'; 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 = () => {
const { id, orgSlug } = useParams(); const { id, orgSlug } = useParams();
const client = useGQLClient();
const [project, setProject] = useState<Project | null>(null);
const handleSetupDomain = () => { const handleSetupDomain = async () => {
//TODO: Implement this 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 ( return (
<>
{project ? (
<div className="flex flex-col gap-8 lg:gap-11 max-w-[522px] mx-auto py-6 lg:py-12"> <div className="flex flex-col gap-8 lg:gap-11 max-w-[522px] mx-auto py-6 lg:py-12">
{/* Icon */} {/* Icon */}
<div className="flex justify-center"> <div className="flex justify-center">
@ -35,14 +58,13 @@ const Id = () => {
<Button <Button
className="no-underline text-elements-link" className="no-underline text-elements-link"
// TODO: use dynamic value // TODO: use dynamic value
href="https://www.iglootools.snowballtools.xyz" href={project ? `https://${project.subDomain}` : ''}
as="a" as="a"
variant="link-emphasized" variant="link-emphasized"
external external
leftIcon={<LinkChainIcon />} leftIcon={<LinkChainIcon />}
> >
{/* // TODO: use dynamic value */} {project.subDomain}
www.iglootools.snowballtools.xyz
</Button> </Button>
</p> </p>
</div> </div>
@ -73,7 +95,11 @@ const Id = () => {
custom domain. custom domain.
</p> </p>
</div> </div>
<Button onClick={handleSetupDomain} variant="tertiary" size="sm"> <Button
onClick={handleSetupDomain}
variant="tertiary"
size="sm"
>
Setup domain Setup domain
</Button> </Button>
</div> </div>
@ -103,6 +129,10 @@ const Id = () => {
</div> </div>
</div> </div>
</div> </div>
) : (
<></>
)}
</>
); );
}; };

View File

@ -131,9 +131,12 @@ const OverviewTabPanel = () => {
<Heading className="text-lg leading-6 font-medium truncate"> <Heading className="text-lg leading-6 font-medium truncate">
{project.name} {project.name}
</Heading> </Heading>
<p className="text-sm text-elements-low-em tracking-tight truncate"> <a
href={`https://${project.subDomain}`}
className="text-sm text-elements-low-em tracking-tight truncate"
>
{project.subDomain} {project.subDomain}
</p> </a>
</div> </div>
</div> </div>
<OverviewInfo label="Domain" icon={<GlobeIcon />}> <OverviewInfo label="Domain" icon={<GlobeIcon />}>