From 6e58c4ed387bd93fd00b86625377483637469822 Mon Sep 17 00:00:00 2001 From: Sonika Date: Fri, 22 Dec 2023 21:31:47 +0530 Subject: [PATCH] optimized and responsive dashboard --- src/components/Dashboard.tsx | 106 ++++++++++++++++------------------- 1 file changed, 49 insertions(+), 57 deletions(-) diff --git a/src/components/Dashboard.tsx b/src/components/Dashboard.tsx index 8c405c8..6e6d431 100644 --- a/src/components/Dashboard.tsx +++ b/src/components/Dashboard.tsx @@ -1,62 +1,54 @@ -import { Box, Card, CardContent, Grid, Paper, Typography, styled } from "@mui/material"; -import React, { useEffect } from "react"; -import { getLinkedProjectList, useLinkedProjectData } from "../APIs/ProjectScreenAPIs/getLinkedProject"; +import React from "react"; +import { + Box, + Grid, + Paper, + Typography, + styled, +} from "@mui/material"; import { useUnlinkedProjectData } from "../APIs/ProjectScreenAPIs/getUnlinkedProject"; +import { useLinkedProjectData } from "../APIs/ProjectScreenAPIs/getLinkedProject"; -export default function Dashboard(){ +const DashboardItem = styled(Paper)(({ theme }) => ({ + backgroundColor: "#1e1e1e", + color: "white", + padding: theme.spacing(5), + textAlign: "left", +})); - const [linkedProjectData, setLinkedProjectData] = React.useState() - const { data: getLinkedProjectList } = useLinkedProjectData(''); - const { data: getUnlinkedProjectList } = useUnlinkedProjectData(''); +const Dashboard = () => { + const { data: unlinkedProjects } = useUnlinkedProjectData(""); + const { data: linkedProjects } = useLinkedProjectData(""); - const Item = styled(Paper)(({ theme }) => ({ - backgroundColor: '#1e1e1e', - color:"white", - padding: theme.spacing(5), - textAlign: 'left', - - })); + return ( + + + + {renderDashboardItem("New Projects That needs Contract Linkage", unlinkedProjects, "#C00243")} + {renderDashboardItem("Projects That needs To Be Published", linkedProjects, "#E1AB1A")} + + + + ); +}; - return ( - - - - - - - - - {getUnlinkedProjectList && getUnlinkedProjectList.length} - - - - - New Projects That needs Contract Linkage - - - - - - - - - - - {getLinkedProjectList && getLinkedProjectList.length} - - - - - Projects That needs To Be Published - - - - - - - - - - - ) -} \ No newline at end of file +const renderDashboardItem = (label:any, projects:any, color:any) => ( + + + + + + {projects && projects.length} + + + + + {`${label}`} + + + + + +); + +export default Dashboard;