Refactor catalog

This commit is contained in:
ZXY101
2023-09-27 11:06:03 +02:00
parent 53f5a48d3e
commit d6bb0b1ddc
11 changed files with 109 additions and 99 deletions

View File

@@ -1,23 +1,22 @@
<script lang="ts">
import { currentManga } from '$lib/catalog';
import type { Volume } from '$lib/types';
export let manga: Volume[];
const { volumeName, files, mokuroData } = manga[0];
import { catalog } from '$lib/catalog';
function onClick() {
currentManga.set(manga);
}
export let id: string;
$: manga = $catalog?.find((item) => item.id === id)?.manga[0];
</script>
<a href={volumeName} on:click={onClick}>
<div class="flex flex-col gap-[5px] text-center items-center">
{mokuroData.title}
{#if files}
<img
src={URL.createObjectURL(Object.values(files)[0])}
alt="img"
class="object-contain w-[250px] h-[350px] bg-black border-gray-900 border"
/>
{/if}
</div>
</a>
{#if manga}
<a href={id}>
<div class="flex flex-col gap-[5px] text-center items-center">
{manga.mokuroData.title}
{#if manga.files}
<img
src={URL.createObjectURL(Object.values(manga.files)[0])}
alt="img"
class="object-contain w-[250px] h-[350px] bg-black border-gray-900 border"
/>
{/if}
</div>
</a>
{/if}