Get only Manga with downloads

This commit is contained in:
2025-07-22 18:11:49 +02:00
parent 0dd8ad9164
commit 257a76b42a
3 changed files with 37 additions and 14 deletions

View File

@@ -36,17 +36,11 @@ export default function App () {
setFileLibraries(response.data);
})
Api.mangaList().then(response => {
if (!response.ok)
{
setManga([]);
return;
}
Api.mangaWithIDsCreate(response.data).then(response => {
Api.queryMangaDownloadingList()
.then(response => {
if (response.ok)
setManga(response.data);
})
})
});
}, []);

View File

@@ -1,5 +1,5 @@
import {Manga} from "../../apiClient/data-contracts.ts";
import {ChangeEvent, Dispatch, ReactNode, useContext, useState} from "react";
import {ChangeEvent, Dispatch, ReactNode, useContext, useEffect, useState} from "react";
import {Button, Checkbox, Option, Select, Stack, Typography} from "@mui/joy";
import Drawer from "@mui/joy/Drawer";
import ModalClose from "@mui/joy/ModalClose";
@@ -50,16 +50,30 @@ function DownloadDrawer({manga, open, setOpen}: {manga: Manga, open: boolean, se
function DownloadCheckBox({mangaConnectorIdId} : {mangaConnectorIdId : string}) : ReactNode {
const Api = useContext(ApiContext);
const [useForDownloading, setUseForDownloading] = useState<boolean>(false);
useEffect(() => {
Api.queryMangaMangaConnectorIdDetail(mangaConnectorIdId).then(response => {
console.log(response);
if (response.ok)
setUseForDownloading(response.data.useForDownload as boolean);
})
}, []);
const onSelected = (event: ChangeEvent<HTMLInputElement>) => {
const val = event.currentTarget.checked;
Api.queryMangaMangaConnectorIdDetail(mangaConnectorIdId).then(response => {
if (!response.ok)
return;
Api.mangaSetAsDownloadFromCreate(response.data.objId, response.data.mangaConnectorName, event.currentTarget.checked);
Api.mangaSetAsDownloadFromCreate(response.data.objId, response.data.mangaConnectorName, val)
.then(response => {
if (response.ok)
setUseForDownloading(val);
});
});
}
return (
<Checkbox onChange={onSelected} label={<Typography><MangaConnectorLinkFromId MangaConnectorIdId={mangaConnectorIdId} printName={true} /></Typography>} />
<Checkbox checked={useForDownloading} onChange={onSelected} label={<Typography><MangaConnectorLinkFromId MangaConnectorIdId={mangaConnectorIdId} printName={true} /></Typography>} />
);
}

View File

@@ -848,20 +848,35 @@ export class V2<
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryMangaDownloadingList
* @summary Returns all API.Schema.MangaContext.Manga that are being downloaded from at least one API.MangaConnectors.MangaConnector
* @request GET:/v2/Query/Manga/Downloading
*/
queryMangaDownloadingList = (params: RequestParams = {}) =>
this.request<Manga[], any>({
path: `/v2/Query/Manga/Downloading`,
method: "GET",
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryChapterMangaConnectorIdDetail
* @summary Returns the API.Schema.MangaContext.MangaConnectorId`1 with API.Schema.MangaContext.MangaConnectorId`1.Key
* @request GET:/v2/Query/chapter/MangaConnectorId/{MangaConnectorIdId}
* @request GET:/v2/Query/Chapter/MangaConnectorId/{MangaConnectorIdId}
*/
queryChapterMangaConnectorIdDetail = (
mangaConnectorIdId: string,
params: RequestParams = {},
) =>
this.request<ChapterMangaConnectorId, ProblemDetails>({
path: `/v2/Query/chapter/MangaConnectorId/${mangaConnectorIdId}`,
path: `/v2/Query/Chapter/MangaConnectorId/${mangaConnectorIdId}`,
method: "GET",
format: "json",
...params,