refactor: streamline ImageLightbox and update ProductDetailPage for better image handling

- Removed unused `closeOnBackdropClick` option from `useImageLightbox` for cleaner code.
- Simplified the product assignment in `ProductDetailPage` by creating a mutable copy of product data, ensuring proper handling of images and categories.

These changes enhance the maintainability and clarity of the image handling components in the application.
This commit is contained in:
padreug 2025-09-28 12:58:11 +02:00
parent 3742937aea
commit 98934ed61d
3 changed files with 7 additions and 3 deletions

View file

@ -89,7 +89,7 @@
</template>
<script setup lang="ts">
import { ref, computed, watch, onMounted } from 'vue'
import { ref, watch, onMounted } from 'vue'
import { X, ChevronLeft, ChevronRight } from 'lucide-vue-next'
import { Button } from '@/components/ui/button'
import ProgressiveImage from './ProgressiveImage.vue'

View file

@ -28,7 +28,6 @@ export function useImageLightbox(
) {
const {
enableKeyboardNavigation = true,
closeOnBackdropClick = true,
enableSwipeGestures = true
} = options

View file

@ -256,7 +256,12 @@ const loadProduct = async () => {
throw new Error('Product not found')
}
product.value = productData
// Create a mutable copy to satisfy type requirements
product.value = {
...productData,
images: productData.images ? [...productData.images] : undefined,
categories: productData.categories ? [...productData.categories] : undefined
}
// Update page title
document.title = `${productData.name} - Product Details`