Reworked resume download feature.

This commit is contained in:
2022-08-28 17:55:45 +02:00
parent ed127d68b1
commit 80478cfa67
10 changed files with 120 additions and 205 deletions

View File

@@ -372,8 +372,8 @@ export default function Home({ socket }: Props) {
<Fragment>
<StackableResult
formattedLog={message[1]}
title={downloadInfoMap.get(message[0])?.title ?? '...'}
thumbnail={downloadInfoMap.get(message[0])?.thumbnail ?? '...'}
title={downloadInfoMap.get(message[0])?.title ?? ''}
thumbnail={downloadInfoMap.get(message[0])?.thumbnail ?? ''}
resolution={downloadInfoMap.get(message[0])?.resolution ?? '...'}
progress={progressMap.get(message[0]) ?? 0}
stopCallback={() => abort(message[0])}

View File

@@ -1,3 +1,4 @@
import React from "react";
import { EightK, FourK, Hd, Sd } from "@mui/icons-material";
import { Button, Card, CardActionArea, CardActions, CardContent, CardMedia, Chip, LinearProgress, Skeleton, Stack, Typography } from "@mui/material";
import { IMessage } from "../interfaces";
@@ -25,7 +26,7 @@ export function StackableResult({ formattedLog, title, thumbnail, resolution, pr
return (
<Card>
<CardActionArea>
{thumbnail ?
{thumbnail !== '' ?
<CardMedia
component="img"
height={180}
@@ -34,9 +35,12 @@ export function StackableResult({ formattedLog, title, thumbnail, resolution, pr
<Skeleton variant="rectangular" height={180} />
}
<CardContent>
<Typography gutterBottom variant="h6" component="div">
{ellipsis(title, 54)}
</Typography>
{title !== '' ?
<Typography gutterBottom variant="h6" component="div">
{ellipsis(title, 54)}
</Typography> :
<Skeleton />
}
<Stack direction="row" spacing={1} py={2}>
<Chip label={formattedLog.status} color="primary" />
<Typography>{formattedLog.progress}</Typography>

View File

@@ -21,7 +21,7 @@ export class I18nBuilder {
const map = this.textMap[this.language]
if (map) {
const translation = map[key];
return translation ? translation : 'caption not defined';
return translation ?? 'caption not defined';
}
return 'caption not defined';
}