From 6b5e326ab62a8821b64392d6647b49f8af0295cc Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Tue, 19 Apr 2022 21:51:50 +0200 Subject: [PATCH] fix loading of images, improve styles, add more info --- assets/global.css | 2 +- src/components/chapter.svelte | 16 ++++++++- src/pages/[manga]/_layout.svelte | 7 ++-- src/pages/[manga]/index.svelte | 58 +++++++++++++++++++++++++++++--- src/util/baseGenerator.js | 1 + src/util/generateCbz.js | 2 +- 6 files changed, 76 insertions(+), 10 deletions(-) diff --git a/assets/global.css b/assets/global.css index 9a8289d..151aecd 100644 --- a/assets/global.css +++ b/assets/global.css @@ -18,7 +18,7 @@ h1 { main { - max-width: 550px; + max-width: 600px; margin: auto; } diff --git a/src/components/chapter.svelte b/src/components/chapter.svelte index 07610dd..46d15a7 100644 --- a/src/components/chapter.svelte +++ b/src/components/chapter.svelte @@ -7,6 +7,7 @@ export var selected; export var disabledDownload = false; export var progress = 0; + var scanlationGroup = chapter.relationships.find(t => t.type === "scanlation_group")?.attributes.name; /** * @param {MouseEvent} e @@ -28,7 +29,10 @@ {chapter.attributes.volume ? "Vol " + chapter.attributes.volume : ""} {chapter.attributes.chapter ? "Chapter " + chapter.attributes.chapter : ""} - {chapter.attributes.title} + +
{chapter.attributes.title}
+
{scanlationGroup}
+ !disabledDownload && dispatch("view")}>View @@ -40,6 +44,13 @@ background-repeat: no-repeat; user-select: none; } + .scanlation { + color: grey; + font-size: 0.9rem; + } + .title { + font-size: 1.1rem; + } tr.selected { background: rgba(0,0,0,0.15); @@ -50,6 +61,9 @@ tr.selected:hover { background: rgba(0,0,0,0.25); } + .no-wrap { + white-space: nowrap; + } td { padding: 5px 5px; diff --git a/src/pages/[manga]/_layout.svelte b/src/pages/[manga]/_layout.svelte index 1ad71cf..43fa6d1 100644 --- a/src/pages/[manga]/_layout.svelte +++ b/src/pages/[manga]/_layout.svelte @@ -7,11 +7,12 @@ function getManga(id) { if(!id) return; - return request("manga/" + id); + return request("manga/" + id + "?includes[]=author&includes[]=cover_art&includes[]=artist"); } var mangaData = getManga(manga); $: mangaData = getManga(manga); - console.log(mangaData); + console.log("mangadata", mangaData); + $: mangaData.then(t => console.log("manga data", t)); const blocked = ["227e3f72-863f-46f9-bafe-c43104ca29ee", "b0b721ff-c388-4486-aa0f-c2b0bb321512"]; @@ -40,7 +41,7 @@ loading... {:then manga} {#if manga} - + {:else} Manga not found. {/if} diff --git a/src/pages/[manga]/index.svelte b/src/pages/[manga]/index.svelte index b1f1f60..5b29a1b 100644 --- a/src/pages/[manga]/index.svelte +++ b/src/pages/[manga]/index.svelte @@ -19,7 +19,7 @@ $: title = manga.title.en || manga.title.jp || Object.values(manga.title)[0]; async function getMangaChapters(id) { - const data = await request("manga/" + id + "/feed?limit=500&translatedLanguage[]=en"); + const data = await request("manga/" + id + "/feed?limit=500&translatedLanguage[]=en&includes[]=scanlation_group"); console.log(data); data.data = data.data .filter(datum => !datum.attributes?.externalUrl) @@ -27,11 +27,12 @@ return data; } + var chapters; $: chapters = getMangaChapters(mangaId); - console.log(manga); - console.log(chapters); - console.log(relationships); + console.log("manga", manga); + console.log("chapters", chapters); + console.log("relationships", relationships); var progress = 0; var state = "idle"; @@ -149,6 +150,7 @@ author: "Unknown", chapters: selected.map(chapter => ({ id: chapter.id, + title: chapter.attributes.title, number: chapter.attributes.chapter, volume: chapter.attributes.volume })) @@ -223,6 +225,36 @@

{title}

+

+ {#if manga.altTitles.find(t => t.en)} + {manga.altTitles.find(t => t.en)?.en} · + {/if} + {#if manga.year} + {manga.year} · + {/if} + {manga.status} +

+ +
+ {#if relationships.find(t => t.type === "cover_art")} + + {/if} +
+ {#if relationships.find(t => t.type === "author")} + Author: {relationships.find(t => t.type === "author").attributes.name} + {/if} + {#if relationships.find(t => t.type === "artist")} + Artist: {relationships.find(t => t.type === "artist").attributes.name} + {/if} + {#if relationships.find(t => t.related === "colored" && t.type === "manga")} + Colored version + {/if} + {#if manga.description.en} +

{manga.description.en}

+ {/if} +
+
+