Dashboard style changes , API changes
This commit is contained in:
parent
866efea933
commit
28605753a1
@ -1,6 +1,6 @@
|
|||||||
import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
||||||
|
|
||||||
export const getLinkedProjectListCopy = async(searchBy:any)=>{
|
export const getLinkedProjectList = async(searchBy:any)=>{
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${process.env.REACT_APP_API_URL}/linked-project?searchBy=${searchBy}`);
|
const response = await fetch(`${process.env.REACT_APP_API_URL}/linked-project?searchBy=${searchBy}`);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
@ -12,3 +12,12 @@ export const getLinkedProjectListCopy = async(searchBy:any)=>{
|
|||||||
console.error('Error fetching data:', error);
|
console.error('Error fetching data:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const useLinkedProjectData = (searchBy: any) => {
|
||||||
|
return useQuery(
|
||||||
|
{
|
||||||
|
queryKey: ['linked-project-list', searchBy],
|
||||||
|
queryFn: () => getLinkedProjectList(searchBy)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
import {useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
||||||
|
|
||||||
export const getProjectListCopy = async(searchBy:any)=>{
|
export const getProjectList = async(searchBy:any)=>{
|
||||||
const response = await fetch(`${process.env.REACT_APP_API_URL}/project-list?searchBy=`);
|
const response = await fetch(`${process.env.REACT_APP_API_URL}/project-list?searchBy=`);
|
||||||
const projectListData = await response.json()
|
const projectListData = await response.json()
|
||||||
return projectListData;
|
return projectListData;
|
||||||
@ -10,7 +10,7 @@ export const useGetProjectData = (searchBy: any) => {
|
|||||||
return useQuery(
|
return useQuery(
|
||||||
{
|
{
|
||||||
queryKey: ['Project-list', searchBy],
|
queryKey: ['Project-list', searchBy],
|
||||||
queryFn: () => getProjectListCopy(searchBy)
|
queryFn: () => getProjectList(searchBy)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -5,3 +5,12 @@ export const getUnlinkedProjects = async(searchBy:any)=>{
|
|||||||
const projectListData = await response.json()
|
const projectListData = await response.json()
|
||||||
return projectListData;
|
return projectListData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const useUnlinkedProjectData = (searchBy: any) => {
|
||||||
|
return useQuery(
|
||||||
|
{
|
||||||
|
queryKey: ['unlinked-project-list', searchBy],
|
||||||
|
queryFn: () => getUnlinkedProjects(searchBy)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
import { Box, Card, CardContent, Grid, Paper, Typography, styled } from "@mui/material";
|
import { Box, Card, CardContent, Grid, Paper, Typography, styled } from "@mui/material";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
// import { getLinkedProjects, useGetLinkedProjects } from "APIs/getLinkedProjects";
|
import { getLinkedProjectList, useLinkedProjectData } from "../APIs/ProjectScreenAPIs/getLinkedProject";
|
||||||
// import { useGetUnlinkedProjects } from "APIs/getUnlinkedProjects";
|
import { useUnlinkedProjectData } from "../APIs/ProjectScreenAPIs/getUnlinkedProject";
|
||||||
// import { useGetProjectData } from "APIs/getProject";
|
|
||||||
|
|
||||||
export default function Dashboard(){
|
export default function Dashboard(){
|
||||||
|
|
||||||
const [linkedProjectData, setLinkedProjectData] = React.useState()
|
const [linkedProjectData, setLinkedProjectData] = React.useState()
|
||||||
// const { data: getLinkedProjectList } = useGetLinkedProjects();
|
const { data: getLinkedProjectList } = useLinkedProjectData('');
|
||||||
// const { data: getUnlinkedProjectList } = useGetUnlinkedProjects();
|
const { data: getUnlinkedProjectList } = useUnlinkedProjectData('');
|
||||||
|
|
||||||
const Item = styled(Paper)(({ theme }) => ({
|
const Item = styled(Paper)(({ theme }) => ({
|
||||||
backgroundColor: '#1e1e1e',
|
backgroundColor: '#1e1e1e',
|
||||||
@ -20,14 +19,14 @@ export default function Dashboard(){
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper square className="app-background app-screen-heights">
|
<Paper square className="app-background app-screen-heights">
|
||||||
<Box sx={{ flexGrow: 1 ,width:'100%'}} >
|
<Box sx={{ flexGrow: 1, margin:'1%'}} >
|
||||||
<Grid container spacing={3} >
|
<Grid container spacing={3} >
|
||||||
<Grid item xs={5.2} sx={{marginTop:'6%'}}>
|
<Grid item xs={6} sx={{marginTop:'6%'}}>
|
||||||
<Item>
|
<Item>
|
||||||
<Grid container spacing={2} sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
<Grid container spacing={2} sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Typography component="h2" variant="h2" style={{color: '#C00243', fontWeight: 'bold'}}>
|
<Typography component="h2" variant="h2" style={{color: '#C00243', fontWeight: 'bold'}}>
|
||||||
{/* {getUnlinkedProjectList && getUnlinkedProjectList.length} */}
|
{getUnlinkedProjectList && getUnlinkedProjectList.length}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
@ -38,12 +37,12 @@ export default function Dashboard(){
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Item>
|
</Item>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={5.2} sx={{marginTop:'6%'}}>
|
<Grid item xs={6} sx={{marginTop:'6%'}}>
|
||||||
<Item>
|
<Item>
|
||||||
<Grid container sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
<Grid container sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Typography component="h2" variant="h2" style={{color: '#E1AB1A', fontWeight: 'bold'}}>
|
<Typography component="h2" variant="h2" style={{color: '#E1AB1A', fontWeight: 'bold'}}>
|
||||||
{/* {getLinkedProjectList && getLinkedProjectList.length} */}
|
{getLinkedProjectList && getLinkedProjectList.length}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import ProjectList from "./ProjectsList";
|
import ProjectList from "./ProjectsList";
|
||||||
import { useGetProjectDataRQ } from "../../APIs/getProjectRQ";
|
import { useGetProjectDataRQ } from "../../APIs/getProjectRQ";
|
||||||
import { getProjectListCopy } from "../../APIs/ProjectScreenAPIs/getProject";
|
import { getProjectList } from "../../APIs/ProjectScreenAPIs/getProject";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { getLinkedProjectListCopy } from "../../APIs/ProjectScreenAPIs/getLinkedProject";
|
import { getLinkedProjectList } from "../../APIs/ProjectScreenAPIs/getLinkedProject";
|
||||||
import { Box, Card, CardContent, FormControl, Grid, InputLabel, MenuItem, Paper, Select, TextField } from "@mui/material";
|
import { Box, Card, CardContent, FormControl, Grid, InputLabel, MenuItem, Paper, Select, TextField } from "@mui/material";
|
||||||
import { getPublishedProjects } from "../../APIs/ProjectScreenAPIs/getPublishedProject";
|
import { getPublishedProjects } from "../../APIs/ProjectScreenAPIs/getPublishedProject";
|
||||||
import { getUnlinkedProjects } from "../../APIs/ProjectScreenAPIs/getUnlinkedProject";
|
import { getUnlinkedProjects } from "../../APIs/ProjectScreenAPIs/getUnlinkedProject";
|
||||||
@ -19,10 +19,10 @@ export default function Projects(){
|
|||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(selectedContractFilter=='All'){
|
if(selectedContractFilter=='All'){
|
||||||
setContractFilterResponseData(getProjectListCopy(searchByFilter))
|
setContractFilterResponseData(getProjectList(searchByFilter))
|
||||||
}
|
}
|
||||||
else if (selectedContractFilter=='linked'){
|
else if (selectedContractFilter=='linked'){
|
||||||
setContractFilterResponseData(getLinkedProjectListCopy(searchByFilter))
|
setContractFilterResponseData(getLinkedProjectList(searchByFilter))
|
||||||
}
|
}
|
||||||
else if (selectedContractFilter=='unlinked'){
|
else if (selectedContractFilter=='unlinked'){
|
||||||
setContractFilterResponseData(getUnlinkedProjects(searchByFilter))
|
setContractFilterResponseData(getUnlinkedProjects(searchByFilter))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user