mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-05-22 14:13:02 +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 IManga from "../api/types/IManga.ts";
|
||||||
import {Badge, Box, Chip, CircularProgress, Drawer, Input, Link, Skeleton, Stack, Typography} from "@mui/joy";
|
import {Badge, Box, Chip, CircularProgress, Drawer, Input, Link, Skeleton, Stack, Typography} from "@mui/joy";
|
||||||
import {ReactElement, useCallback, useContext, useEffect, useRef, useState} from "react";
|
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 {ApiUriContext, getData} from "../api/fetchApi.tsx";
|
||||||
import MarkdownPreview from "@uiw/react-markdown-preview";
|
import MarkdownPreview from "@uiw/react-markdown-preview";
|
||||||
import {CardHeight} from "./Manga.tsx";
|
import {CardHeight} from "./Manga.tsx";
|
||||||
@ -33,6 +38,7 @@ export default function MangaPopup({manga, open, children} : {manga: IManga | nu
|
|||||||
if(!open)
|
if(!open)
|
||||||
return;
|
return;
|
||||||
LoadMaxChapter();
|
LoadMaxChapter();
|
||||||
|
LoadDownloadedChapter();
|
||||||
LoadMangaCover();
|
LoadMangaCover();
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
@ -47,6 +53,17 @@ export default function MangaPopup({manga, open, children} : {manga: IManga | nu
|
|||||||
.finally(() => setMaxChapterLoading(false));
|
.finally(() => setMaxChapterLoading(false));
|
||||||
}, [manga, apiUri]);
|
}, [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 [updatingThreshold, setUpdatingThreshold] = useState<boolean>(false);
|
||||||
const updateIgnoreThreshhold = useCallback((value: number) => {
|
const updateIgnoreThreshhold = useCallback((value: number) => {
|
||||||
if(manga == null)
|
if(manga == null)
|
||||||
@ -88,7 +105,7 @@ export default function MangaPopup({manga, open, children} : {manga: IManga | nu
|
|||||||
<Stack direction="row" spacing={2}>
|
<Stack direction="row" spacing={2}>
|
||||||
<Input
|
<Input
|
||||||
type={"number"}
|
type={"number"}
|
||||||
placeholder={"0.0"}
|
placeholder={downloadedChapterLoading ? "" : mangaDownloadedChapter?.chapterNumber??"0.0"}
|
||||||
startDecorator={
|
startDecorator={
|
||||||
<>
|
<>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user