From e9dbdc3afe7b4e9f2da452e2c0fdb9b37f24269e Mon Sep 17 00:00:00 2001 From: "Dennis (via Claude+Gemma)" Date: Sat, 23 May 2026 10:13:53 +0200 Subject: [PATCH] feat(file-upload-component): FileUpload mit drag-and-drop [tsc:fail] --- .phase38-state.json | 3 +- .phase39-state.json | 5 ++ GENERATION_LOG.md | 25 +++++++ apps/web/src/components/FileUpload.tsx | 83 ++++++++++++++++++++++ scripts/phase39_features.py | 97 ++++++++++++++++++++++++++ 5 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 .phase39-state.json create mode 100644 apps/web/src/components/FileUpload.tsx create mode 100644 scripts/phase39_features.py diff --git a/.phase38-state.json b/.phase38-state.json index 93b2488..efe2212 100644 --- a/.phase38-state.json +++ b/.phase38-state.json @@ -5,6 +5,7 @@ "attempted_features": [ "spinner-component", "slider-component", - "rating-component" + "rating-component", + "chip-component" ] } \ No newline at end of file diff --git a/.phase39-state.json b/.phase39-state.json new file mode 100644 index 0000000..440a014 --- /dev/null +++ b/.phase39-state.json @@ -0,0 +1,5 @@ +{ + "completed_features": [], + "current_feature": "file-upload-component", + "started_at": "2026-05-23T10:13:25.521406" +} \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index 2ea2550..6602085 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -4107,3 +4107,28 @@ 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:09:26` **INFO** Committed feature chip-component +- `10:09:26` **INFO** Pushed: rc=0 + +## Phase-38 Run beendet (2026-05-23 10:09:26) + +- `10:09:26` **INFO** OK: 0, Attempted: 4, Total: 4 + +## 🚀 Phase-39 Codegen-Run gestartet (2026-05-23 10:13:25) + + +## Phase-3 Feature: file-upload-component (2026-05-23 10:13:25) + +- `10:13:25` **INFO** Description: FileUpload mit drag-and-drop +- `10:13:25` **INFO** Generating apps/web/src/components/FileUpload.tsx (FileUpload-Component. Props: onFiles(files: File[]), accept?, multiple…) +- `10:13:51` **INFO** wrote 2566 chars in 26.0s (attempt 1) +- `10:13:51` **INFO** Running tsc --noEmit on api… +- `10:13:53` **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/FileUpload.tsx b/apps/web/src/components/FileUpload.tsx new file mode 100644 index 0000000..0bf8223 --- /dev/null +++ b/apps/web/src/components/FileUpload.tsx @@ -0,0 +1,83 @@ +import React, { useRef } from 'react'; + +interface FileUploadProps { + onFiles: (files: File[]) => void; + accept?: string; + multiple?: boolean; + maxSizeMB?: number; +} + +export default function FileUpload({ + onFiles, + accept, + multiple = false, + maxSizeMB +}: FileUploadProps) { + const inputRef = useRef(null); + + const handleFileSelection = (files: FileList | null) => { + if (!files) return; + + const fileArray = Array.from(files); + const filteredFiles = fileArray.filter(file => { + if (maxSizeMB && file.size > maxSizeMB * 1024 * 1024) { + console.warn(`File ${file.name} exceeds size limit of ${maxSizeMB}MB`); + return false; + } + return true; + }); + + onFiles(filteredFiles); + }; + + const handleDrop = (e: React.DragEvent) => { + e.preventDefault(); + e.stopPropagation(); + handleFileSelection(e.dataTransfer.files); + }; + + const handleDragOver = (e: React.DragEvent) => { + e.preventDefault(); + e.stopPropagation(); + }; + + const handleClick = () => { + inputRef.current?.click(); + }; + + return ( +
+ handleFileSelection(e.target.files)} + accept={accept} + multiple={multiple} + className="hidden" + /> + +
+ + + + +

+ Drop files here or click to upload +

+ {maxSizeMB && ( +

Max size: {maxSizeMB}MB

+ )} +
+
+ ); +} \ No newline at end of file diff --git a/scripts/phase39_features.py b/scripts/phase39_features.py new file mode 100644 index 0000000..9ce7c9d --- /dev/null +++ b/scripts/phase39_features.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Phase-39: standalone components — FileUpload, ImageGallery, KeyValueList, CodeBlock.""" + +from __future__ import annotations + +import asyncio, datetime, json, sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from phase2_features import Feature, FileGen, ROOT, log, log_section +from phase3_features import run_feature_v2 + +PHASE_STATE = ROOT / ".phase39-state.json" + +FEATURES: list[Feature] = [ + Feature( + name="file-upload-component", + description="FileUpload mit drag-and-drop", + files=[FileGen( + path="apps/web/src/components/FileUpload.tsx", + purpose=( + "FileUpload-Component. Props: onFiles(files: File[]), accept?, multiple?, maxSizeMB?. " + "Dashed border + 'Drop files here or click'. onDragOver/onDrop/onClick → input file change. " + "Filter by accept + maxSize. Tailwind. Export default." + ), + )], + ), + Feature( + name="image-gallery-component", + description="ImageGallery mit Lightbox", + files=[FileGen( + path="apps/web/src/components/ImageGallery.tsx", + purpose=( + "ImageGallery-Component. Props: images (array {url, alt?, caption?}), columns? (default 3). " + "Grid. Klick auf image öffnet Modal-Lightbox (full-screen) mit prev/next. Escape schließt. " + "Tailwind. Export default." + ), + )], + ), + Feature( + name="key-value-list-component", + description="KeyValueList für Detail-Views", + files=[FileGen( + path="apps/web/src/components/KeyValueList.tsx", + purpose=( + "KeyValueList-Component. Props: items (array {key, value: ReactNode, copyable?}), layout?: 'horizontal'|'vertical'. " + "Horizontal: Grid 2 cols. Vertical: stacked. Wenn copyable: kleiner Copy-Icon button (lucide Copy). " + "Tailwind. Export default." + ), + )], + ), + Feature( + name="code-block-component", + description="CodeBlock mit syntax-color + copy", + files=[FileGen( + path="apps/web/src/components/CodeBlock.tsx", + purpose=( + "CodeBlock-Component. Props: code (string), language?: string, showCopyButton? (default true). " + "
 in dunklem bg (zinc-900), text-zinc-100 mono. "
+                "Copy-Button oben-rechts. Optional Language-Label oben-links. Tailwind. Export default."
+            ),
+        )],
+    ),
+]
+
+
+def load_state():
+    if PHASE_STATE.exists():
+        return json.loads(PHASE_STATE.read_text())
+    return {"completed_features": [], "current_feature": None, "started_at": datetime.datetime.now().isoformat()}
+
+
+def save_state(state):
+    PHASE_STATE.write_text(json.dumps(state, indent=2))
+
+
+async def main():
+    log_section("🚀 Phase-39 Codegen-Run gestartet")
+    state = load_state()
+    for feature in FEATURES:
+        if feature.name in state.get("completed_features", []):
+            continue
+        state["current_feature"] = feature.name; save_state(state)
+        try:
+            success = await run_feature_v2(feature)
+            state.setdefault("completed_features" if success else "attempted_features", []).append(feature.name)
+            save_state(state)
+        except Exception as e:
+            log(f"❌ {feature.name} crashed: {e}", level="ERROR")
+            state.setdefault("attempted_features", []).append(feature.name); save_state(state)
+    log_section("Phase-39 Run beendet")
+    log(f"OK: {len(state.get('completed_features', []))}, Attempted: {len(state.get('attempted_features', []))}, Total: {len(FEATURES)}")
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(asyncio.run(main()))