optimized and responsive dashboard
This commit is contained in:
parent
b4edc35211
commit
6e58c4ed38
@ -1,62 +1,54 @@
|
|||||||
import { Box, Card, CardContent, Grid, Paper, Typography, styled } from "@mui/material";
|
import React from "react";
|
||||||
import React, { useEffect } from "react";
|
import {
|
||||||
import { getLinkedProjectList, useLinkedProjectData } from "../APIs/ProjectScreenAPIs/getLinkedProject";
|
Box,
|
||||||
|
Grid,
|
||||||
|
Paper,
|
||||||
|
Typography,
|
||||||
|
styled,
|
||||||
|
} from "@mui/material";
|
||||||
import { useUnlinkedProjectData } from "../APIs/ProjectScreenAPIs/getUnlinkedProject";
|
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 Dashboard = () => {
|
||||||
const { data: getLinkedProjectList } = useLinkedProjectData('');
|
const { data: unlinkedProjects } = useUnlinkedProjectData("");
|
||||||
const { data: getUnlinkedProjectList } = useUnlinkedProjectData('');
|
const { data: linkedProjects } = useLinkedProjectData("");
|
||||||
|
|
||||||
const Item = styled(Paper)(({ theme }) => ({
|
return (
|
||||||
backgroundColor: '#1e1e1e',
|
<Paper square className="app-background app-screen-heights" sx={{}}>
|
||||||
color:"white",
|
<Box sx={{ flexGrow: 1, marginLeft: "1%",marginRight:'1%', padding: "16px" }}>
|
||||||
padding: theme.spacing(5),
|
<Grid container spacing={3} sx={{ flexDirection: { xs: 'column', md: 'row' } }}>
|
||||||
textAlign: 'left',
|
{renderDashboardItem("New Projects That needs Contract Linkage", unlinkedProjects, "#C00243")}
|
||||||
|
{renderDashboardItem("Projects That needs To Be Published", linkedProjects, "#E1AB1A")}
|
||||||
}));
|
</Grid>
|
||||||
|
</Box>
|
||||||
|
</Paper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
const renderDashboardItem = (label:any, projects:any, color:any) => (
|
||||||
<Paper square className="app-background app-screen-heights">
|
<Grid item xs={12} md={6} sx={{ marginTop: "16px" }}>
|
||||||
<Box sx={{ flexGrow: 1, margin:'1%'}} >
|
<DashboardItem>
|
||||||
<Grid container spacing={3} >
|
<Grid container spacing={2} sx={{ flexDirection: "row", flexWrap: "nowrap" }}>
|
||||||
<Grid item xs={6} sx={{marginTop:'6%'}}>
|
<Grid item>
|
||||||
<Item>
|
<Typography component="h2" variant="h2" sx={{ color, fontWeight: "bold" }}>
|
||||||
<Grid container spacing={2} sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
{projects && projects.length}
|
||||||
<Grid item>
|
</Typography>
|
||||||
<Typography component="h2" variant="h2" style={{color: '#C00243', fontWeight: 'bold'}}>
|
</Grid>
|
||||||
{getUnlinkedProjectList && getUnlinkedProjectList.length}
|
<Grid item>
|
||||||
</Typography>
|
<Typography component="h6" variant="h6" sx={{ color, margin: "3%" }}>
|
||||||
</Grid>
|
{`${label}`}
|
||||||
<Grid item>
|
</Typography>
|
||||||
<Typography component="h6" variant="h6" style={{color: '#C00243', margin: '3%'}}>
|
</Grid>
|
||||||
New Projects That needs Contract Linkage
|
</Grid>
|
||||||
</Typography>
|
</DashboardItem>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
);
|
||||||
</Item>
|
|
||||||
</Grid>
|
export default Dashboard;
|
||||||
<Grid item xs={6} sx={{marginTop:'6%'}}>
|
|
||||||
<Item>
|
|
||||||
<Grid container sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
|
||||||
<Grid item>
|
|
||||||
<Typography component="h2" variant="h2" style={{color: '#E1AB1A', fontWeight: 'bold'}}>
|
|
||||||
{getLinkedProjectList && getLinkedProjectList.length}
|
|
||||||
</Typography>
|
|
||||||
</Grid>
|
|
||||||
<Grid item>
|
|
||||||
<Typography component="h6" variant="h6" style={{color: '#E1AB1A', margin: '3%'}}>
|
|
||||||
Projects That needs To Be Published
|
|
||||||
</Typography>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Item>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Box>
|
|
||||||
</Paper>
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user