mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-05-22 06:03:01 +02:00
MangaPopup placeholder for Chapterdownload: maxdownloadedchapter
This commit is contained in:
parent
35e2e6ce16
commit
4e648bd04e
@ -1,7 +1,12 @@
|
||||
import IManga from "../api/types/IManga.ts";
|
||||
import {Badge, Box, Chip, CircularProgress, Drawer, Input, Link, Skeleton, Stack, Typography} from "@mui/joy";
|
||||
import {ReactElement, useCallback, useContext, useEffect, useRef, useState} from "react";
|
||||
import {GetLatestChapterAvailable, GetMangaCoverImageUrl, SetIgnoreThreshold} from "../api/Manga.tsx";
|
||||
import {
|
||||
GetLatestChapterAvailable,
|
||||
GetLatestChapterDownloaded,
|
||||
GetMangaCoverImageUrl,
|
||||
SetIgnoreThreshold
|
||||
} from "../api/Manga.tsx";
|
||||
import {ApiUriContext, getData} from "../api/fetchApi.tsx";
|
||||
import MarkdownPreview from "@uiw/react-markdown-preview";
|
||||
import {CardHeight} from "./Manga.tsx";
|
||||
@ -33,6 +38,7 @@ export default function MangaPopup({manga, open, children} : {manga: IManga | nu
|
||||
if(!open)
|
||||
return;
|
||||
LoadMaxChapter();
|
||||
LoadDownloadedChapter();
|
||||
LoadMangaCover();
|
||||
}, [open]);
|
||||
|
||||
@ -47,6 +53,17 @@ export default function MangaPopup({manga, open, children} : {manga: IManga | nu
|
||||
.finally(() => setMaxChapterLoading(false));
|
||||
}, [manga, apiUri]);
|
||||
|
||||
const [mangaDownloadedChapter, setMangaDownloadedChapter] = useState<IChapter>();
|
||||
const [downloadedChapterLoading, setDownloadedChapterLoading] = useState<boolean>(true);
|
||||
const LoadDownloadedChapter = useCallback(() => {
|
||||
if(manga == null)
|
||||
return;
|
||||
setDownloadedChapterLoading(true);
|
||||
GetLatestChapterDownloaded(apiUri, manga.mangaId)
|
||||
.then(setMangaDownloadedChapter)
|
||||
.finally(() => setDownloadedChapterLoading(false));
|
||||
}, [manga, apiUri]);
|
||||
|
||||
const [updatingThreshold, setUpdatingThreshold] = useState<boolean>(false);
|
||||
const updateIgnoreThreshhold = useCallback((value: number) => {
|
||||
if(manga == null)
|
||||
@ -88,7 +105,7 @@ export default function MangaPopup({manga, open, children} : {manga: IManga | nu
|
||||
<Stack direction="row" spacing={2}>
|
||||
<Input
|
||||
type={"number"}
|
||||
placeholder={"0.0"}
|
||||
placeholder={downloadedChapterLoading ? "" : mangaDownloadedChapter?.chapterNumber??"0.0"}
|
||||
startDecorator={
|
||||
<>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user