diff --git a/tranga-website/src/App.tsx b/tranga-website/src/App.tsx
index d3ec72f..eba63bf 100644
--- a/tranga-website/src/App.tsx
+++ b/tranga-website/src/App.tsx
@@ -6,6 +6,7 @@ import {Badge, Button} from "@mui/joy";
import {useState} from "react";
import {ApiUriContext} from "./api/fetchApi.tsx";
import Search from './Components/Search.tsx';
+import MangaList from "./Components/MangaList.tsx";
export default function App () {
@@ -27,7 +28,7 @@ export default function App () {
-
+
diff --git a/tranga-website/src/Components/Manga.tsx b/tranga-website/src/Components/Manga.tsx
index 9a7a411..f3b01a6 100644
--- a/tranga-website/src/Components/Manga.tsx
+++ b/tranga-website/src/Components/Manga.tsx
@@ -13,7 +13,7 @@ import {
} from "@mui/joy";
import IManga, {DefaultManga} from "../api/types/IManga.ts";
import {ReactElement, useCallback, useContext, useEffect, useState} from "react";
-import {GetLatestChapterAvailable, GetMangaCoverImageUrl, SetIgnoreThreshold} from "../api/Manga.tsx";
+import {GetLatestChapterAvailable, GetMangaById, GetMangaCoverImageUrl, SetIgnoreThreshold} from "../api/Manga.tsx";
import {ApiUriContext} from "../api/fetchApi.tsx";
import AuthorTag from "./AuthorTag.tsx";
import LinkTag from "./LinkTag.tsx";
@@ -22,8 +22,27 @@ import IChapter from "../api/types/IChapter.ts";
import MarkdownPreview from "@uiw/react-markdown-preview";
import {SxProps} from "@mui/joy/styles/types";
-export function Manga({manga, children} : { manga: IManga | undefined, children?: ReactElement | ReactElement[] | undefined }) {
+export function MangaFromId({mangaId, children} : { mangaId: string, children?: ReactElement | ReactElement[] | undefined }){
+ const [manga, setManga] = useState(DefaultManga);
+ const [loading, setLoading] = useState(true);
+
+ const apiUri = useContext(ApiUriContext);
+
+ const loadManga = useCallback(() => {
+ setLoading(true);
+ GetMangaById(apiUri, mangaId).then(setManga).finally(() => setLoading(false));
+ },[apiUri, mangaId]);
+
+ useEffect(() => {
+ loadManga();
+ }, []);
+
+ return
+}
+
+export function Manga({manga, children, loading} : { manga: IManga | undefined, children?: ReactElement | ReactElement[] | undefined, loading?: boolean}) {
const useManga = manga ?? DefaultManga;
+ loading = loading ?? false;
const apiUri = useContext(ApiUriContext);
@@ -79,19 +98,25 @@ export function Manga({manga, children} : { manga: IManga | undefined, children?
}}/>
-
- {useManga.name}
-
+
+
+ {useManga.name}
+
+
{
expanded ?
-
- {useManga.authorIds.map(authorId => )}
- {useManga.tags.map(tag => {tag})}
- {useManga.linkIds.map(linkId => )}
-
-
+
+
+ {useManga.authorIds.map(authorId => )}
+ {useManga.tags.map(tag => {tag})}
+ {useManga.linkIds.map(linkId => )}
+
+
+
+
+
: null
}
@@ -99,30 +124,32 @@ export function Manga({manga, children} : { manga: IManga | undefined, children?
{
expanded ?
-
- {
- updatingThreshold ?
-
- : Ch.
+
+
+ {
+ updatingThreshold ?
+
+ : Ch.
+ }
+ >
}
- >
- }
- endDecorator={
-
-
- /{mangaMaxChapter?.chapterNumber??"Load Failed"}
-
-
- }
- sx={{width:"min-content"}}
- size={"md"}
- onChange={(e) => updateIgnoreThreshhold(e.currentTarget.valueAsNumber)}
- />
- {children}
+ endDecorator={
+
+
+ /{mangaMaxChapter?.chapterNumber??"Load Failed"}
+
+
+ }
+ sx={{width:"min-content"}}
+ size={"md"}
+ onChange={(e) => updateIgnoreThreshhold(e.currentTarget.valueAsNumber)}
+ />
+ {children}
+
: null
}
diff --git a/tranga-website/src/Components/MangaList.tsx b/tranga-website/src/Components/MangaList.tsx
new file mode 100644
index 0000000..e5bd265
--- /dev/null
+++ b/tranga-website/src/Components/MangaList.tsx
@@ -0,0 +1,36 @@
+import {Button, Stack} from "@mui/joy";
+import {useCallback, useContext, useEffect, useState} from "react";
+import {ApiUriContext} from "../api/fetchApi.tsx";
+import {DeleteJob, GetJobsWithType} from "../api/Job.tsx";
+import {JobType} from "../api/types/Jobs/IJob.ts";
+import IDownloadAvailableChaptersJob from "../api/types/Jobs/IDownloadAvailableChaptersJob.ts";
+import {MangaFromId} from "./Manga.tsx";
+import { Remove } from "@mui/icons-material";
+
+export default function MangaList(){
+ const apiUri = useContext(ApiUriContext);
+
+ const [jobList, setJobList] = useState([]);
+
+ const getJobList = useCallback(() => {
+ GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob).then((jl) => setJobList(jl as IDownloadAvailableChaptersJob[]));
+ },[apiUri]);
+
+ const deleteJob = useCallback((jobId: string) => {
+ DeleteJob(apiUri, jobId).finally(() => getJobList());
+ },[apiUri]);
+
+ useEffect(() => {
+ getJobList();
+ }, [apiUri]);
+
+ return(
+
+ {jobList.map((job) => (
+
+ } onClick={() => deleteJob(job.jobId)}>Delete
+
+ ))}
+
+ );
+}
\ No newline at end of file
diff --git a/tranga-website/src/Components/Search.tsx b/tranga-website/src/Components/Search.tsx
index 070b05f..304b1b7 100644
--- a/tranga-website/src/Components/Search.tsx
+++ b/tranga-website/src/Components/Search.tsx
@@ -149,6 +149,7 @@ export default function Search({open, setOpen}:{open:boolean, setOpen:React.Disp
placeholder={"Select Library"}
defaultValue={""}
startDecorator={}
+ value={selectedLibraryId}
onChange={(_e, newValue) => setSelectedLibraryId(newValue!)}>
{localLibrariesLoading ?
diff --git a/tranga-website/src/api/types/IManga.ts b/tranga-website/src/api/types/IManga.ts
index 68daa53..d6e9bf8 100644
--- a/tranga-website/src/api/types/IManga.ts
+++ b/tranga-website/src/api/types/IManga.ts
@@ -19,19 +19,19 @@ export default interface IManga{
}
export const DefaultManga : IManga = {
- mangaId: "MangaId",
- idOnConnectorSite: "ID",
- name: "TestManga",
- description: "Wow so much text, very cool",
- websiteUrl: "https://realsite.realdomain",
+ mangaId: "Loading",
+ idOnConnectorSite: "Loading",
+ name: "Loading",
+ description: "Loading",
+ websiteUrl: "",
year: 1999,
- originalLanguage: "lindtChoccy",
+ originalLanguage: "en",
releaseStatus: MangaReleaseStatus.Continuing,
- folderName: "uhhh",
+ folderName: "Loading",
ignoreChapterBefore: 0,
- mangaConnectorId: "MangaDex",
- authorIds: ["We got", "Authors"],
- tags: ["And we", "got Tags"],
- linkIds: ["And most", "definitely", "links"],
- altTitleIds: ["But not alt-titles."],
+ mangaConnectorId: "Loading",
+ authorIds: ["Loading"],
+ tags: ["Loading"],
+ linkIds: ["Loading"],
+ altTitleIds: ["Loading"],
}
\ No newline at end of file