From bb723ee58a151ffe1dc9886296c671a27942b7ef Mon Sep 17 00:00:00 2001 From: Nabarun Gogoi Date: Wed, 13 Dec 2023 17:42:39 +0530 Subject: [PATCH] Add dummy data for project cards in home page (#1) * Add switching of repository list and connect account * Populate project cards with dummy projects data * Fix typos of dummy datas * Fix prettier error --------- Co-authored-by: neeraj --- packages/frontend/src/assets/projects.json | 42 +++++++++++++++++++ .../{repository.json => repositories.json} | 0 .../assets/{template.json => templates.json} | 0 packages/frontend/src/components/Card.tsx | 22 ---------- .../src/components/ConnectAccount.tsx | 26 ++++++++++++ .../src/components/HorizontalLine.tsx | 7 ++++ .../frontend/src/components/ProjectCard.tsx | 39 +++++++++++++++++ .../src/components/ProjectRepoCard.tsx | 1 + .../src/components/RepositoryList.tsx | 2 +- packages/frontend/src/pages/Projects.tsx | 13 +++--- .../{CreateProject.tsx => Create.tsx} | 9 ++-- .../frontend/src/pages/projects/routes.tsx | 2 +- 12 files changed, 130 insertions(+), 33 deletions(-) create mode 100644 packages/frontend/src/assets/projects.json rename packages/frontend/src/assets/{repository.json => repositories.json} (100%) rename packages/frontend/src/assets/{template.json => templates.json} (100%) delete mode 100644 packages/frontend/src/components/Card.tsx create mode 100644 packages/frontend/src/components/ConnectAccount.tsx create mode 100644 packages/frontend/src/components/HorizontalLine.tsx create mode 100644 packages/frontend/src/components/ProjectCard.tsx rename packages/frontend/src/pages/projects/{CreateProject.tsx => Create.tsx} (79%) diff --git a/packages/frontend/src/assets/projects.json b/packages/frontend/src/assets/projects.json new file mode 100644 index 00000000..450c401a --- /dev/null +++ b/packages/frontend/src/assets/projects.json @@ -0,0 +1,42 @@ +[ + { + "icon": "^", + "title": "iglotools", + "domain": "iglotools.com", + "latestCommit": { + "message": "Subscription added", + "time": "2023-12-11T04:20:00", + "branch": "main" + } + }, + { + "icon": "^", + "title": "iglotools", + "domain": "iglotools.com", + "latestCommit": { + "message": "404 added", + "time": "2023-12-11T04:20:00", + "branch": "staging" + } + }, + { + "icon": "^", + "title": "iglotools", + "domain": "iglotools.com", + "latestCommit": { + "message": "Design system integrated", + "time": "2023-12-11T04:20:00", + "branch": "main" + } + }, + { + "icon": "^", + "title": "watcher-tool", + "domain": "azimuth-watcher.com", + "latestCommit": { + "message": "Listen for subscription", + "time": "2023-12-10T04:20:00", + "branch": "prod" + } + } +] diff --git a/packages/frontend/src/assets/repository.json b/packages/frontend/src/assets/repositories.json similarity index 100% rename from packages/frontend/src/assets/repository.json rename to packages/frontend/src/assets/repositories.json diff --git a/packages/frontend/src/assets/template.json b/packages/frontend/src/assets/templates.json similarity index 100% rename from packages/frontend/src/assets/template.json rename to packages/frontend/src/assets/templates.json diff --git a/packages/frontend/src/components/Card.tsx b/packages/frontend/src/components/Card.tsx deleted file mode 100644 index e84801c3..00000000 --- a/packages/frontend/src/components/Card.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; - -const Card = () => { - return ( -
-
-
^
-
-

iglotools

-

iglotools.com

-
-
...
-
-
-

Hello world

-

3 day ago main

-
-
- ); -}; - -export default Card; diff --git a/packages/frontend/src/components/ConnectAccount.tsx b/packages/frontend/src/components/ConnectAccount.tsx new file mode 100644 index 00000000..105125fe --- /dev/null +++ b/packages/frontend/src/components/ConnectAccount.tsx @@ -0,0 +1,26 @@ +import React from 'react'; + +const ConnectAccount = () => { + return ( +
+
^
+
+

Connect to your git account

+

+ Once connected, you can create projects by importing repositories + under the account +

+
+
+ + +
+
+ ); +}; + +export default ConnectAccount; diff --git a/packages/frontend/src/components/HorizontalLine.tsx b/packages/frontend/src/components/HorizontalLine.tsx new file mode 100644 index 00000000..204d8b03 --- /dev/null +++ b/packages/frontend/src/components/HorizontalLine.tsx @@ -0,0 +1,7 @@ +import React from 'react'; + +const HorizontalLine = () => { + return
; +}; + +export default HorizontalLine; diff --git a/packages/frontend/src/components/ProjectCard.tsx b/packages/frontend/src/components/ProjectCard.tsx new file mode 100644 index 00000000..86f2f47a --- /dev/null +++ b/packages/frontend/src/components/ProjectCard.tsx @@ -0,0 +1,39 @@ +import React from 'react'; +import { DateTime } from 'luxon'; + +interface projectDetails { + icon: string; + title: string; + domain: string; + latestCommit: { + [key: string]: string; + }; +} + +interface ProjectCardProps { + project: projectDetails; +} + +const ProjectCard: React.FC = ({ project }) => { + return ( +
+
+
{project.icon}
+
+

{project.title}

+

{project.domain}

+
+
...
+
+
+

{project.latestCommit.message}

+

+ {DateTime.fromISO(project.latestCommit.time).toRelative()} on{' '} + {project.latestCommit.branch} +

+
+
+ ); +}; + +export default ProjectCard; diff --git a/packages/frontend/src/components/ProjectRepoCard.tsx b/packages/frontend/src/components/ProjectRepoCard.tsx index 684da84f..5b9bdd40 100644 --- a/packages/frontend/src/components/ProjectRepoCard.tsx +++ b/packages/frontend/src/components/ProjectRepoCard.tsx @@ -5,6 +5,7 @@ interface RepositoryDetails { title: string; updatedTime: string; } + interface ProjectRepoCardProps { repository: RepositoryDetails; } diff --git a/packages/frontend/src/components/RepositoryList.tsx b/packages/frontend/src/components/RepositoryList.tsx index 4b2cf24d..9c3f02bf 100644 --- a/packages/frontend/src/components/RepositoryList.tsx +++ b/packages/frontend/src/components/RepositoryList.tsx @@ -2,7 +2,7 @@ import React from 'react'; import SearchBar from './SearchBar'; import ProjectRepoCard from './ProjectRepoCard'; -import repositoryDetails from '../assets/repository.json'; +import repositoryDetails from '../assets/repositories.json'; const RepositoryList = () => { return ( diff --git a/packages/frontend/src/pages/Projects.tsx b/packages/frontend/src/pages/Projects.tsx index e5d9181e..0d43f4af 100644 --- a/packages/frontend/src/pages/Projects.tsx +++ b/packages/frontend/src/pages/Projects.tsx @@ -2,7 +2,9 @@ import React from 'react'; import { Link } from 'react-router-dom'; import SearchBar from '../components/SearchBar'; -import Card from '../components/Card'; +import ProjectCard from '../components/ProjectCard'; +import HorizontalLine from '../components/HorizontalLine'; +import projectsDetail from '../assets/projects.json'; const Projects = () => { return ( @@ -15,7 +17,7 @@ const Projects = () => {
^
^
-
+

Projects

@@ -30,10 +32,9 @@ const Projects = () => {
- - - - + {projectsDetail.map((project, key) => { + return ; + })}
); diff --git a/packages/frontend/src/pages/projects/CreateProject.tsx b/packages/frontend/src/pages/projects/Create.tsx similarity index 79% rename from packages/frontend/src/pages/projects/CreateProject.tsx rename to packages/frontend/src/pages/projects/Create.tsx index c80054d0..a491bb5c 100644 --- a/packages/frontend/src/pages/projects/CreateProject.tsx +++ b/packages/frontend/src/pages/projects/Create.tsx @@ -1,13 +1,16 @@ import React from 'react'; import { Link } from 'react-router-dom'; -import templateDetails from '../../assets/template.json'; +import templateDetails from '../../assets/templates.json'; import TemplateCard from '../../components/TemplateCard'; import RepositoryList from '../../components/RepositoryList'; +import ConnectAccount from '../../components/ConnectAccount'; + +const isGitAuth = false; const CreateProject = () => { return ( -
+

Create new project

@@ -28,7 +31,7 @@ const CreateProject = () => { })}
Import a repository
- + {isGitAuth ? : }
); }; diff --git a/packages/frontend/src/pages/projects/routes.tsx b/packages/frontend/src/pages/projects/routes.tsx index 6a5ea20e..f988e0b7 100644 --- a/packages/frontend/src/pages/projects/routes.tsx +++ b/packages/frontend/src/pages/projects/routes.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import CreateProject from './CreateProject'; +import CreateProject from './Create'; import Project from './Project'; export const projectsRoutes = [