Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 50 additions & 26 deletions components/BookCoverCarousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,50 @@
:close="{ color: 'neutral', variant: 'ghost', class: 'text-white' }"
>
<template #content>
<img
v-if="modalItem?.type === 'cover' || modalItem?.type === 'image'"
:src="modalItem?.fullSrc || modalItem?.src"
:alt="props.alt"
class="w-full h-auto max-h-[80vh] object-contain"
>
<div class="relative">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not add relative to content slot

<img
v-if="modalItem?.type === 'cover' || modalItem?.type === 'image'"
:src="modalItem?.fullSrc || modalItem?.src"
:alt="props.alt"
class="w-full h-auto max-h-[80vh] object-contain"
>

<div
v-else-if="modalItem?.type === 'youtube' && modalItem?.videoId"
class="aspect-video"
>
<ScriptYouTubePlayer
:video-id="modalItem.videoId"
:player-vars="{ autoplay: 1, rel: 0, playsinline: 1 }"
trigger="visible"
class="w-full h-full"
/>
</div>

<video
v-else-if="modalItem?.type === 'video'"
:src="modalItem?.src"
controls
autoplay
playsinline
class="w-full max-h-[80vh]"
/>

<div
v-else-if="modalItem?.type === 'youtube' && modalItem?.videoId"
class="aspect-video"
>
<ScriptYouTubePlayer
:video-id="modalItem.videoId"
:player-vars="{ autoplay: 1, rel: 0, playsinline: 1 }"
trigger="visible"
class="w-full h-full"
<UButton
icon="i-material-symbols-chevron-left"
color="neutral"
variant="ghost"
class="absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 text-white hover:bg-black/70 cursor-pointer"
@click="navigateModal(-1)"
/>
<UButton
icon="i-material-symbols-chevron-right"
color="neutral"
variant="ghost"
class="absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 text-white hover:bg-black/70 cursor-pointer"
@click="navigateModal(1)"
/>
Comment on lines 96 to 111
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The navigation arrows are always displayed, even when there's only one item in the carousel. The carousel itself only renders when carouselItems.length > 1 (line 3), but the modal with navigation arrows will still appear when clicking on a single BookCover (the else branch starting at line 115). The buttons should be conditionally rendered based on whether there are multiple items to navigate through.

Copilot uses AI. Check for mistakes.
Comment on lines 96 to 111
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The navigation buttons lack accessible labels for screen readers. Icon-only buttons should include aria-label attributes to describe their purpose for users relying on assistive technology. Add aria-label="Previous" to the left button and aria-label="Next" to the right button (or use appropriate internationalized strings).

Copilot uses AI. Check for mistakes.
</div>

<video
v-else-if="modalItem?.type === 'video'"
:src="modalItem?.src"
controls
autoplay
playsinline
class="w-full max-h-[80vh]"
/>
</template>
</UModal>
</div>
Expand Down Expand Up @@ -141,13 +158,20 @@ const props = defineProps({
})

const isModalOpen = ref(false)
const modalItem = ref<CarouselItem | null>(null)
const modalItemIndex = ref(0)
const modalItem = computed(() => carouselItems.value[modalItemIndex.value] || null)

function openModal(item: CarouselItem) {
modalItem.value = item
const index = carouselItems.value.indexOf(item)
modalItemIndex.value = index >= 0 ? index : 0
isModalOpen.value = true
}

function navigateModal(direction: number) {
const len = carouselItems.value.length
modalItemIndex.value = (modalItemIndex.value + direction + len) % len
}
Comment on lines +172 to +175
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding keyboard navigation support (ArrowLeft/ArrowRight keys) for improved accessibility and user experience. The PDFReader component (components/PDFReader.vue:571-593) implements keyboard navigation using event listeners. This would allow users to navigate through carousel items using keyboard shortcuts in addition to clicking the arrow buttons.

Copilot uses AI. Check for mistakes.

const carouselItems = computed<CarouselItem[]>(() => {
const items: CarouselItem[] = []

Expand Down
Loading