107 lines
4.1 KiB
Python
107 lines
4.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Phase-26: polish-pass with empty states, loading skeletons, perf, micro-improvements."""
|
|
|
|
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 / ".phase26-state.json"
|
|
|
|
FEATURES: list[Feature] = [
|
|
Feature(
|
|
name="loading-skeletons",
|
|
description="Skeleton-Component für Tabellen während Loading",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/TableSkeleton.tsx",
|
|
purpose=(
|
|
"TableSkeleton-Component. Props: rows (default 5), cols (default 4). "
|
|
"Rendert grey-pulsing animate-pulse bars in Table-Layout. Tailwind bg-gray-200 dark:bg-slate-700."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="empty-state-illustrations",
|
|
description="EmptyState erweitert: Emoji + bessere Hierarchie",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/EmptyState.tsx",
|
|
purpose=(
|
|
"ERWEITERT — behalte Props. Verbesserter Style: zentriert, gross emoji (4xl), title (text-lg semibold), "
|
|
"description (gray-500), optional action-button. Wenn icon prop given (z.B. 'inbox'): nutze lucide-react statt emoji."
|
|
),
|
|
refs=["apps/web/src/components/EmptyState.tsx"],
|
|
)],
|
|
),
|
|
Feature(
|
|
name="confirm-modal",
|
|
description="Reusable Confirm-Modal statt window.confirm()",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/ConfirmModal.tsx",
|
|
purpose=(
|
|
"ConfirmModal-Component. Props: open, onClose, onConfirm, title, message, confirmLabel? (default 'Bestätigen'), "
|
|
"danger? (red statt blue button). Tailwind centered overlay-modal."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="hover-tooltips",
|
|
description="Tooltip-Component (für Icon-Only-Buttons)",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/Tooltip.tsx",
|
|
purpose=(
|
|
"Tooltip-Component. Props: children, content (string). "
|
|
"On hover: zeigt content als kleine box oben rechts vom children. Tailwind absolute + invisible group-hover:visible."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="performance-memoization",
|
|
description="React.memo + useMemo in heavy Lists (Customers, Projects, TimeEntries)",
|
|
files=[FileGen(
|
|
path="apps/web/src/pages/Customers.tsx",
|
|
purpose=(
|
|
"ERWEITERT — wrap die einzelne Customer-Row in React.memo (falls als sub-component existiert), "
|
|
"oder useMemo für sortedCustomers Array. Behalte alles."
|
|
),
|
|
refs=["apps/web/src/pages/Customers.tsx"],
|
|
)],
|
|
),
|
|
]
|
|
|
|
|
|
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-26 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-26 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()))
|