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';
|
||||
|
||||
export const getLinkedProjectListCopy = async(searchBy:any)=>{
|
||||
export const getLinkedProjectList = async(searchBy:any)=>{
|
||||
try {
|
||||
const response = await fetch(`${process.env.REACT_APP_API_URL}/linked-project?searchBy=${searchBy}`);
|
||||
if (!response.ok) {
|
||||
@ -12,3 +12,12 @@ export const getLinkedProjectListCopy = async(searchBy:any)=>{
|
||||
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';
|
||||
|
||||
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 projectListData = await response.json()
|
||||
return projectListData;
|
||||
@ -10,7 +10,7 @@ export const useGetProjectData = (searchBy: any) => {
|
||||
return useQuery(
|
||||
{
|
||||
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()
|
||||
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 React, { useEffect } from "react";
|
||||
// import { getLinkedProjects, useGetLinkedProjects } from "APIs/getLinkedProjects";
|
||||
// import { useGetUnlinkedProjects } from "APIs/getUnlinkedProjects";
|
||||
// import { useGetProjectData } from "APIs/getProject";
|
||||
import { getLinkedProjectList, useLinkedProjectData } from "../APIs/ProjectScreenAPIs/getLinkedProject";
|
||||
import { useUnlinkedProjectData } from "../APIs/ProjectScreenAPIs/getUnlinkedProject";
|
||||
|
||||
export default function Dashboard(){
|
||||
|
||||
const [linkedProjectData, setLinkedProjectData] = React.useState()
|
||||
// const { data: getLinkedProjectList } = useGetLinkedProjects();
|
||||
// const { data: getUnlinkedProjectList } = useGetUnlinkedProjects();
|
||||
const { data: getLinkedProjectList } = useLinkedProjectData('');
|
||||
const { data: getUnlinkedProjectList } = useUnlinkedProjectData('');
|
||||
|
||||
const Item = styled(Paper)(({ theme }) => ({
|
||||
backgroundColor: '#1e1e1e',
|
||||
@ -20,14 +19,14 @@ export default function Dashboard(){
|
||||
|
||||
return (
|
||||
<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 item xs={5.2} sx={{marginTop:'6%'}}>
|
||||
<Grid item xs={6} sx={{marginTop:'6%'}}>
|
||||
<Item>
|
||||
<Grid container spacing={2} sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
||||
<Grid item>
|
||||
<Typography component="h2" variant="h2" style={{color: '#C00243', fontWeight: 'bold'}}>
|
||||
{/* {getUnlinkedProjectList && getUnlinkedProjectList.length} */}
|
||||
{getUnlinkedProjectList && getUnlinkedProjectList.length}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
@ -38,12 +37,12 @@ export default function Dashboard(){
|
||||
</Grid>
|
||||
</Item>
|
||||
</Grid>
|
||||
<Grid item xs={5.2} sx={{marginTop:'6%'}}>
|
||||
<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} */}
|
||||
{getLinkedProjectList && getLinkedProjectList.length}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import React from "react";
|
||||
import ProjectList from "./ProjectsList";
|
||||
import { useGetProjectDataRQ } from "../../APIs/getProjectRQ";
|
||||
import { getProjectListCopy } from "../../APIs/ProjectScreenAPIs/getProject";
|
||||
import { getProjectList } from "../../APIs/ProjectScreenAPIs/getProject";
|
||||
import { useState } 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 { getPublishedProjects } from "../../APIs/ProjectScreenAPIs/getPublishedProject";
|
||||
import { getUnlinkedProjects } from "../../APIs/ProjectScreenAPIs/getUnlinkedProject";
|
||||
@ -19,10 +19,10 @@ export default function Projects(){
|
||||
|
||||
useEffect(()=>{
|
||||
if(selectedContractFilter=='All'){
|
||||
setContractFilterResponseData(getProjectListCopy(searchByFilter))
|
||||
setContractFilterResponseData(getProjectList(searchByFilter))
|
||||
}
|
||||
else if (selectedContractFilter=='linked'){
|
||||
setContractFilterResponseData(getLinkedProjectListCopy(searchByFilter))
|
||||
setContractFilterResponseData(getLinkedProjectList(searchByFilter))
|
||||
}
|
||||
else if (selectedContractFilter=='unlinked'){
|
||||
setContractFilterResponseData(getUnlinkedProjects(searchByFilter))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user