mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-05-22 14:13:02 +02:00
Add "Start-Job" button to MangaPopup (from list)
This commit is contained in:
parent
dae653c2b4
commit
dbdb3c0168
@ -1,7 +1,7 @@
|
|||||||
import {Badge, Box, Button, Card, CardContent, CardCover, Stack, Typography} from "@mui/joy";
|
import {Badge, Box, Button, Card, CardContent, CardCover, Stack, Typography} from "@mui/joy";
|
||||||
import {Dispatch, SetStateAction, useCallback, useContext, useEffect, useState} from "react";
|
import {Dispatch, SetStateAction, useCallback, useContext, useEffect, useState} from "react";
|
||||||
import {ApiUriContext} from "../api/fetchApi.tsx";
|
import {ApiUriContext} from "../api/fetchApi.tsx";
|
||||||
import {DeleteJob, GetJobsWithType} from "../api/Job.tsx";
|
import {DeleteJob, GetJobsWithType, StartJob} from "../api/Job.tsx";
|
||||||
import {JobType} from "../api/types/Jobs/IJob.ts";
|
import {JobType} from "../api/types/Jobs/IJob.ts";
|
||||||
import IDownloadAvailableChaptersJob from "../api/types/Jobs/IDownloadAvailableChaptersJob.ts";
|
import IDownloadAvailableChaptersJob from "../api/types/Jobs/IDownloadAvailableChaptersJob.ts";
|
||||||
import {CardHeight, CardWidth, MangaFromId} from "./Manga.tsx";
|
import {CardHeight, CardWidth, MangaFromId} from "./Manga.tsx";
|
||||||
@ -23,6 +23,10 @@ export default function MangaList({connected, setShowSearch}: {connected: boolea
|
|||||||
DeleteJob(apiUri, jobId).finally(() => getJobList());
|
DeleteJob(apiUri, jobId).finally(() => getJobList());
|
||||||
},[apiUri]);
|
},[apiUri]);
|
||||||
|
|
||||||
|
const startJob = useCallback((jobId: string) => {
|
||||||
|
StartJob(apiUri, jobId, true).finally(() => getJobList());
|
||||||
|
},[apiUri]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getJobList();
|
getJobList();
|
||||||
}, [apiUri]);
|
}, [apiUri]);
|
||||||
@ -69,6 +73,7 @@ export default function MangaList({connected, setShowSearch}: {connected: boolea
|
|||||||
</Badge>
|
</Badge>
|
||||||
{jobList?.map((job) => (
|
{jobList?.map((job) => (
|
||||||
<MangaFromId key={job.mangaId} mangaId={job.mangaId}>
|
<MangaFromId key={job.mangaId} mangaId={job.mangaId}>
|
||||||
|
<Button color={"success"} endDecorator={<PlayArrow />} onClick={() => startJob(job.jobId)}>Start</Button>
|
||||||
<Button color={"danger"} endDecorator={<Remove />} onClick={() => deleteJob(job.jobId)}>Delete</Button>
|
<Button color={"danger"} endDecorator={<Remove />} onClick={() => deleteJob(job.jobId)}>Delete</Button>
|
||||||
</MangaFromId>
|
</MangaFromId>
|
||||||
))}
|
))}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user