mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-05-22 06:03:01 +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 {Dispatch, SetStateAction, useCallback, useContext, useEffect, useState} from "react";
|
||||
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 IDownloadAvailableChaptersJob from "../api/types/Jobs/IDownloadAvailableChaptersJob.ts";
|
||||
import {CardHeight, CardWidth, MangaFromId} from "./Manga.tsx";
|
||||
@ -23,6 +23,10 @@ export default function MangaList({connected, setShowSearch}: {connected: boolea
|
||||
DeleteJob(apiUri, jobId).finally(() => getJobList());
|
||||
},[apiUri]);
|
||||
|
||||
const startJob = useCallback((jobId: string) => {
|
||||
StartJob(apiUri, jobId, true).finally(() => getJobList());
|
||||
},[apiUri]);
|
||||
|
||||
useEffect(() => {
|
||||
getJobList();
|
||||
}, [apiUri]);
|
||||
@ -69,6 +73,7 @@ export default function MangaList({connected, setShowSearch}: {connected: boolea
|
||||
</Badge>
|
||||
{jobList?.map((job) => (
|
||||
<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>
|
||||
</MangaFromId>
|
||||
))}
|
||||
|
Loading…
x
Reference in New Issue
Block a user