feat(dropdown-menu-component): DropdownMenu mit Items [tsc:fail]
This commit is contained in:
parent
304e86dd42
commit
df55212a6d
@ -5,6 +5,7 @@
|
|||||||
"attempted_features": [
|
"attempted_features": [
|
||||||
"tabs-component",
|
"tabs-component",
|
||||||
"accordion-component",
|
"accordion-component",
|
||||||
"alert-component"
|
"alert-component",
|
||||||
|
"progress-bar-component"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
5
.phase35-state.json
Normal file
5
.phase35-state.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"completed_features": [],
|
||||||
|
"current_feature": "dropdown-menu-component",
|
||||||
|
"started_at": "2026-05-23T09:53:25.616963"
|
||||||
|
}
|
||||||
@ -3791,3 +3791,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.
|
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<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||||
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,
|
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,
|
||||||
|
- `09:49:34` **INFO** Committed feature progress-bar-component
|
||||||
|
- `09:49:34` **INFO** Pushed: rc=0
|
||||||
|
|
||||||
|
## Phase-34 Run beendet (2026-05-23 09:49:34)
|
||||||
|
|
||||||
|
- `09:49:34` **INFO** OK: 0, Attempted: 4, Total: 4
|
||||||
|
|
||||||
|
## 🚀 Phase-35 Codegen-Run gestartet (2026-05-23 09:53:25)
|
||||||
|
|
||||||
|
|
||||||
|
## Phase-3 Feature: dropdown-menu-component (2026-05-23 09:53:25)
|
||||||
|
|
||||||
|
- `09:53:25` **INFO** Description: DropdownMenu mit Items
|
||||||
|
- `09:53:25` **INFO** Generating apps/web/src/components/DropdownMenu.tsx (DropdownMenu-Component. Props: trigger (ReactNode), items (array {labe…)
|
||||||
|
- `09:53:42` **INFO** wrote 2116 chars in 17.0s (attempt 1)
|
||||||
|
- `09:53:42` **INFO** Running tsc --noEmit on api…
|
||||||
|
- `09:53:44` **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<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
|
||||||
|
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,
|
||||||
|
|||||||
71
apps/web/src/components/DropdownMenu.tsx
Normal file
71
apps/web/src/components/DropdownMenu.tsx
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
import React, { useState, useEffect, useRef, ReactNode } from 'react';
|
||||||
|
|
||||||
|
interface DropdownItem {
|
||||||
|
label: string;
|
||||||
|
icon?: ReactNode;
|
||||||
|
onClick: () => void;
|
||||||
|
danger?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DropdownMenuProps {
|
||||||
|
trigger: ReactNode;
|
||||||
|
items: DropdownItem[];
|
||||||
|
align?: 'left' | 'right';
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DropdownMenu({ trigger, items, align = 'left' }: DropdownMenuProps) {
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isOpen) return;
|
||||||
|
|
||||||
|
function handleClickOutside(event: MouseEvent) {
|
||||||
|
if (containerRef.current && !containerRef.current.contains(event.target as Node)) {
|
||||||
|
setIsOpen(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
|
const alignmentClass = align === 'right' ? 'right-0' : 'left-0';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={containerRef} className="relative inline-block text-left">
|
||||||
|
<div
|
||||||
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
|
className="cursor-pointer"
|
||||||
|
>
|
||||||
|
{trigger}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isOpen && (
|
||||||
|
<div
|
||||||
|
className={`absolute z-50 mt-2 w-48 origin-top-left bg-white border border-gray-200 rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ${alignmentClass}`}
|
||||||
|
>
|
||||||
|
<div className="py-1">
|
||||||
|
{items.map((item, index) => (
|
||||||
|
<button
|
||||||
|
key={index}
|
||||||
|
onClick={() => {
|
||||||
|
item.onClick();
|
||||||
|
setIsOpen(false);
|
||||||
|
}}
|
||||||
|
className={`flex items-center w-full px-4 py-2 text-sm transition-colors duration-150 ${
|
||||||
|
item.danger
|
||||||
|
? 'text-red-600 hover:bg-red-50'
|
||||||
|
: 'text-gray-700 hover:bg-gray-100'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{item.icon && <span className="mr-2">{item.icon}</span>}
|
||||||
|
{item.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
97
scripts/phase35_features.py
Normal file
97
scripts/phase35_features.py
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Phase-35: standalone form components — DropdownMenu, Checkbox, Switch, Radio."""
|
||||||
|
|
||||||
|
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 / ".phase35-state.json"
|
||||||
|
|
||||||
|
FEATURES: list[Feature] = [
|
||||||
|
Feature(
|
||||||
|
name="dropdown-menu-component",
|
||||||
|
description="DropdownMenu mit Items",
|
||||||
|
files=[FileGen(
|
||||||
|
path="apps/web/src/components/DropdownMenu.tsx",
|
||||||
|
purpose=(
|
||||||
|
"DropdownMenu-Component. Props: trigger (ReactNode), items (array {label, icon?, onClick, danger?}), align?: 'left'|'right'. "
|
||||||
|
"useState open. Click outside zum schließen (useEffect mit document listener). "
|
||||||
|
"Absolute positioned dropdown mit shadow + items. danger=text-red-600. Tailwind. Export default."
|
||||||
|
),
|
||||||
|
)],
|
||||||
|
),
|
||||||
|
Feature(
|
||||||
|
name="checkbox-component",
|
||||||
|
description="Checkbox mit Label",
|
||||||
|
files=[FileGen(
|
||||||
|
path="apps/web/src/components/Checkbox.tsx",
|
||||||
|
purpose=(
|
||||||
|
"Checkbox-Component. Props: checked, onChange, label?, disabled?. "
|
||||||
|
"Native <input type=checkbox> styled mit Tailwind + Label. "
|
||||||
|
"focus:ring-2. Export default."
|
||||||
|
),
|
||||||
|
)],
|
||||||
|
),
|
||||||
|
Feature(
|
||||||
|
name="switch-toggle-component",
|
||||||
|
description="Switch/Toggle mit slide-Animation",
|
||||||
|
files=[FileGen(
|
||||||
|
path="apps/web/src/components/Switch.tsx",
|
||||||
|
purpose=(
|
||||||
|
"Switch-Component. Props: checked, onChange, label?, size?: 'sm'|'md'. "
|
||||||
|
"Sliding pill (translate-x animation). bg-zinc-300 wenn off, bg-blue-600 wenn on. "
|
||||||
|
"Tailwind. Export default."
|
||||||
|
),
|
||||||
|
)],
|
||||||
|
),
|
||||||
|
Feature(
|
||||||
|
name="radio-group-component",
|
||||||
|
description="RadioGroup mit Optionen",
|
||||||
|
files=[FileGen(
|
||||||
|
path="apps/web/src/components/RadioGroup.tsx",
|
||||||
|
purpose=(
|
||||||
|
"RadioGroup-Component. Props: value, onChange, options (array {value, label, description?}), name. "
|
||||||
|
"Vertikale Liste mit nativen <input type=radio> + labels. "
|
||||||
|
"Aktive: ring-2 ring-blue-500. Tailwind. Export default."
|
||||||
|
),
|
||||||
|
)],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
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-35 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-35 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()))
|
||||||
Loading…
Reference in New Issue
Block a user