diff --git a/.phase23-state.json b/.phase23-state.json index 26585de..69f0311 100644 --- a/.phase23-state.json +++ b/.phase23-state.json @@ -6,6 +6,7 @@ "workspace-logo", "custom-themes", "command-bar-actions", - "animated-transitions" + "animated-transitions", + "drag-resize-widgets" ] } \ No newline at end of file diff --git a/.phase24-state.json b/.phase24-state.json new file mode 100644 index 0000000..d461f45 --- /dev/null +++ b/.phase24-state.json @@ -0,0 +1,5 @@ +{ + "completed_features": [], + "current_feature": "notification-bell", + "started_at": "2026-05-23T08:33:42.059540" +} \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index 4b3ee2a..39d154e 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -2778,3 +2778,29 @@ src/index.ts(27,25): error TS2769: No overload matches this call. Overload 2 of 3, '(plugin: FastifyPluginAsync<{ 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 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. Type 'Promise' provides no match for the signature '(instance: FastifyInstance, FastifyBaseLogger, FastifyTy +- `08:31:53` **INFO** Committed feature drag-resize-widgets +- `08:31:54` **INFO** Pushed: rc=0 + +## Phase-23 Run beendet (2026-05-23 08:31:54) + +- `08:31:54` **INFO** OK: 0, Attempted: 5, Total: 5 + +## 🚀 Phase-24 Codegen-Run gestartet (2026-05-23 08:33:42) + + +## Phase-3 Feature: notification-bell (2026-05-23 08:33:42) + +- `08:33:42` **INFO** Description: Bell-Icon in Nav mit unread count + dropdown letzte 10 Audit-Events des Users +- `08:33:42` **INFO** Generating apps/web/src/components/NotificationBell.tsx (Bell-Icon (lucide-react Bell). useQuery api.listAuditLog({userId:'me',…) +- `08:34:08` **INFO** wrote 3104 chars in 26.3s (attempt 1) +- `08:34:08` **INFO** Generating apps/web/src/components/Nav.tsx (ERWEITERT — füge rechts neben Avatar in Nav. Beha…) +- `08:35:19` **INFO** wrote 7792 chars in 71.0s (attempt 1) +- `08:35:19` **INFO** Running tsc --noEmit on api… +- `08:35:21` **WARN** tsc errors: +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, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }, done: (err?: Error | undefined) => void): void'. + Overload 2 of 3, '(plugin: FastifyPluginAsync<{ 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 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. + Type 'Promise' provides no match for the signature '(instance: FastifyInstance, FastifyBaseLogger, FastifyTy diff --git a/apps/web/src/components/Nav.tsx b/apps/web/src/components/Nav.tsx index 9e7a90a..f17a5e2 100644 --- a/apps/web/src/components/Nav.tsx +++ b/apps/web/src/components/Nav.tsx @@ -18,13 +18,42 @@ import { Languages, LogOut, FileText, - LayoutTemplate + LayoutTemplate, + Bell } from "lucide-react" import { useQuery } from "@tanstack/react-query" import { api } from "../lib/api" import { useTheme } from "../lib/theme" import Avatar from "./Avatar" +function NotificationBell() { + const { data: notifications, isLoading } = useQuery({ + queryKey: ['notifications', 'unread'], + queryFn: async () => { + const res = await api.get('/notifications/unread'); + return res; + } + }) + + const unreadCount = notifications?.length || 0 + + return ( +
+ +
+ ) +} + export default function Nav() { const location = useLocation() const { theme, toggleTheme } = useTheme() @@ -119,28 +148,38 @@ export default function Nav() { -
+
{allItems.map((item) => ( ))}
-
+
+
+ + +
+ +
+ + +
+ - -
- - - - +
)} diff --git a/apps/web/src/components/NotificationBell.tsx b/apps/web/src/components/NotificationBell.tsx new file mode 100644 index 0000000..d01753b --- /dev/null +++ b/apps/web/src/components/NotificationBell.tsx @@ -0,0 +1,89 @@ +import React, { useState, useEffect } from 'react'; +import { Bell } from 'lucide-react'; +import { useQuery } from '@tanstack/react-query'; +import { api } from '@emberclone/shared'; +import type { AuditLog } from '@emberclone/shared'; + +export default function NotificationBell() { + const [isOpen, setIsOpen] = useState(false); + const [unreadCount, setUnreadCount] = useState(0); + + const { data: logs, isLoading } = useQuery({ + queryKey: ['audit-log', 'notifications'], + queryFn: () => api.listAuditLog({ userId: 'me', limit: 10 }), + }); + + useEffect(() => { + if (logs) { + const lastSeen = localStorage.getItem('lastSeenAuditAt'); + if (!lastSeen) { + setUnreadCount(logs.length); + return; + } + + const lastSeenDate = new Date(lastSeen).getTime(); + const unread = logs.filter((log) => { + const logDate = new Date(log.createdAt).getTime(); + return logDate > lastSeenDate; + }).length; + + setUnreadCount(unread); + } + }, [logs]); + + const handleOpen = () => { + setIsOpen(!isOpen); + if (!isOpen) { + localStorage.setItem('lastSeenAuditAt', new Date().toISOString()); + setUnreadCount(0); + } + }; + + return ( +
+ + + {isOpen && ( + <> +
setIsOpen(false)} + /> +
+
+ Notifications +
+
+ {isLoading ? ( +
Loading...
+ ) : logs && logs.length > 0 ? ( +
+ {logs.map((log) => ( +
+
{log.action}
+
+ {new Date(log.createdAt).toLocaleString()} +
+
+ ))} +
+ ) : ( +
No notifications
+ )} +
+
+ + )} +
+ ); +} \ No newline at end of file diff --git a/scripts/phase24_features.py b/scripts/phase24_features.py new file mode 100644 index 0000000..8628032 --- /dev/null +++ b/scripts/phase24_features.py @@ -0,0 +1,118 @@ +#!/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 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()))