#!/usr/bin/env python3
"""Phase-23: workspace-logo, custom-themes, command-actions, drag-widgets, animations."""
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 / ".phase23-state.json"
FEATURES: list[Feature] = [
Feature(
name="workspace-logo",
description="Logo-Feld auf appSettings + Anzeige in Nav",
files=[FileGen(
path="apps/api/src/db/schema.ts",
purpose=(
"WICHTIG: BEHALTE ALLE existierenden Tabellen/Spalten. "
"Füge nur Spalte `logoUrl: text('logo_url')` (nullable) zu appSettings. "
"BEHALTE: users, customers, projects (mit icon, budgetHours, pinnedAt), projectTemplates, timeEntries (notes, externalLink), "
"timeEntryAttachments, timeEntryComments, appSettings (workspaceName, defaultBillable, weekStart, roundingMinutes), "
"auditLog, documents, webhooks, savedViews, apiKeys, passwordResetTokens, invitations."
),
refs=["apps/api/src/db/schema.ts"],
), FileGen(
path="apps/web/src/components/Nav.tsx",
purpose=(
"ERWEITERT — wenn appSettings.logoUrl set, zeige Logo links statt 'EmberClone'-Text. "
"Behalte alle bestehenden Nav-Links."
),
refs=["apps/web/src/components/Nav.tsx"],
)],
),
Feature(
name="custom-themes",
description="3 Color-Themes wählbar (Ember/Ocean/Forest)",
files=[FileGen(
path="apps/web/src/lib/theme.tsx",
purpose=(
"ERWEITERT — behalte light/dark toggle. Füge zusätzlich color-theme: 'ember' | 'ocean' | 'forest'. "
"Persist in localStorage 'colorTheme'. Setzt document.documentElement.dataset.colorTheme. "
"useTheme() returns auch {colorTheme, setColorTheme}."
),
refs=["apps/web/src/lib/theme.tsx"],
), FileGen(
path="apps/web/src/index.css",
purpose=(
"ERWEITERT — behalte alles. Füge CSS-vars für color-themes: "
"html[data-color-theme='ember'] { --primary: #f97316 } "
"html[data-color-theme='ocean'] { --primary: #0ea5e9 } "
"html[data-color-theme='forest'] { --primary: #10b981 }"
),
refs=["apps/web/src/index.css"],
)],
),
Feature(
name="command-bar-actions",
description="CommandPalette mit Aktionen (z.B. 'New TimeEntry', 'Toggle Dark')",
files=[FileGen(
path="apps/web/src/components/CommandPalette.tsx",
purpose=(
"ERWEITERT — behalte bestehende Navigation-Items. Füge actions section: "
"'Neuer Time-Entry' (öffnet QuickAdd), 'Dark/Light umschalten', 'Theme wechseln', 'Logout'. "
"Fuzzy-Filter auch über actions."
),
refs=["apps/web/src/components/CommandPalette.tsx"],
)],
),
Feature(
name="animated-transitions",
description="Page-Transitions mit fade-in beim Route-Change",
files=[FileGen(
path="apps/web/src/index.css",
purpose=(
"ERWEITERT — füge fade-in animation utility: "
"@keyframes fade-in { from {opacity:0; transform:translateY(4px)} to {opacity:1; transform:translateY(0)} } "
".page-enter { animation: fade-in 200ms ease-out }. Behalte alles."
),
refs=["apps/web/src/index.css"],
), FileGen(
path="apps/web/src/App.tsx",
purpose=(
"ERWEITERT — wrap