From ca0ac2b9ada78f4360df97087acf2d9a7a863a8f Mon Sep 17 00:00:00 2001 From: padreug Date: Sun, 28 Sep 2025 12:48:02 +0200 Subject: [PATCH] feat: introduce ImageLightbox and ImageViewer components for enhanced image handling - Added ImageLightbox component to provide a modal view for images with navigation and keyboard support. - Implemented ImageViewer component to display images with features like thumbnails, cycling controls, and lightbox integration. - Updated ProgressiveImage component for improved loading and error handling. - Refactored image imports in ProductCard, ProductDetailPage, and CheckoutPage to align with new component structure. These changes significantly enhance the user experience for viewing and interacting with product images across the application. --- .../ui/{ => image}/ImageLightbox.vue | 2 +- src/components/ui/{ => image}/ImageViewer.vue | 2 +- .../ui/{ => image}/ProgressiveImage.vue | 0 .../ui/image}/composables/useImageLightbox.ts | 0 src/components/ui/image/index.ts | 10 + src/modules/market/components/ProductCard.vue | 2 +- .../market/components/ProductDetailDialog.vue | 261 ------------------ src/modules/market/views/CheckoutPage.vue | 2 +- .../market/views/ProductDetailPage.vue | 2 +- 9 files changed, 15 insertions(+), 266 deletions(-) rename src/components/ui/{ => image}/ImageLightbox.vue (99%) rename src/components/ui/{ => image}/ImageViewer.vue (99%) rename src/components/ui/{ => image}/ProgressiveImage.vue (100%) rename src/{ => components/ui/image}/composables/useImageLightbox.ts (100%) create mode 100644 src/components/ui/image/index.ts delete mode 100644 src/modules/market/components/ProductDetailDialog.vue diff --git a/src/components/ui/ImageLightbox.vue b/src/components/ui/image/ImageLightbox.vue similarity index 99% rename from src/components/ui/ImageLightbox.vue rename to src/components/ui/image/ImageLightbox.vue index 418abce..cf96a87 100644 --- a/src/components/ui/ImageLightbox.vue +++ b/src/components/ui/image/ImageLightbox.vue @@ -93,7 +93,7 @@ import { ref, computed, watch, onMounted } from 'vue' import { X, ChevronLeft, ChevronRight } from 'lucide-vue-next' import { Button } from '@/components/ui/button' import ProgressiveImage from './ProgressiveImage.vue' -import { useImageLightbox, type LightboxImage, type UseImageLightboxOptions } from '@/composables/useImageLightbox' +import { useImageLightbox, type LightboxImage, type UseImageLightboxOptions } from './composables/useImageLightbox' interface Props { /** diff --git a/src/components/ui/ImageViewer.vue b/src/components/ui/image/ImageViewer.vue similarity index 99% rename from src/components/ui/ImageViewer.vue rename to src/components/ui/image/ImageViewer.vue index 22d70c9..9259a15 100644 --- a/src/components/ui/ImageViewer.vue +++ b/src/components/ui/image/ImageViewer.vue @@ -106,7 +106,7 @@ import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import ProgressiveImage from './ProgressiveImage.vue' import ImageLightbox from './ImageLightbox.vue' -import type { LightboxImage, UseImageLightboxOptions } from '@/composables/useImageLightbox' +import type { LightboxImage, UseImageLightboxOptions } from './composables/useImageLightbox' interface Props { /** diff --git a/src/components/ui/ProgressiveImage.vue b/src/components/ui/image/ProgressiveImage.vue similarity index 100% rename from src/components/ui/ProgressiveImage.vue rename to src/components/ui/image/ProgressiveImage.vue diff --git a/src/composables/useImageLightbox.ts b/src/components/ui/image/composables/useImageLightbox.ts similarity index 100% rename from src/composables/useImageLightbox.ts rename to src/components/ui/image/composables/useImageLightbox.ts diff --git a/src/components/ui/image/index.ts b/src/components/ui/image/index.ts new file mode 100644 index 0000000..f6e1395 --- /dev/null +++ b/src/components/ui/image/index.ts @@ -0,0 +1,10 @@ +// Image Components +export { default as ImageLightbox } from './ImageLightbox.vue' +export { default as ImageViewer } from './ImageViewer.vue' +export { default as ProgressiveImage } from './ProgressiveImage.vue' + +// Composables +export { useImageLightbox } from './composables/useImageLightbox' + +// Types +export type { LightboxImage, UseImageLightboxOptions } from './composables/useImageLightbox' \ No newline at end of file diff --git a/src/modules/market/components/ProductCard.vue b/src/modules/market/components/ProductCard.vue index b8fd899..be865eb 100644 --- a/src/modules/market/components/ProductCard.vue +++ b/src/modules/market/components/ProductCard.vue @@ -155,7 +155,7 @@ import { ref, computed, watch } from 'vue' import { Card, CardContent, CardFooter, CardTitle } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' -import ProgressiveImage from '@/components/ui/ProgressiveImage.vue' +import ProgressiveImage from '@/components/ui/image/ProgressiveImage.vue' import { ShoppingCart, Package, ChevronLeft, ChevronRight } from 'lucide-vue-next' import type { Product } from '@/modules/market/stores/market' diff --git a/src/modules/market/components/ProductDetailDialog.vue b/src/modules/market/components/ProductDetailDialog.vue deleted file mode 100644 index 4642a68..0000000 --- a/src/modules/market/components/ProductDetailDialog.vue +++ /dev/null @@ -1,261 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/modules/market/views/CheckoutPage.vue b/src/modules/market/views/CheckoutPage.vue index e8890b4..a5cbdb7 100644 --- a/src/modules/market/views/CheckoutPage.vue +++ b/src/modules/market/views/CheckoutPage.vue @@ -290,7 +290,7 @@ import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Textarea } from '@/components/ui/textarea' import { Label } from '@/components/ui/label' -import ProgressiveImage from '@/components/ui/ProgressiveImage.vue' +import ProgressiveImage from '@/components/ui/image/ProgressiveImage.vue' import { Package, CheckCircle diff --git a/src/modules/market/views/ProductDetailPage.vue b/src/modules/market/views/ProductDetailPage.vue index 8a0437d..36c0840 100644 --- a/src/modules/market/views/ProductDetailPage.vue +++ b/src/modules/market/views/ProductDetailPage.vue @@ -166,7 +166,7 @@ import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Badge } from '@/components/ui/badge' -import ImageViewer from '@/components/ui/ImageViewer.vue' +import ImageViewer from '@/components/ui/image/ImageViewer.vue' import { ShoppingCart, Store, Plus, Minus, ArrowLeft } from 'lucide-vue-next' import { useToast } from '@/core/composables/useToast' import type { Product } from '../types/market'