import IMangaConnector from "./IMangaConnector"; import KeyValuePair from "./KeyValuePair"; import {Manga} from "../Manga"; import React, {ReactElement} from "react"; import Icon from '@mdi/react'; import { mdiTagTextOutline, mdiAccountEdit } from '@mdi/js'; import MarkdownPreview from '@uiw/react-markdown-preview'; import IJob, {JobTypeFromNumber} from "./IJob"; import {Job} from "../Job"; import ProgressBar from "@ramonak/react-progress-bar"; export default interface IManga{ "sortName": string, "authors": string[], "altTitles": KeyValuePair[], "description": string, "tags": string[], "coverUrl": string, "coverFileNameInCache": string, "links": KeyValuePair[], "year": number, "originalLanguage": string, "releaseStatus": number, "folderName": string, "publicationId": string, "internalId": string, "ignoreChaptersBelow": number, "latestChapterDownloaded": number, "latestChapterAvailable": number, "websiteUrl": string, "mangaConnector": IMangaConnector } export function ReleaseStatusFromNumber(n: number): string { switch(n) { case 0: return "Ongoing"; case 1: return "Completed"; case 2: return "OnHiatus"; case 3: return "Cancelled"; case 4: return "Unreleased"; } return ""; } export function CoverCard(apiUri: string, manga: IManga) : ReactElement { return(
Manga Cover

{manga.mangaConnector.name}

{manga.sortName}

); } export function SearchResult(apiUri: string, manga: IManga, interval: Date, onJobsChanged: (internalId: string) => void) : ReactElement { return(
Manga Cover

{manga.mangaConnector.name}

{manga.sortName}

{manga.authors.map(author =>

{author}

)} {manga.tags.map(tag =>

{tag}

)}
); } function ProgressbarStr(job: IJob): string { return job.progressToken.timeRemaining.substring(0,job.progressToken.timeRemaining.indexOf(".")).concat(" ", ToPercentString(job.progressToken.progress)); } function ToPercentString(n: number): string { return n.toString().substring(2,4).concat("%"); } export function QueueItem(apiUri: string, manga: IManga, job: IJob, triggerUpdate: () => void){ return (
Manga Cover

{manga.sortName}

{JobTypeFromNumber(job.jobType)}

{job.jobType == 0 ? `Vol.${job.chapter?.volumeNumber} Ch.${job.chapter?.chapterNumber}` : ""}

{job.progressToken.state === 0 ? :
}
{job.parentJobId != null ? : <> }
); }