From 06aa40630f0daca95d06677a982903b265656c55 Mon Sep 17 00:00:00 2001 From: robo <30987265+Robonau@users.noreply.github.com> Date: Thu, 3 Mar 2022 21:05:14 +0000 Subject: [PATCH] more Download Queue info (#138) * Download Queue info add Imanga type definition to IDownloadChapter add source name to queue add manga name to queue * more like tachi * add back state and % data * yup forgot to remove after --- src/screens/DownloadQueue.tsx | 52 +++++++++++++++++++++++++++-------- src/typings.d.ts | 1 + 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/screens/DownloadQueue.tsx b/src/screens/DownloadQueue.tsx index 66f9e3a1..21801ef1 100644 --- a/src/screens/DownloadQueue.tsx +++ b/src/screens/DownloadQueue.tsx @@ -23,9 +23,12 @@ import List from '@mui/material/List'; import DragHandleIcon from '@mui/icons-material/DragHandle'; import ListItem from '@mui/material/ListItem'; import { ListItemIcon } from '@mui/material'; -import ListItemText from '@mui/material/ListItemText'; import EmptyView from 'components/util/EmptyView'; +import { Box } from '@mui/system'; +import Typography from '@mui/material/Typography'; +import { useHistory } from 'react-router-dom'; + const baseWebsocketUrl = JSON.parse(window.localStorage.getItem('serverBaseURL')!).replace('http', 'ws'); const getItemStyle = (isDragging: boolean, @@ -48,6 +51,8 @@ export default function DownloadQueue() { const [queueState, setQueueState] = useState(initialQueue); const { queue, status } = queueState; + const history = useHistory(); + const theme = useTheme(); const { setTitle, setAction } = useContext(NavbarContext); @@ -111,6 +116,22 @@ export default function DownloadQueue() { {(provided, snapshot) => ( history.push(`/manga/${item.chapter.mangaId}`)} {...provided.draggableProps} {...provided.dragHandleProps} style={getItemStyle( @@ -120,19 +141,27 @@ export default function DownloadQueue() { )} ref={provided.innerRef} > - + - state: ${item.state}` - } - /> + + + + {item.manga.title} + + + {`${item.chapter.name} ` + + `(${(item.progress * 100).toFixed(2)}%)` + + ` => state: ${item.state}`} + + + { - // deleteCategory(index); + sx={{ marginLeft: 'auto' }} + onClick={(e) => { + // deleteCategory(index); + // prevent parent tags from getting the event + e.stopPropagation(); }} size="large" > @@ -141,6 +170,7 @@ export default function DownloadQueue() { )} + ))} {provided.placeholder} diff --git a/src/typings.d.ts b/src/typings.d.ts index 6e68fabf..b47359cd 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -155,6 +155,7 @@ interface IDownloadChapter{ state: 'Queued' | 'Downloading' | 'Finished' | 'Error' progress: number chapter: IChapter + manga: IManga } interface IQueue {