From 365ac18bf2604f6c2833f79137fbfe20fef704fd Mon Sep 17 00:00:00 2001 From: Vadim Gedz Date: Mon, 16 Oct 2023 21:39:57 +0300 Subject: [PATCH] chore(ui): change task details page --- web/src/Components/TaskView.js | 237 +++++++++++++++++---------------- 1 file changed, 119 insertions(+), 118 deletions(-) diff --git a/web/src/Components/TaskView.js b/web/src/Components/TaskView.js index 49e196f9..f88e822e 100644 --- a/web/src/Components/TaskView.js +++ b/web/src/Components/TaskView.js @@ -1,125 +1,126 @@ import Box from '@mui/material/Box'; import Container from '@mui/material/Container'; -import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { useEffect, useState } from 'react'; -import { useParams } from 'react-router-dom'; -import { fetchTask } from '../Services/Data'; -import { useErrorContext } from '../ErrorContext'; -import { Grid, Chip } from '@mui/material'; -import { - chipColorByStatus, - formatDateTime, - ProjectDisplay, - StatusReasonDisplay, -} from './TasksTable'; +import {useEffect, useState} from 'react'; +import {useParams} from 'react-router-dom'; +import {fetchTask} from '../Services/Data'; +import {useErrorContext} from '../ErrorContext'; +import {Chip, Divider, Grid, Paper} from '@mui/material'; +import {chipColorByStatus, formatDateTime, ProjectDisplay, StatusReasonDisplay,} from './TasksTable'; + export default function TaskView() { - const { id } = useParams(); - const [task, setTask] = useState(null); - const { setError, setSuccess } = useErrorContext(); + const {id} = useParams(); + const [task, setTask] = useState(null); + const {setError, setSuccess} = useErrorContext(); - useEffect(() => { - fetchTask(id) - .then(item => { - setSuccess('fetchTask', 'Fetched tas successfully'); - setTask(item); - }) - .catch(error => { - setError('fetchTasks', error.message); - }); - }, [id]); + useEffect(() => { + fetchTask(id) + .then((item) => { + setSuccess('fetchTask', 'Fetched task successfully'); + setTask(item); + }) + .catch((error) => { + setError('fetchTasks', error.message); + }); + }, [id]); - return ( - - - - Task details - UTC - - - {!task && Loading...} - {task && ( - - - Id - - - - {task.id} - - - - Created - - - - {formatDateTime(task.created)} - - - - Updated - - - - {formatDateTime(task.updated)} - - - - Application - - - {task.app} - - - Author - - - {task.author} - - - Project - - - - - - Images - - - {task.images.map((item, index) => { - return ( -
- - {item.image}:{item.tag} - -
- ); - })} -
- - Status - - - - - - Status details - - - - -
- )} -
- ); + return ( + + + + Task Details + + UTC + + + {!task && Loading...} + {task && ( + + + Task Information + + + + + ID + + {task.id} + + + + Created + + + {formatDateTime(task.created)} + + + + + Updated + + + {formatDateTime(task.updated)} + + + + + Application + + {task.app} + + + + Author + + {task.author} + + + + Project + + + + + + + + Status + + + + + + Status Details + + + + + + + Images + + + {task.images.map((item, index) => ( + + + Image {index + 1} + + + {item.image}:{item.tag} + + + ))} + + )} + + + ); }