feat(alert-component): Alert-Banner mit dismiss [tsc:fail]
This commit is contained in:
parent
8c9a0e8674
commit
eb8f225e85
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"completed_features": [],
|
"completed_features": [],
|
||||||
"current_feature": "accordion-component",
|
"current_feature": "alert-component",
|
||||||
"started_at": "2026-05-23T09:48:28.280761",
|
"started_at": "2026-05-23T09:48:28.280761",
|
||||||
"attempted_features": [
|
"attempted_features": [
|
||||||
"tabs-component"
|
"tabs-component",
|
||||||
|
"accordion-component"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -3755,3 +3755,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>,
|
||||||
|
- `09:49:00` **INFO** Committed feature accordion-component
|
||||||
|
- `09:49:00` **INFO** Pushed: rc=0
|
||||||
|
|
||||||
|
## Phase-3 Feature: alert-component (2026-05-23 09:49:00)
|
||||||
|
|
||||||
|
- `09:49:00` **INFO** Description: Alert-Banner mit dismiss
|
||||||
|
- `09:49:00` **INFO** Generating apps/web/src/components/Alert.tsx (Alert-Component. Props: variant ('info'|'success'|'warning'|'error'), …)
|
||||||
|
- `09:49:20` **INFO** wrote 2092 chars in 20.0s (attempt 1)
|
||||||
|
- `09:49:20` **INFO** Running tsc --noEmit on api…
|
||||||
|
- `09:49:22` **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>,
|
||||||
|
|||||||
81
apps/web/src/components/Alert.tsx
Normal file
81
apps/web/src/components/Alert.tsx
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { Info, CheckCircle, AlertTriangle, XCircle, X } from 'lucide-react';
|
||||||
|
|
||||||
|
type AlertVariant = 'info' | 'success' | 'warning' | 'error';
|
||||||
|
|
||||||
|
interface AlertProps {
|
||||||
|
variant: AlertVariant;
|
||||||
|
title?: string;
|
||||||
|
children: React.ReactNode;
|
||||||
|
dismissible?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const variantStyles: Record<AlertVariant, {
|
||||||
|
container: string;
|
||||||
|
border: string;
|
||||||
|
icon: React.ElementType;
|
||||||
|
iconColor: string
|
||||||
|
}> = {
|
||||||
|
info: {
|
||||||
|
container: 'bg-blue-50 text-blue-800',
|
||||||
|
border: 'border-blue-200',
|
||||||
|
icon: Info,
|
||||||
|
iconColor: 'text-blue-500',
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
container: 'bg-green-50 text-green-800',
|
||||||
|
border: 'border-green-200',
|
||||||
|
icon: CheckCircle,
|
||||||
|
iconColor: 'text-green-500',
|
||||||
|
},
|
||||||
|
warning: {
|
||||||
|
container: 'bg-yellow-50 text-yellow-800',
|
||||||
|
border: 'border-yellow-200',
|
||||||
|
icon: AlertTriangle,
|
||||||
|
iconColor: 'text-yellow-500',
|
||||||
|
},
|
||||||
|
error: {
|
||||||
|
container: 'bg-red-50 text-red-800',
|
||||||
|
border: 'border-red-200',
|
||||||
|
icon: XCircle,
|
||||||
|
iconColor: 'text-red-500',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function Alert({ variant, title, children, dismissible = false }: AlertProps) {
|
||||||
|
const [isVisible, setIsVisible] = useState(true);
|
||||||
|
|
||||||
|
if (!isVisible) return null;
|
||||||
|
|
||||||
|
const style = variantStyles[variant];
|
||||||
|
const Icon = style.icon;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`relative p-4 rounded-lg border ${style.container} ${style.border} flex gap-3 items-start`}>
|
||||||
|
<div className="flex-shrink-0 mt-0.5">
|
||||||
|
<Icon className={`w-5 h-5 ${style.iconColor}`} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex-1">
|
||||||
|
{title && (
|
||||||
|
<strong className="block font-semibold mb-1">
|
||||||
|
{title}
|
||||||
|
</strong>
|
||||||
|
)}
|
||||||
|
<div className="text-sm opacity-90">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{dismissible && (
|
||||||
|
<button
|
||||||
|
onClick={() => setIsVisible(false)}
|
||||||
|
className="flex-shrink-0 p-1 rounded-md hover:bg-black/5 transition-colors"
|
||||||
|
aria-label="Dismiss alert"
|
||||||
|
>
|
||||||
|
<X className="w-4 h-4 opacity-60" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user