From eb65bea128c2ed380614c4db1dfa59d3c9f2beff Mon Sep 17 00:00:00 2001 From: "Dennis (via Claude+Gemma)" Date: Sat, 23 May 2026 09:19:02 +0200 Subject: [PATCH] =?UTF-8?q?feat(recently-viewed-widget):=20Recently-Viewed?= =?UTF-8?q?=20Widget=20f=C3=BCr=20Dashboard=20(last=205=20customers=20+=20?= =?UTF-8?q?pro=20[tsc:fail]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .phase28-state.json | 3 +- .phase29-state.json | 5 + GENERATION_LOG.md | 25 +++++ apps/web/src/components/RecentlyViewed.tsx | 75 ++++++++++++++ scripts/phase29_features.py | 108 +++++++++++++++++++++ 5 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 .phase29-state.json create mode 100644 apps/web/src/components/RecentlyViewed.tsx create mode 100644 scripts/phase29_features.py diff --git a/.phase28-state.json b/.phase28-state.json index 9bfa6d8..17d6b13 100644 --- a/.phase28-state.json +++ b/.phase28-state.json @@ -5,6 +5,7 @@ "attempted_features": [ "customer-contact-info", "project-billing-rate", - "time-entry-clone" + "time-entry-clone", + "breadcrumbs-everywhere" ] } \ No newline at end of file diff --git a/.phase29-state.json b/.phase29-state.json new file mode 100644 index 0000000..49bad46 --- /dev/null +++ b/.phase29-state.json @@ -0,0 +1,5 @@ +{ + "completed_features": [], + "current_feature": "recently-viewed-widget", + "started_at": "2026-05-23T09:18:37.298269" +} \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index 52c4dc5..9a283a3 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -3275,3 +3275,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, +- `09:15:44` **INFO** Committed feature breadcrumbs-everywhere +- `09:15:45` **INFO** Pushed: rc=0 + +## Phase-28 Run beendet (2026-05-23 09:15:45) + +- `09:15:45` **INFO** OK: 0, Attempted: 4, Total: 4 + +## 🚀 Phase-29 Codegen-Run gestartet (2026-05-23 09:18:37) + + +## Phase-3 Feature: recently-viewed-widget (2026-05-23 09:18:37) + +- `09:18:37` **INFO** Description: Recently-Viewed Widget für Dashboard (last 5 customers + projects) +- `09:18:37` **INFO** Generating apps/web/src/components/RecentlyViewed.tsx (RecentlyViewed-Widget. localStorage 'recently_viewed' array {type:'cus…) +- `09:19:00` **INFO** wrote 2774 chars in 23.3s (attempt 1) +- `09:19:00` **INFO** Running tsc --noEmit on api… +- `09:19:02` **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/RecentlyViewed.tsx b/apps/web/src/components/RecentlyViewed.tsx new file mode 100644 index 0000000..b12a761 --- /dev/null +++ b/apps/web/src/components/RecentlyViewed.tsx @@ -0,0 +1,75 @@ +import React, { useEffect, useState } from 'react'; +import { Link, useLocation } from '@tanstack/react-router'; + +type ViewedItem = { + type: 'customer' | 'project'; + id: string; + name: string; + viewedAt: number; +}; + +export default function RecentlyViewed() { + const location = useLocation(); + const [items, setItems] = useState([]); + + useEffect(() => { + // 1. Track current route + const path = location.pathname; + const customerMatch = path.match(/\/customers\/([^/]+)/); + const projectMatch = path.match(/\/projects\/([^/]+)/); + + if (customerMatch || projectMatch) { + const type = customerMatch ? 'customer' : 'project'; + const id = customerMatch ? customerMatch[1] : projectMatch![1]; + + // In a real app, we'd fetch the name from a store/cache. + // For the widget, we'll use a placeholder or try to extract from state if available. + // Here we use a generic label since we don't have the full entity object in the URL. + const name = `View ${id}`; + + const stored = localStorage.getItem('recently_viewed'); + const parsed: ViewedItem[] = stored ? JSON.parse(stored) : []; + + // Remove existing entry of same item to move it to top + const filtered = parsed.filter(i => !(i.type === type && i.id === id)); + const updated = [{ type, id, name, viewedAt: Date.now() }, ...filtered].slice(0, 5); + + localStorage.setItem('recently_viewed', JSON.stringify(updated)); + setItems(updated); + } + }, [location.pathname]); + + // Initial load + useEffect(() => { + const stored = localStorage.getItem('recently_viewed'); + if (stored) setItems(JSON.parse(stored)); + }, []); + + if (items.length === 0) return null; + + return ( +
+

+ Recently Viewed +

+
    + {items.map((item) => ( +
  • + +
    + + {item.name} +
    + + → + + +
  • + ))} +
+
+ ); +} \ No newline at end of file diff --git a/scripts/phase29_features.py b/scripts/phase29_features.py new file mode 100644 index 0000000..38d7cb5 --- /dev/null +++ b/scripts/phase29_features.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +"""Phase-29: favorites, recently-viewed, project-grouping, keyboard-shortcuts, onboarding-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 / ".phase29-state.json" + +FEATURES: list[Feature] = [ + Feature( + name="recently-viewed-widget", + description="Recently-Viewed Widget für Dashboard (last 5 customers + projects)", + files=[FileGen( + path="apps/web/src/components/RecentlyViewed.tsx", + purpose=( + "RecentlyViewed-Widget. localStorage 'recently_viewed' array {type:'customer'|'project',id,name,viewedAt}. " + "useEffect on route-change pushed current item. Zeigt top 5 als Liste mit Link." + ), + )], + ), + Feature( + name="favorites-system", + description="User kann Customer/Project favoritisieren (localStorage)", + files=[FileGen( + path="apps/web/src/lib/favorites.ts", + purpose=( + "useFavorites() hook + util. Manages localStorage 'favorites' Set per entity-type. " + "Methoden: isFavorite(type,id), toggle(type,id), getAll(type). Triggers re-render via custom event." + ), + )], + ), + Feature( + name="more-keyboard-shortcuts", + description="? für Help, G+H for home, etc — Hotkey-Registry", + files=[FileGen( + path="apps/web/src/components/KeyboardHelp.tsx", + purpose=( + "ERWEITERT — füge mehr shortcuts dokumentiert: G H = Dashboard, G T = TimeEntries, G C = Customers, G P = Projects, " + "G S = Settings, N = New Entry, ? = Hilfe, Cmd+K = Palette. Behalte alles." + ), + refs=["apps/web/src/components/KeyboardHelp.tsx"], + )], + ), + Feature( + name="onboarding-improvements", + description="Onboarding-Tour: 3 Schritte (Dashboard → Customer anlegen → TimeEntry tracken)", + files=[FileGen( + path="apps/web/src/components/OnboardingTour.tsx", + purpose=( + "ERWEITERT — behalte Trigger-Logik. Verbesserte Steps: " + "1. Welcome auf Dashboard, 2. 'Kunde anlegen' → highlight /customers, 3. 'Zeit erfassen' → highlight /time-entries. " + "Mit 'Skip Tour' + 'Got it' buttons." + ), + refs=["apps/web/src/components/OnboardingTour.tsx"], + )], + ), + Feature( + name="dashboard-favorites-section", + description="Dashboard zeigt Favorites als Quick-Access", + files=[FileGen( + path="apps/web/src/pages/Dashboard.tsx", + purpose=( + "ERWEITERT — füge Favorites-Section unten: useFavorites() für customers + projects. " + "Chips/Cards mit Link zur Detail-Page. Wenn leer: hide section. Behalte alles." + ), + refs=["apps/web/src/pages/Dashboard.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-29 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-29 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()))