From 471412a8d12c1f4e56a520909678ccb0284ab784 Mon Sep 17 00:00:00 2001 From: Nabarun Gogoi Date: Fri, 15 Dec 2023 12:13:18 +0530 Subject: [PATCH] Create layout for deployments pannel (#4) Co-authored-by: neeraj --- packages/frontend/src/assets/deployments.json | 38 +++++++++++++++ .../src/components/DeploymentDetailsCard.tsx | 48 +++++++++++++++++++ .../frontend/src/components/Deployments.tsx | 41 ++++++++++++++++ packages/frontend/src/components/Overview.tsx | 2 +- packages/frontend/src/components/Sidebar.tsx | 6 ++- packages/frontend/src/components/Tab.tsx | 9 +--- 6 files changed, 133 insertions(+), 11 deletions(-) create mode 100644 packages/frontend/src/assets/deployments.json create mode 100644 packages/frontend/src/components/DeploymentDetailsCard.tsx create mode 100644 packages/frontend/src/components/Deployments.tsx diff --git a/packages/frontend/src/assets/deployments.json b/packages/frontend/src/assets/deployments.json new file mode 100644 index 00000000..6034e7e2 --- /dev/null +++ b/packages/frontend/src/assets/deployments.json @@ -0,0 +1,38 @@ +[ + { + "title": "nextjs-bolerplate-9t44zbky4dg-bygideon-projects", + "status": "Building", + "environment": "Production", + "branch": "prod", + "commit": { + "hash": "9haif19", + "message": "Update hover state" + }, + "author": "Gideon", + "updatedAt": "2023-12-11T04:20:00" + }, + { + "title": "nextjs-bolerplate-9232dwky4dg-bygideon-projects", + "status": "Ready", + "environment": "Preview", + "branch": "prod", + "commit": { + "hash": "43de569", + "message": "Fix lint errors" + }, + "author": "Brad", + "updatedAt": "2023-12-11T04:20:00" + }, + { + "title": "nextjs-bolerplate-9saa22y4dg-bygideon-projects", + "status": "Error", + "environment": "Production", + "branch": "main", + "commit": { + "hash": "4hdsf19", + "message": "Apply style to button" + }, + "author": "Alice", + "updatedAt": "2023-12-11T04:20:00" + } +] diff --git a/packages/frontend/src/components/DeploymentDetailsCard.tsx b/packages/frontend/src/components/DeploymentDetailsCard.tsx new file mode 100644 index 00000000..8cb52ee2 --- /dev/null +++ b/packages/frontend/src/components/DeploymentDetailsCard.tsx @@ -0,0 +1,48 @@ +import React from 'react'; + +import { relativeTime } from '../utils/time'; + +interface DeploymentDetails { + title: string; + status: string; + environment: string; + branch: string; + commit: { + hash: string; + message: string; + }; + author: string; + updatedAt: string; +} + +interface DeployDetailsCardProps { + deployment: DeploymentDetails; +} + +const DeployDetailsCard = ({ deployment }: DeployDetailsCardProps) => { + return ( +
+
+
+

{deployment.title}

+

{deployment.status}

+
+

{deployment.environment}

+
+
+

{deployment.branch}

+

+ {deployment.commit.hash} {deployment.commit.message} +

+
+
+

+ {relativeTime(deployment.updatedAt)} ^ {deployment.author} +

+ +
+
+ ); +}; + +export default DeployDetailsCard; diff --git a/packages/frontend/src/components/Deployments.tsx b/packages/frontend/src/components/Deployments.tsx new file mode 100644 index 00000000..07027171 --- /dev/null +++ b/packages/frontend/src/components/Deployments.tsx @@ -0,0 +1,41 @@ +import React from 'react'; + +import deploymentDetails from '../assets/deployments.json'; +import DeployDetailsCard from './DeploymentDetailsCard'; + +const Deployments = () => { + return ( +
+
+
+ +
+
+ +
+
+ +
+
+
+ {deploymentDetails.map((deployment, key) => { + return ; + })} +
+
+ ); +}; + +export default Deployments; diff --git a/packages/frontend/src/components/Overview.tsx b/packages/frontend/src/components/Overview.tsx index 2d5000d4..f56baa74 100644 --- a/packages/frontend/src/components/Overview.tsx +++ b/packages/frontend/src/components/Overview.tsx @@ -21,7 +21,7 @@ const Overview = ({ project }: OverviewProps) => (

Domain

- + {project.domain ?

{project.domain}

: }

Source

diff --git a/packages/frontend/src/components/Sidebar.tsx b/packages/frontend/src/components/Sidebar.tsx index d01fd17b..f8d14cff 100644 --- a/packages/frontend/src/components/Sidebar.tsx +++ b/packages/frontend/src/components/Sidebar.tsx @@ -1,12 +1,14 @@ import React from 'react'; -import { NavLink } from 'react-router-dom'; +import { Link, NavLink } from 'react-router-dom'; const Sidebar = () => { return (
-

Snowball

+ +

Snowball

+
Organization
diff --git a/packages/frontend/src/components/Tab.tsx b/packages/frontend/src/components/Tab.tsx index 6470c1f4..4b071610 100644 --- a/packages/frontend/src/components/Tab.tsx +++ b/packages/frontend/src/components/Tab.tsx @@ -2,20 +2,13 @@ import React from 'react'; import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; import Overview from './Overview'; +import Deployments from './Deployments'; import { ProjectDetails } from '../types/project'; interface ProjectTabsProps { project: ProjectDetails; } -const Deployments = () => ( -
- Content of deployments tab -

- Contrary to popular belief, Lorem Ipsum is not simply random text. -

-
-); const Database = () => (
Content of database tab