From cd62e5a77b0eb44540a8407545abd8045af36370 Mon Sep 17 00:00:00 2001 From: aaryan1203 Date: Sat, 18 May 2024 11:44:02 -0400 Subject: [PATCH] #2395 delete wp buttons --- .../src/pages/GanttPage/GanttChart.tsx | 30 ++++----- .../GanttChartCreateButtons.tsx | 61 ------------------- 2 files changed, 11 insertions(+), 80 deletions(-) delete mode 100644 src/frontend/src/pages/GanttPage/GanttChartComponents/GanttChartCreateButtons.tsx diff --git a/src/frontend/src/pages/GanttPage/GanttChart.tsx b/src/frontend/src/pages/GanttPage/GanttChart.tsx index cd14fd0fc0..1d10370f7c 100644 --- a/src/frontend/src/pages/GanttPage/GanttChart.tsx +++ b/src/frontend/src/pages/GanttPage/GanttChart.tsx @@ -1,9 +1,10 @@ -import { Box, Chip, IconButton, Typography, useTheme } from '@mui/material'; +import { Box, Button, Chip, IconButton, Typography, useTheme } from '@mui/material'; import { EventChange, GanttTask, RequestEventChange } from '../../utils/gantt.utils'; import { Edit } from '@mui/icons-material'; import GanttChartSection from './GanttChartSection'; -import GanttChartCreateButtons from './GanttChartComponents/GanttChartCreateButtons'; -import { useEffect, useState } from 'react'; +import { NERButton } from '../../components/NERButton'; +import { useHistory } from 'react-router-dom'; +import { routes } from '../../utils/routes'; interface GanttChartProps { startDate: Date; @@ -31,24 +32,16 @@ const GanttChart = ({ highlightedChange }: GanttChartProps) => { const theme = useTheme(); - const [allTasks, setAllTasks] = useState([]); - - useEffect(() => { - const tasks: GanttTask[] = []; - teamsList.forEach((teamName) => { - const currentTasks = teamNameToGanttTasksMap.get(teamName); - if (currentTasks) { - tasks.push(...currentTasks); - } - }); - - setAllTasks(tasks); - }, [teamNameToGanttTasksMap, teamsList]); + const history = useHistory(); return ( <> - - + + history.push(routes.PROJECTS_NEW)}> + Create Project + + + {teamsList.map((teamName: string) => { const tasks = teamNameToGanttTasksMap.get(teamName); @@ -80,7 +73,6 @@ const GanttChart = ({ tasks.forEach((task) => { task.children.sort((a, b) => a.start.getTime() - b.start.getTime()); }); - return ( = ({ tasks }) => { - const history = useHistory(); - const [showPopUp, setShowPopUp] = useState(false); - const projects = tasks.filter((task) => task.type === 'project'); - console.log('projects', projects); - const [selectedProjectWBS, setSelectedProjectWBS] = useState(''); - - const handleChange = (event: SelectChangeEvent) => { - setSelectedProjectWBS(event.target.value); - }; - - const buildURLForCreateWorkPackage = () => { - return `${routes.WORK_PACKAGE_NEW}?wbs=${projectWbsPipe(validateWBS(selectedProjectWBS))}&crId=null`; - }; - - return ( - - history.push(routes.PROJECTS_NEW)}> - Create Project - - setShowPopUp(true)} sx={{ mx: 1 }}> - Create Work Package - - setShowPopUp(false)} - onSubmit={() => history.push(buildURLForCreateWorkPackage())} - submitText="Continue" - > - - Choose a Project you want to create a Work Package for - - - Project Name - - - - - ); -}; - -export default GanttChartCreateButtons;