From 0268656d2fc7d0dac522dccda8ee739a85808c10 Mon Sep 17 00:00:00 2001 From: Nabarun Gogoi Date: Wed, 27 Dec 2023 11:54:47 +0530 Subject: [PATCH] Add page for new domain in project settings (#28) * Add layout to implement addition of new domains * Handle review changes * Move AddDomain component to pages directory * Use useLocation for pathname * Use relative paths to navigate between pages --------- Co-authored-by: neeraj --- .../projects/project/settings/Domains.tsx | 13 ++-- .../projects/project/settings/SetupDomain.tsx | 33 +++++++++ .../src/pages/projects/id/domain/Add.tsx | 69 +++++++++++++++++++ .../frontend/src/pages/projects/routes.tsx | 5 ++ 4 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 packages/frontend/src/components/projects/project/settings/SetupDomain.tsx create mode 100644 packages/frontend/src/pages/projects/id/domain/Add.tsx diff --git a/packages/frontend/src/components/projects/project/settings/Domains.tsx b/packages/frontend/src/components/projects/project/settings/Domains.tsx index ac58da1d..d9eca992 100644 --- a/packages/frontend/src/components/projects/project/settings/Domains.tsx +++ b/packages/frontend/src/components/projects/project/settings/Domains.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useParams } from 'react-router-dom'; +import { useParams, Link } from 'react-router-dom'; import { Button, Typography } from '@material-tailwind/react'; import DomainCard from './DomainCard'; @@ -7,13 +7,16 @@ import domainsData from '../../../../assets/domains.json'; const Domains = () => { const { id } = useParams(); + return ( <> -
+
Domain - + + +
{domainsData diff --git a/packages/frontend/src/components/projects/project/settings/SetupDomain.tsx b/packages/frontend/src/components/projects/project/settings/SetupDomain.tsx new file mode 100644 index 00000000..857b0983 --- /dev/null +++ b/packages/frontend/src/components/projects/project/settings/SetupDomain.tsx @@ -0,0 +1,33 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; +import { Typography, Button, Input } from '@material-tailwind/react'; + +const SetupDomain = () => { + return ( +
+
+ Setup domain name + + Add your domain and setup redirects + +
+
+ Domain name + +
+ +
+ ); +}; + +export default SetupDomain; diff --git a/packages/frontend/src/pages/projects/id/domain/Add.tsx b/packages/frontend/src/pages/projects/id/domain/Add.tsx new file mode 100644 index 00000000..9b528b80 --- /dev/null +++ b/packages/frontend/src/pages/projects/id/domain/Add.tsx @@ -0,0 +1,69 @@ +import React, { useMemo } from 'react'; +import { useParams, useNavigate, useLocation } from 'react-router-dom'; +import { Typography, IconButton } from '@material-tailwind/react'; + +import Stepper from '../../../../components/Stepper'; +import SetupDomain from '../../../../components/projects/project/settings/SetupDomain'; + +const AddDomain = () => { + const { id } = useParams(); + const location = useLocation(); + const navigate = useNavigate(); + + const stepperValues = [ + { + step: 1, + route: `/projects/${id}/domain/add`, + label: 'Setup', + }, + { + step: 2, + route: `/projects/${id}/domain/add/config`, + label: 'Configure DNS', + }, + ]; + + const activeStep = useMemo( + () => + stepperValues.find((data) => data.route === location.pathname)?.step ?? 0, + [location.pathname], + ); + + return ( +
+
+ Add Domain + + navigate(-1)} + > + X + +
+ +
+
+
+ ^ + + Project Name + +
+
+ +
+
+ +
+
+ +
+
+
+
+ ); +}; + +export default AddDomain; diff --git a/packages/frontend/src/pages/projects/routes.tsx b/packages/frontend/src/pages/projects/routes.tsx index e31eeef2..a6d65533 100644 --- a/packages/frontend/src/pages/projects/routes.tsx +++ b/packages/frontend/src/pages/projects/routes.tsx @@ -3,6 +3,7 @@ import React from 'react'; import CreateProject from './Create'; import Project from './Project'; import { createProjectRoutes } from './create/routes'; +import AddDomain from './id/domain/Add'; export const projectsRoutesWithoutSearch = [ { @@ -10,6 +11,10 @@ export const projectsRoutesWithoutSearch = [ element: , children: createProjectRoutes, }, + { + path: ':id/domain/add', + element: , + }, ]; export const projectsRoutesWithSearch = [