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 <neeraj.rtly@gmail.com>
This commit is contained in:
parent
87ca0e3403
commit
bb723ee58a
42
packages/frontend/src/assets/projects.json
Normal file
42
packages/frontend/src/assets/projects.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -1,22 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
const Card = () => {
|
|
||||||
return (
|
|
||||||
<div className="bg-white border border-gray-200 rounded-lg shadow">
|
|
||||||
<div className="flex gap-2 p-2 items-center">
|
|
||||||
<div>^</div>
|
|
||||||
<div className="grow">
|
|
||||||
<p className="text-sm text-gray-750">iglotools</p>
|
|
||||||
<p className="text-sm text-gray-400">iglotools.com</p>
|
|
||||||
</div>
|
|
||||||
<div>...</div>
|
|
||||||
</div>
|
|
||||||
<div className="border-slate-200 border-t-2 border-solid p-4 text-gray-500 text-xs">
|
|
||||||
<p>Hello world</p>
|
|
||||||
<p>3 day ago main</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Card;
|
|
26
packages/frontend/src/components/ConnectAccount.tsx
Normal file
26
packages/frontend/src/components/ConnectAccount.tsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const ConnectAccount = () => {
|
||||||
|
return (
|
||||||
|
<div className="bg-gray-100 flex flex-col p-4 justify-end items-center text-center text-sm h-60 rounded-2xl">
|
||||||
|
<div>^</div>
|
||||||
|
<div>
|
||||||
|
<p>Connect to your git account</p>
|
||||||
|
<p>
|
||||||
|
Once connected, you can create projects by importing repositories
|
||||||
|
under the account
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button className="bg-gray-300 rounded-full mx-2">
|
||||||
|
Connect to Github
|
||||||
|
</button>
|
||||||
|
<button className="bg-gray-300 rounded-full mx-2">
|
||||||
|
Connect to Gitea
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ConnectAccount;
|
7
packages/frontend/src/components/HorizontalLine.tsx
Normal file
7
packages/frontend/src/components/HorizontalLine.tsx
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const HorizontalLine = () => {
|
||||||
|
return <hr className="h-px bg-slate-200 border-0" />;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HorizontalLine;
|
39
packages/frontend/src/components/ProjectCard.tsx
Normal file
39
packages/frontend/src/components/ProjectCard.tsx
Normal file
@ -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<ProjectCardProps> = ({ project }) => {
|
||||||
|
return (
|
||||||
|
<div className="bg-white border border-gray-200 rounded-lg shadow">
|
||||||
|
<div className="flex gap-2 p-2 items-center">
|
||||||
|
<div>{project.icon}</div>
|
||||||
|
<div className="grow">
|
||||||
|
<p className="text-sm text-gray-750">{project.title}</p>
|
||||||
|
<p className="text-sm text-gray-400">{project.domain}</p>
|
||||||
|
</div>
|
||||||
|
<div>...</div>
|
||||||
|
</div>
|
||||||
|
<div className="border-slate-200 border-t-2 border-solid p-4 text-gray-500 text-xs">
|
||||||
|
<p>{project.latestCommit.message}</p>
|
||||||
|
<p>
|
||||||
|
{DateTime.fromISO(project.latestCommit.time).toRelative()} on{' '}
|
||||||
|
{project.latestCommit.branch}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ProjectCard;
|
@ -5,6 +5,7 @@ interface RepositoryDetails {
|
|||||||
title: string;
|
title: string;
|
||||||
updatedTime: string;
|
updatedTime: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ProjectRepoCardProps {
|
interface ProjectRepoCardProps {
|
||||||
repository: RepositoryDetails;
|
repository: RepositoryDetails;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import SearchBar from './SearchBar';
|
import SearchBar from './SearchBar';
|
||||||
import ProjectRepoCard from './ProjectRepoCard';
|
import ProjectRepoCard from './ProjectRepoCard';
|
||||||
import repositoryDetails from '../assets/repository.json';
|
import repositoryDetails from '../assets/repositories.json';
|
||||||
|
|
||||||
const RepositoryList = () => {
|
const RepositoryList = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -2,7 +2,9 @@ import React from 'react';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import SearchBar from '../components/SearchBar';
|
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 = () => {
|
const Projects = () => {
|
||||||
return (
|
return (
|
||||||
@ -15,7 +17,7 @@ const Projects = () => {
|
|||||||
<div className="text-gray-300">^</div>
|
<div className="text-gray-300">^</div>
|
||||||
<div className="text-gray-300">^</div>
|
<div className="text-gray-300">^</div>
|
||||||
</div>
|
</div>
|
||||||
<hr className="h-px bg-slate-200 border-0" />
|
<HorizontalLine />
|
||||||
<div className="flex p-4">
|
<div className="flex p-4">
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<h3 className="text-gray-750 text-2xl">Projects</h3>
|
<h3 className="text-gray-750 text-2xl">Projects</h3>
|
||||||
@ -30,10 +32,9 @@ const Projects = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-3 gap-5 p-5">
|
<div className="grid grid-cols-3 gap-5 p-5">
|
||||||
<Card />
|
{projectsDetail.map((project, key) => {
|
||||||
<Card />
|
return <ProjectCard project={project} key={key} />;
|
||||||
<Card />
|
})}
|
||||||
<Card />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import templateDetails from '../../assets/template.json';
|
import templateDetails from '../../assets/templates.json';
|
||||||
import TemplateCard from '../../components/TemplateCard';
|
import TemplateCard from '../../components/TemplateCard';
|
||||||
import RepositoryList from '../../components/RepositoryList';
|
import RepositoryList from '../../components/RepositoryList';
|
||||||
|
import ConnectAccount from '../../components/ConnectAccount';
|
||||||
|
|
||||||
|
const isGitAuth = false;
|
||||||
|
|
||||||
const CreateProject = () => {
|
const CreateProject = () => {
|
||||||
return (
|
return (
|
||||||
<div className="bg-white rounded-3xl h-full">
|
<div className="bg-white rounded-3xl h-full p-4">
|
||||||
<div className="flex p-2">
|
<div className="flex p-2">
|
||||||
<div className="grow p-4">
|
<div className="grow p-4">
|
||||||
<h3 className="text-gray-750 text-2xl">Create new project</h3>
|
<h3 className="text-gray-750 text-2xl">Create new project</h3>
|
||||||
@ -28,7 +31,7 @@ const CreateProject = () => {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<h5 className="mt-4 ml-4">Import a repository</h5>
|
<h5 className="mt-4 ml-4">Import a repository</h5>
|
||||||
<RepositoryList />
|
{isGitAuth ? <RepositoryList /> : <ConnectAccount />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import CreateProject from './CreateProject';
|
import CreateProject from './Create';
|
||||||
import Project from './Project';
|
import Project from './Project';
|
||||||
|
|
||||||
export const projectsRoutes = [
|
export const projectsRoutes = [
|
||||||
|
Loading…
Reference in New Issue
Block a user