few improvements and fixes

This commit is contained in:
Daniel Bulant 2021-05-27 21:26:18 +02:00
parent cabcd61f6c
commit 7df7522b01
3 changed files with 7 additions and 5 deletions

View file

@ -7,15 +7,12 @@
export var selected;
export var disabledDownload = false;
export var progress = 0;
$: if(progress !== 0) console.log("chapter", chapter.data.attributes.chapter, progress * 100);
</script>
<tr on:click={() => dispatch("select")} class:selected={selected} style="background-image: linear-gradient(to right, rgba(0, 255, 0, 0.247) {progress * 100}%, transparent {progress * 100}%)">
<td class="no-wrap">{chapter.data.attributes.volume ? "Vol " + chapter.data.attributes.volume : ""}</td>
<td class="no-wrap">Chapter {chapter.data.attributes.chapter}</td>
<td class="no-wrap">{chapter.data.attributes.chapter ? "Chapter " + chapter.data.attributes.chapter : ""}</td>
<td>{chapter.data.attributes.title}</td>
<td class="action no-wrap"><span on:click|stopPropagation={() => !disabledDownload && dispatch("download")} class:disabled={disabledDownload}>Download</span></td>
<td class="action no-wrap"><a href={$url("./" + chapter.data.id)} on:click|stopPropagation={() => !disabledDownload && dispatch("view")}>View</a></td>
</tr>

View file

@ -15,5 +15,9 @@
{#await mangaData}
loading...
{:then manga}
<slot scoped={({ manga: manga.data.attributes, mangaRelationships: manga.relationships, id: manga.data.id })} />
{#if manga}
<slot scoped={({ manga: manga.data.attributes, mangaRelationships: manga.relationships, id: manga.data.id })} />
{:else}
Manga not found.
{/if}
{/await}

View file

@ -56,6 +56,7 @@
state = "active";
processing.opts.callback = async (chapter, link, finished) => {
console.log(chapter, link, finished);
if(chapter === -1 || link === -1) return;
var cs = await chapters;
var related = cs.results.filter(t => processing.opts.chapters.find(c => t.data.id === c.id));
var done = processing.opts.chapters.filter(t => t.number < chapter);