diff --git a/.phase39-state.json b/.phase39-state.json index 440a014..41a74fe 100644 --- a/.phase39-state.json +++ b/.phase39-state.json @@ -1,5 +1,8 @@ { "completed_features": [], - "current_feature": "file-upload-component", - "started_at": "2026-05-23T10:13:25.521406" + "current_feature": "image-gallery-component", + "started_at": "2026-05-23T10:13:25.521406", + "attempted_features": [ + "file-upload-component" + ] } \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index 6602085..fb1b147 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -4132,3 +4132,21 @@ src/index.ts(27,25): error TS2769: No overload matches this call. Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. Type 'Promise' provides no match for the signature '(instance: FastifyInstance, +- `10:13:53` **INFO** Committed feature file-upload-component +- `10:13:53` **INFO** Pushed: rc=0 + +## Phase-3 Feature: image-gallery-component (2026-05-23 10:13:53) + +- `10:13:53` **INFO** Description: ImageGallery mit Lightbox +- `10:13:53` **INFO** Generating apps/web/src/components/ImageGallery.tsx (ImageGallery-Component. Props: images (array {url, alt?, caption?}), c…) +- `10:14:23` **INFO** wrote 3699 chars in 30.2s (attempt 1) +- `10:14:23` **INFO** Running tsc --noEmit on api… +- `10:14:25` **WARN** tsc errors: +src/db/schema.ts(37,14): error TS7022: 'customers' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +src/db/schema.ts(45,59): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +src/db/schema.ts(49,14): error TS7022: 'projects' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +src/db/schema.ts(53,56): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +src/index.ts(27,25): error TS2769: No overload matches this call. + Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. + Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. + Type 'Promise' provides no match for the signature '(instance: FastifyInstance, diff --git a/apps/web/src/components/ImageGallery.tsx b/apps/web/src/components/ImageGallery.tsx new file mode 100644 index 0000000..6a476a8 --- /dev/null +++ b/apps/web/src/components/ImageGallery.tsx @@ -0,0 +1,113 @@ +import React, { useState, useEffect, useCallback } from 'react'; +import { X, ChevronLeft, ChevronRight } from 'lucide-react'; + +interface GalleryImage { + url: string; + alt?: string; + caption?: string; +} + +interface ImageGalleryProps { + images: GalleryImage[]; + columns?: number; +} + +export default function ImageGallery({ images, columns = 3 }: ImageGalleryProps) { + const [selectedIndex, setSelectedIndex] = useState(null); + + const closeLightbox = useCallback(() => { + setSelectedIndex(null); + }, []); + + const goToPrev = useCallback((e: React.MouseEvent) => { + e.stopPropagation(); + setSelectedIndex((prev) => (prev !== null && prev > 0 ? prev - 1 : images.length - 1)); + }, [images.length]); + + const goToNext = useCallback((e: React.MouseEvent) => { + e.stopPropagation(); + setSelectedIndex((prev) => (prev !== null && prev < images.length - 1 ? prev + 1 : 0)); + }, [images.length]); + + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + if (selectedIndex === null) return; + if (e.key === 'Escape') closeLightbox(); + if (e.key === 'ArrowLeft') goToPrev({ stopPropagation: () => {} } as any); + if (e.key === 'ArrowRight') goToNext({ stopPropagation: () => {} } as any); + }; + + window.addEventListener('keydown', handleKeyDown); + return () => window.removeEventListener('keydown', handleKeyDown); + }, [selectedIndex, closeLightbox, goToPrev, goToNext]); + + if (!images || images.length === 0) return null; + + return ( + <> +
+ {images.map((img, idx) => ( +
setSelectedIndex(idx)} + > + {img.alt +
+ ))} +
+ + {selectedIndex !== null && ( +
+ + + + +
e.stopPropagation()} + > + {images[selectedIndex].alt + {images[selectedIndex].caption && ( +

+ {images[selectedIndex].caption} +

+ )} +
+ + +
+ )} + + ); +} \ No newline at end of file