119 lines
4.7 KiB
Python
119 lines
4.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Phase-24: workspace-switcher, notification-bell, billing-history, pdf-export-real, archive-icon."""
|
|
|
|
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 / ".phase24-state.json"
|
|
|
|
FEATURES: list[Feature] = [
|
|
Feature(
|
|
name="notification-bell",
|
|
description="Bell-Icon in Nav mit unread count + dropdown letzte 10 Audit-Events des Users",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/NotificationBell.tsx",
|
|
purpose=(
|
|
"Bell-Icon (lucide-react Bell). useQuery api.listAuditLog({userId:'me', limit:10}). "
|
|
"Badge mit Anzahl ungesehener (localStorage 'lastSeenAuditAt' vergleichen). "
|
|
"Klick öffnet Dropdown mit Liste der Events. Beim Öffnen: setLastSeenAuditAt(now)."
|
|
),
|
|
), FileGen(
|
|
path="apps/web/src/components/Nav.tsx",
|
|
purpose=(
|
|
"ERWEITERT — füge <NotificationBell /> rechts neben Avatar in Nav. Behalte alles."
|
|
),
|
|
refs=["apps/web/src/components/Nav.tsx"],
|
|
)],
|
|
),
|
|
Feature(
|
|
name="workspace-switcher-stub",
|
|
description="Workspace-Switcher-Dropdown (Stub mit single workspace)",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/WorkspaceSwitcher.tsx",
|
|
purpose=(
|
|
"WorkspaceSwitcher-Dropdown. Zeigt aktuellen workspace.name (aus api.getSettings()). "
|
|
"Dropdown mit 'Default Workspace' (active) + 'Workspace anlegen…' (disabled, Toast 'kommt in v2'). "
|
|
"Tailwind, button mit chevron-down."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="billing-history-table",
|
|
description="Billing-Page bekommt Mock-Rechnungshistorie",
|
|
files=[FileGen(
|
|
path="apps/web/src/pages/Billing.tsx",
|
|
purpose=(
|
|
"ERWEITERT — behalte Plans-Cards. Füge Section 'Rechnungshistorie': "
|
|
"Mock-Array 3 Einträge {date, amount, status:'paid'|'pending', invoiceUrl:'#'}. "
|
|
"Tabelle mit Download-Button (disabled, 'kommt in v2')."
|
|
),
|
|
refs=["apps/web/src/pages/Billing.tsx"],
|
|
)],
|
|
),
|
|
Feature(
|
|
name="project-archive-icon",
|
|
description="Archive-Icon-Button pro Project (Soft-Archive via active=false)",
|
|
files=[FileGen(
|
|
path="apps/web/src/pages/Projects.tsx",
|
|
purpose=(
|
|
"ERWEITERT — füge Archive-Button (Archive-Icon lucide-react) pro Project-Row. "
|
|
"Klick: api.updateProject(id, {active:false}), refetch. Archivierte muted (opacity-50). "
|
|
"Filter-Toggle oben: 'Archivierte zeigen'."
|
|
),
|
|
refs=["apps/web/src/pages/Projects.tsx"],
|
|
)],
|
|
),
|
|
Feature(
|
|
name="export-improvements",
|
|
description="Export-Button auch in Customers + Projects",
|
|
files=[FileGen(
|
|
path="apps/web/src/pages/Customers.tsx",
|
|
purpose=(
|
|
"ERWEITERT — füge 'CSV exportieren'-Button oben rechts. "
|
|
"Generiert CSV inline aus customers-Array (id,name,active,createdAt). "
|
|
"Download via Blob URL. 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-24 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-24 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()))
|