63ec93bd35
- widget-registry.tsx: extend WidgetType union with calculator/favorites/link/stopwatch - widget-registry.tsx: add WIDGET_CONSTRAINTS entries with per-widget grid constraints (DASH-11) - widget-registry.tsx: add SVG icons (CalculatorIcon, FavoritesIcon, LinkIcon, StopwatchIcon) - widget-registry.tsx: add WIDGET_REGISTRY entries and wire functions for all 4 new types - calculator-widget.tsx: full arithmetic implementation ported from personal-dashboard (parseDisplay, formatNumber, calculate, keyboard handler with stopPropagation) - widget-catalog-modal.tsx: extend WIDGET_TYPES to include all 8 types - create-widget.dto.ts: extend @IsIn to accept 8 widget types (T-08-01 mitigated) - page.tsx: import CalculatorWidget and call wireCalculatorWidget() - de.json / en.json: add i18n keys for calculator, favorites, link, stopwatch - All 16 tests passing (GREEN)
17 lines
490 B
TypeScript
17 lines
490 B
TypeScript
import { IsIn, IsObject, IsOptional, IsString } from 'class-validator';
|
|
|
|
/**
|
|
* DTO for creating a new widget instance on a user's dashboard.
|
|
* widgetType must be one of the four supported types.
|
|
* config is optional and defaults to {} on the model.
|
|
*/
|
|
export class CreateWidgetDto {
|
|
@IsString()
|
|
@IsIn(['clock', 'search', 'calendar', 'note', 'calculator', 'favorites', 'link', 'stopwatch'])
|
|
widgetType!: string;
|
|
|
|
@IsOptional()
|
|
@IsObject()
|
|
config?: Record<string, unknown>;
|
|
}
|