feat(popover-component): Popover (klick-getriggert) [tsc:fail]
This commit is contained in:
parent
9a83730533
commit
6580e5262a
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"completed_features": [],
|
"completed_features": [],
|
||||||
"current_feature": "context-menu-component",
|
"current_feature": "popover-component",
|
||||||
"started_at": "2026-05-23T10:28:27.180963",
|
"started_at": "2026-05-23T10:28:27.180963",
|
||||||
"attempted_features": [
|
"attempted_features": [
|
||||||
"button-group-component"
|
"button-group-component",
|
||||||
|
"context-menu-component"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -4387,3 +4387,21 @@ 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>,
|
||||||
|
- `10:29:02` **INFO** Committed feature context-menu-component
|
||||||
|
- `10:29:02` **INFO** Pushed: rc=0
|
||||||
|
|
||||||
|
## Phase-3 Feature: popover-component (2026-05-23 10:29:02)
|
||||||
|
|
||||||
|
- `10:29:02` **INFO** Description: Popover (klick-getriggert)
|
||||||
|
- `10:29:02` **INFO** Generating apps/web/src/components/Popover.tsx (Popover-Component. Props: trigger (ReactNode), content (ReactNode), po…)
|
||||||
|
- `10:29:22` **INFO** wrote 2117 chars in 19.8s (attempt 1)
|
||||||
|
- `10:29:22` **INFO** Running tsc --noEmit on api…
|
||||||
|
- `10:29:24` **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>,
|
||||||
|
|||||||
58
apps/web/src/components/Popover.tsx
Normal file
58
apps/web/src/components/Popover.tsx
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import React, { useState, useRef, useEffect } from 'react';
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
|
interface PopoverProps {
|
||||||
|
trigger: ReactNode;
|
||||||
|
content: ReactNode;
|
||||||
|
position?: 'top' | 'bottom' | 'left' | 'right';
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Popover({ trigger, content, position = 'bottom' }: PopoverProps) {
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
function handleClickOutside(event: MouseEvent) {
|
||||||
|
if (containerRef.current && !containerRef.current.contains(event.target as Node)) {
|
||||||
|
setIsOpen(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOpen) {
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
}
|
||||||
|
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
|
const positionClasses = {
|
||||||
|
top: 'bottom-full left-1/2 -translate-x-1/2 mb-2',
|
||||||
|
bottom: 'top-full left-1/2 -translate-x-1/2 mt-2',
|
||||||
|
left: 'right-full top-1/2 -translate-y-1/2 mr-2',
|
||||||
|
right: 'left-full top-1/2 -translate-y-1/2 ml-2',
|
||||||
|
};
|
||||||
|
|
||||||
|
const arrowClasses = {
|
||||||
|
top: 'bottom-[-4px] left-1/2 -translate-x-1/2 border-t-gray-200 border-x-transparent border-b-transparent',
|
||||||
|
bottom: 'top-[-4px] left-1/2 -translate-x-1/2 border-b-gray-200 border-x-transparent border-t-transparent',
|
||||||
|
left: 'right-[-4px] top-1/2 -translate-y-1/2 border-l-gray-200 border-y-transparent border-r-transparent',
|
||||||
|
right: 'left-[-4px] top-1/2 -translate-y-1/2 border-r-gray-200 border-y-transparent border-l-transparent',
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={containerRef} className="relative inline-block">
|
||||||
|
<div onClick={() => setIsOpen(!isOpen)} className="cursor-pointer">
|
||||||
|
{trigger}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isOpen && (
|
||||||
|
<div className={`absolute z-50 w-max max-w-xs bg-white border border-gray-200 rounded-lg shadow-lg p-3 ${positionClasses[position]}`}>
|
||||||
|
{/* Arrow */}
|
||||||
|
<div className={`absolute w-2 h-2 border-4 ${arrowClasses[position]}`} />
|
||||||
|
|
||||||
|
<div className="relative z-10">
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user