diff --git a/Website/modules/Manga.tsx b/Website/modules/Manga.tsx index 65bb734..3e40dfe 100644 --- a/Website/modules/Manga.tsx +++ b/Website/modules/Manga.tsx @@ -47,8 +47,8 @@ export default class Manga }); } - static GetMangaCoverUrl(apiUri: string, internalId: string): string { + static GetMangaCoverUrl(apiUri: string, internalId: string, ref: HTMLElement): string { //console.debug(`Getting Manga Cover-Url ${internalId}`); - return `${apiUri}/v2/Manga/${internalId}/Cover`; + return `${apiUri}/v2/Manga/${internalId}/Cover?dimensions=${ref.clientWidth}x${ref.clientHeight}`; } } \ No newline at end of file diff --git a/Website/modules/interfaces/IManga.tsx b/Website/modules/interfaces/IManga.tsx index ed7c194..eba776c 100644 --- a/Website/modules/interfaces/IManga.tsx +++ b/Website/modules/interfaces/IManga.tsx @@ -1,7 +1,7 @@ import IMangaConnector from "./IMangaConnector"; import KeyValuePair from "./KeyValuePair"; import Manga from "../Manga"; -import React, {ReactElement} from "react"; +import React, {EventHandler, ReactElement, ReactEventHandler} from "react"; import Icon from '@mdi/react'; import { mdiTagTextOutline, mdiAccountEdit } from '@mdi/js'; import MarkdownPreview from '@uiw/react-markdown-preview'; @@ -42,32 +42,48 @@ export function ReleaseStatusFromNumber(n: number): string { return ""; } + + export function CoverCard(apiUri: string, manga: IManga) : ReactElement { + const MangaCover : ReactEventHandler = (e) => { + if(e.currentTarget.src != Manga.GetMangaCoverUrl(apiUri, manga.internalId, e.currentTarget)) + e.currentTarget.src = Manga.GetMangaCoverUrl(apiUri, manga.internalId, e.currentTarget); + } + return( -
- Manga Cover -
-

{manga.mangaConnector.name}

-
-

{manga.sortName}

-
-
); +
+ Manga Cover +
+

{manga.mangaConnector.name}

+
+

{manga.sortName}

+
+
); } export function SearchResult(apiUri: string, manga: IManga, interval: Date, onJobsChanged: (internalId: string) => void) : ReactElement { + const MangaCover : ReactEventHandler = (e) => { + if(e.currentTarget.src != Manga.GetMangaCoverUrl(apiUri, manga.internalId, e.currentTarget)) + e.currentTarget.src = Manga.GetMangaCoverUrl(apiUri, manga.internalId, e.currentTarget); + } + return(
- Manga Cover + Manga Cover

{manga.mangaConnector.name}

-

{manga.sortName}

+

{manga.sortName}

- {manga.authors.map(author =>

{author}

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

{tag}

)} + {manga.authors.map(author =>

+ {author}

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

{tag}

)}
- +
); @@ -82,19 +98,30 @@ function ToPercentString(n: number): string { } export function QueueItem(apiUri: string, manga: IManga, job: IJob, triggerUpdate: () => void){ + const MangaCover : ReactEventHandler = (e) => { + if(e.currentTarget.src != Manga.GetMangaCoverUrl(apiUri, manga.internalId, e.currentTarget)) + e.currentTarget.src = Manga.GetMangaCoverUrl(apiUri, manga.internalId, e.currentTarget); + } + return (
- Manga Cover + 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 - ? + ? : <> }