#!/usr/bin/env python3 """Phase-44: standalone components — Drawer, BackToTop, ScrollArea, MenuBar.""" 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 / ".phase44-state.json" FEATURES: list[Feature] = [ Feature( name="drawer-component", description="Drawer (side-slide panel)", files=[FileGen( path="apps/web/src/components/Drawer.tsx", purpose=( "Drawer-Component. Props: open, onClose, side?: 'left'|'right' (default right), width?, children. " "Backdrop semi-transparent + sliding panel von side. transition translate-x. " "Escape schließt. Klick auf backdrop schließt. Tailwind. Export default." ), )], ), Feature( name="back-to-top-component", description="BackToTop floating button", files=[FileGen( path="apps/web/src/components/BackToTop.tsx", purpose=( "BackToTop-Component. useState visible. Listen auf scroll, zeigt sich wenn scrollY > 300. " "Floating button bottom-right (fixed). Klick: window.scrollTo({top:0, behavior:'smooth'}). " "ChevronUp Icon. Tailwind. Export default." ), )], ), Feature( name="scroll-area-component", description="ScrollArea mit custom scrollbar", files=[FileGen( path="apps/web/src/components/ScrollArea.tsx", purpose=( "ScrollArea-Component. Props: maxHeight (string), children, className?. " "Div mit overflow-y-auto + maxHeight + custom scrollbar Tailwind classes " "(scrollbar-thin scrollbar-thumb-zinc-400). Export default." ), )], ), Feature( name="menu-bar-component", description="MenuBar mit dropdowns (Datei, Bearbeiten, ...)", files=[FileGen( path="apps/web/src/components/MenuBar.tsx", purpose=( "MenuBar-Component. Props: menus (array {label, items: [{label, onClick, shortcut?}]}). " "Horizontal bar. Klick auf menu öffnet dropdown drunter. Click outside schließt. " "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-44 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-44 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()))