feat(number-input-component): NumberInput mit Stepper-Buttons [tsc:fail]
This commit is contained in:
parent
f2e28b7b7d
commit
63c191b6f8
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"completed_features": [],
|
"completed_features": [],
|
||||||
"current_feature": "time-input-component",
|
"current_feature": "number-input-component",
|
||||||
"started_at": "2026-05-23T10:33:26.504299",
|
"started_at": "2026-05-23T10:33:26.504299",
|
||||||
"attempted_features": [
|
"attempted_features": [
|
||||||
"date-input-component"
|
"date-input-component",
|
||||||
|
"time-input-component"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -4466,3 +4466,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:33:52` **INFO** Committed feature time-input-component
|
||||||
|
- `10:33:53` **INFO** Pushed: rc=0
|
||||||
|
|
||||||
|
## Phase-3 Feature: number-input-component (2026-05-23 10:33:53)
|
||||||
|
|
||||||
|
- `10:33:53` **INFO** Description: NumberInput mit Stepper-Buttons
|
||||||
|
- `10:33:53` **INFO** Generating apps/web/src/components/NumberInput.tsx (NumberInput-Component. Props: value (number), onChange(n), min?, max?,…)
|
||||||
|
- `10:34:13` **INFO** wrote 2705 chars in 19.9s (attempt 1)
|
||||||
|
- `10:34:13` **INFO** Running tsc --noEmit on api…
|
||||||
|
- `10:34:14` **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>,
|
||||||
|
|||||||
86
apps/web/src/components/NumberInput.tsx
Normal file
86
apps/web/src/components/NumberInput.tsx
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
interface NumberInputProps {
|
||||||
|
value: number;
|
||||||
|
onChange: (value: number) => void;
|
||||||
|
min?: number;
|
||||||
|
max?: number;
|
||||||
|
step?: number;
|
||||||
|
unit?: string;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const NumberInput: React.FC<NumberInputProps> = ({
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
min,
|
||||||
|
max,
|
||||||
|
step = 1,
|
||||||
|
unit,
|
||||||
|
className = '',
|
||||||
|
}) => {
|
||||||
|
const handleDecrement = () => {
|
||||||
|
const newValue = value - step;
|
||||||
|
if (min !== undefined && newValue < min) return;
|
||||||
|
onChange(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleIncrement = () => {
|
||||||
|
const newValue = value + step;
|
||||||
|
if (max !== undefined && newValue > max) return;
|
||||||
|
onChange(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const val = parseFloat(e.target.value);
|
||||||
|
if (isNaN(val)) return;
|
||||||
|
|
||||||
|
let clampedValue = val;
|
||||||
|
if (min !== undefined && val < min) clampedValue = min;
|
||||||
|
if (max !== undefined && val > max) clampedValue = max;
|
||||||
|
|
||||||
|
onChange(clampedValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`flex items-center gap-2 ${className}`}>
|
||||||
|
<div className="flex items-center border border-slate-300 rounded-md overflow-hidden bg-white dark:bg-slate-900 dark:border-slate-700">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleDecrement}
|
||||||
|
disabled={min !== undefined && value <= min}
|
||||||
|
className="px-3 py-2 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 disabled:opacity-50 disabled:cursor-not-allowed border-r border-slate-300 dark:border-slate-700 transition-colors"
|
||||||
|
>
|
||||||
|
<span className="text-lg font-bold leading-none">−</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
value={value}
|
||||||
|
onChange={handleInputChange}
|
||||||
|
min={min}
|
||||||
|
max={max}
|
||||||
|
step={step}
|
||||||
|
className="w-16 text-center py-2 bg-transparent outline-none dark:text-white [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleIncrement}
|
||||||
|
disabled={max !== undefined && value >= max}
|
||||||
|
className="px-3 py-2 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 disabled:opacity-50 disabled:cursor-not-allowed border-l border-slate-300 dark:border-slate-700 transition-colors"
|
||||||
|
>
|
||||||
|
<span className="text-lg font-bold leading-none">+</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{unit && (
|
||||||
|
<span className="text-sm text-slate-500 dark:text-slate-400 font-medium min-w-[1.5rem]">
|
||||||
|
{unit}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default NumberInput;
|
||||||
Loading…
Reference in New Issue
Block a user