feat(code-block-component): CodeBlock mit syntax-color + copy [tsc:fail]

This commit is contained in:
Dennis (via Claude+Gemma) 2026-05-23 10:14:59 +02:00
parent 155499c063
commit 2b9bfe0eaf
3 changed files with 68 additions and 2 deletions

View File

@ -1,9 +1,10 @@
{ {
"completed_features": [], "completed_features": [],
"current_feature": "key-value-list-component", "current_feature": "code-block-component",
"started_at": "2026-05-23T10:13:25.521406", "started_at": "2026-05-23T10:13:25.521406",
"attempted_features": [ "attempted_features": [
"file-upload-component", "file-upload-component",
"image-gallery-component" "image-gallery-component",
"key-value-list-component"
] ]
} }

View File

@ -4168,3 +4168,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:14:44` **INFO** Committed feature key-value-list-component
- `10:14:44` **INFO** Pushed: rc=0
## Phase-3 Feature: code-block-component (2026-05-23 10:14:44)
- `10:14:44` **INFO** Description: CodeBlock mit syntax-color + copy
- `10:14:44` **INFO** Generating apps/web/src/components/CodeBlock.tsx (CodeBlock-Component. Props: code (string), language?: string, showCopy…)
- `10:14:57` **INFO** wrote 1391 chars in 12.5s (attempt 1)
- `10:14:57` **INFO** Running tsc --noEmit on api…
- `10:14:59` **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>,

View File

@ -0,0 +1,47 @@
import React, { useState } from 'react';
import { Check, Copy } from 'lucide-react';
interface CodeBlockProps {
code: string;
language?: string;
showCopyButton?: boolean;
}
export default function CodeBlock({
code,
language,
showCopyButton = true
}: CodeBlockProps) {
const [copied, setCopied] = useState(false);
const handleCopy = async () => {
await navigator.clipboard.writeText(code);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};
return (
<div className="relative group my-4 rounded-lg overflow-hidden border border-zinc-800 bg-zinc-900">
{/* Header */}
<div className="flex items-center justify-between px-4 py-2 bg-zinc-800/50 border-b border-zinc-800 text-zinc-400 text-xs font-mono">
<span>{language ? language.toLowerCase() : 'code'}</span>
{showCopyButton && (
<button
onClick={handleCopy}
className="flex items-center gap-1 hover:text-zinc-100 transition-colors"
>
{copied ? <Check size={14} /> : <Copy size={14} />}
<span>{copied ? 'Copied!' : 'Copy'}</span>
</button>
)}
</div>
{/* Code Area */}
<div className="overflow-x-auto p-4">
<pre className="text-sm text-zinc-100 font-mono leading-relaxed">
<code>{code}</code>
</pre>
</div>
</div>
);
}