Separate pages for download and details

This commit is contained in:
2025-09-27 22:09:12 +02:00
parent efda8e4459
commit c4b94c007d
5 changed files with 70 additions and 15 deletions

View File

@@ -0,0 +1,33 @@
<template>
<UPageList>
<UPageCard v-for="chapter in chapters" :key="chapter.key" :title="chapter.title" orientation="horizontal" :ui="{ container: 'p-2 sm:p-2'}">
<template #leading>
<Icon v-if="chapter.downloaded" name="i-lucide-circle-x" />
<Icon v-else name="i-lucide-circle-check-big" class="stroke-green-500" />
</template>
<template #footer>
<p v-if="chapter.volume" class="inline mr-1">Vol. {{ chapter.volume }}</p>
<p class="inline">Ch. {{ chapter.chapterNumber }}</p>
</template>
<template #description>
{{ chapter.fileName }}
</template>
<template #default>
<div>
<MangaconnectorIcon v-for="mangaconnectorId in chapter.mangaConnectorIds.sort((a,b) => a.mangaConnectorName < b.mangaConnectorName ? -1 : 1)" v-bind="mangaconnectorId" />
</div>
</template>
</UPageCard>
</UPageList>
</template>
<script setup lang="ts">
import {id} from "#ui/locale";
export interface ChaptersListProps {
mangaId: string;
}
const props = defineProps<ChaptersListProps>();
const { data: chapters } = useApi('/v2/Manga/{MangaId}/Chapters', { path: { MangaId: props.mangaId }})
</script>

View File

@@ -12,17 +12,14 @@
<p class="p-3 text-xl font-semibold max-h-full overflow-clip">{{ manga?.name }}</p> <p class="p-3 text-xl font-semibold max-h-full overflow-clip">{{ manga?.name }}</p>
</div> </div>
<LazyNuxtImg <LazyNuxtImg
v-if="manga || mangaId" :src="`${$config.public.openFetch.api.baseURL}v2/Manga/${manga.key}/Cover/Medium`"
:src="`${$config.public.openFetch.api.baseURL}v2/Manga/${manga ? manga.key : mangaId}/Cover/Medium`"
class="w-full h-full object-cover" /> class="w-full h-full object-cover" />
<USkeleton v-else class="w-full h-full object-cover" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { components } from '#open-fetch-schemas/api'; import type { components } from '#open-fetch-schemas/api';
type Manga = components['schemas']['Manga'];
type MinimalManga = components['schemas']['MinimalManga']; type MinimalManga = components['schemas']['MinimalManga'];
type Manga = components['schemas']['Manga'];
defineProps<{ manga?: Manga | MinimalManga; mangaId?: string; blur?: boolean }>(); defineProps<{ manga: Manga | MinimalManga; blur?: boolean }>();
</script> </script>

View File

@@ -1,8 +1,9 @@
<template> <template>
<UPage class="p-4 h-full"> <UPage class="h-full">
<template #left> <template #left>
<div class="flex flex-col gap-2 border-r-2 pr-4"> <div class="flex flex-col gap-2 p-4 bg-elevated">
<MangaCover :manga="manga" class="self-center" /> <MangaCover v-if="manga" :manga="manga" class="self-center" />
<USkeleton v-else class="w-[240px] h-[350px]" />
<p v-if="manga" class="font-semibold text-xl"> <p v-if="manga" class="font-semibold text-xl">
{{ manga.name }} {{ manga.name }}
<MangaconnectorIcon v-for="m in manga.mangaConnectorIds" v-bind="m" /> <MangaconnectorIcon v-for="m in manga.mangaConnectorIds" v-bind="m" />
@@ -22,12 +23,18 @@
<USkeleton v-else class="w-full h-30" /> <USkeleton v-else class="w-full h-30" />
</div> </div>
</template> </template>
<UPageBody class="mt-0 relative"> <UPageBody class="relative pr-4">
<div class="w-full flex flex-row justify-between">
<div> <div>
<UButton variant="soft" to="/" icon="i-lucide-arrow-left">Back</UButton> <UButton variant="soft" :to="backPath??'/'" icon="i-lucide-arrow-left">Back</UButton>
<p v-if="title" class="text-3xl">{{ title }}</p> <p v-if="title" class="text-3xl">{{ title }}</p>
</div> </div>
<div>
<slot name="actions">
</slot>
</div>
</div>
<slot /> <slot />
</UPageBody> </UPageBody>
</UPage> </UPage>
@@ -40,6 +47,7 @@ type Manga = components['schemas']['Manga'];
export interface MangaDetailPageProps { export interface MangaDetailPageProps {
manga?: Manga; manga?: Manga;
title?: string; title?: string;
backPath?: string;
} }
defineProps<MangaDetailPageProps>(); defineProps<MangaDetailPageProps>();

View File

@@ -0,0 +1,12 @@
<template>
<MangaDetailPage :manga="manga" back-path="/search">
</MangaDetailPage>
</template>
<script setup lang="ts">
import MangaDetailPage from '~/components/MangaDetailPage.vue';
const route = useRoute();
const { data: manga } = useApi('/v2/Manga/{MangaId}', { path: { MangaId: route.params.mangaId as string } });
</script>

View File

@@ -1,5 +1,10 @@
<template> <template>
<MangaDetailPage :manga="manga"> </MangaDetailPage> <MangaDetailPage :manga="manga">
<ChaptersList v-if="manga" :manga-id="manga.key" />
<template #actions>
<UButton variant="soft" color="warning" icon="i-lucide-trash" />
</template>
</MangaDetailPage>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">