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
This commit is contained in:
@@ -23,9 +23,12 @@ import List from '@mui/material/List';
|
|||||||
import DragHandleIcon from '@mui/icons-material/DragHandle';
|
import DragHandleIcon from '@mui/icons-material/DragHandle';
|
||||||
import ListItem from '@mui/material/ListItem';
|
import ListItem from '@mui/material/ListItem';
|
||||||
import { ListItemIcon } from '@mui/material';
|
import { ListItemIcon } from '@mui/material';
|
||||||
import ListItemText from '@mui/material/ListItemText';
|
|
||||||
import EmptyView from 'components/util/EmptyView';
|
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 baseWebsocketUrl = JSON.parse(window.localStorage.getItem('serverBaseURL')!).replace('http', 'ws');
|
||||||
|
|
||||||
const getItemStyle = (isDragging: boolean,
|
const getItemStyle = (isDragging: boolean,
|
||||||
@@ -48,6 +51,8 @@ export default function DownloadQueue() {
|
|||||||
const [queueState, setQueueState] = useState<IQueue>(initialQueue);
|
const [queueState, setQueueState] = useState<IQueue>(initialQueue);
|
||||||
const { queue, status } = queueState;
|
const { queue, status } = queueState;
|
||||||
|
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const { setTitle, setAction } = useContext(NavbarContext);
|
const { setTitle, setAction } = useContext(NavbarContext);
|
||||||
@@ -111,6 +116,22 @@ export default function DownloadQueue() {
|
|||||||
{(provided, snapshot) => (
|
{(provided, snapshot) => (
|
||||||
<ListItem
|
<ListItem
|
||||||
ContainerProps={{ ref: provided.innerRef } as any}
|
ContainerProps={{ ref: provided.innerRef } as any}
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
padding: 2,
|
||||||
|
margin: '10px',
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: 'action.hover',
|
||||||
|
transition: 'background-color 100ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
||||||
|
},
|
||||||
|
'&:active': {
|
||||||
|
backgroundColor: 'action.selected',
|
||||||
|
transition: 'background-color 100ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
onClick={() => history.push(`/manga/${item.chapter.mangaId}`)}
|
||||||
{...provided.draggableProps}
|
{...provided.draggableProps}
|
||||||
{...provided.dragHandleProps}
|
{...provided.dragHandleProps}
|
||||||
style={getItemStyle(
|
style={getItemStyle(
|
||||||
@@ -120,19 +141,27 @@ export default function DownloadQueue() {
|
|||||||
)}
|
)}
|
||||||
ref={provided.innerRef}
|
ref={provided.innerRef}
|
||||||
>
|
>
|
||||||
<ListItemIcon>
|
<ListItemIcon sx={{ margin: 'auto 0' }}>
|
||||||
<DragHandleIcon />
|
<DragHandleIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText
|
<Box sx={{ display: 'flex' }}>
|
||||||
primary={
|
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
|
||||||
`${item.chapter.name} | `
|
<Typography variant="h5" component="h2">
|
||||||
+ ` (${(item.progress * 100).toFixed(2)}%)`
|
{item.manga.title}
|
||||||
+ ` => state: ${item.state}`
|
</Typography>
|
||||||
}
|
<Typography variant="caption" display="block" gutterBottom>
|
||||||
/>
|
{`${item.chapter.name} `
|
||||||
|
+ `(${(item.progress * 100).toFixed(2)}%)`
|
||||||
|
+ ` => state: ${item.state}`}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => {
|
sx={{ marginLeft: 'auto' }}
|
||||||
// deleteCategory(index);
|
onClick={(e) => {
|
||||||
|
// deleteCategory(index);
|
||||||
|
// prevent parent tags from getting the event
|
||||||
|
e.stopPropagation();
|
||||||
}}
|
}}
|
||||||
size="large"
|
size="large"
|
||||||
>
|
>
|
||||||
@@ -141,6 +170,7 @@ export default function DownloadQueue() {
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
)}
|
)}
|
||||||
</Draggable>
|
</Draggable>
|
||||||
|
|
||||||
))}
|
))}
|
||||||
{provided.placeholder}
|
{provided.placeholder}
|
||||||
</List>
|
</List>
|
||||||
|
|||||||
1
src/typings.d.ts
vendored
1
src/typings.d.ts
vendored
@@ -155,6 +155,7 @@ interface IDownloadChapter{
|
|||||||
state: 'Queued' | 'Downloading' | 'Finished' | 'Error'
|
state: 'Queued' | 'Downloading' | 'Finished' | 'Error'
|
||||||
progress: number
|
progress: number
|
||||||
chapter: IChapter
|
chapter: IChapter
|
||||||
|
manga: IManga
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IQueue {
|
interface IQueue {
|
||||||
|
|||||||
Reference in New Issue
Block a user