# Phase 3: New Widget Components **Status:** ✅ Complete **Parent plan:** [PLAN.md](./PLAN.md) **Domain:** frontend ## Objective Build all 8 new widget UI components with polished design, integrate them into the existing WidgetRenderer and WidgetCreationForm, and ensure they work with the drag-and-drop system. ## Tasks ### 3.1 Clock/Weather Widget - [x] Create `src/lib/components/widget/ClockWeatherWidget.svelte` - Digital clock: large time display with configurable timezone, date below - Analog clock: SVG clock face with hour/minute/second hands, smooth animation via $effect - Weather section (optional): current temp, condition icon (Lucide), location label - Fetches weather from `/api/widgets/weather` on mount + interval - Config-driven: clockStyle (analog|digital), showWeather, timezone ### 3.2 System Stats Widget - [x] Create `src/lib/components/widget/SystemStatsWidget.svelte` - Donut/gauge charts for each metric (CPU, RAM, disk) using SVG - Threshold coloring: green (<60%), yellow (60-85%), red (>85%) via CSS classes - Auto-refresh at configurable interval - Fetches from `/api/widgets/system-stats` - Compact layout: metrics side-by-side with labels below ### 3.3 RSS/Feed Widget - [x] Create `src/lib/components/widget/RssFeedWidget.svelte` - List of feed items: title + relative date - Expandable summary on click (slide transition) - Link icon to open in new tab - Fetches from `/api/widgets/rss` - Loading skeleton while fetching - Empty state when feed has no items ### 3.4 Calendar Widget - [x] Create `src/lib/components/widget/CalendarWidget.svelte` - Compact event list grouped by day (Today, Tomorrow, then dates) - Color dot per calendar source - Time range display (or "All day") - Location shown if available - Fetches from `/api/widgets/calendar` - Empty state: "No upcoming events" ### 3.5 Markdown Widget - [x] Create `src/lib/components/widget/MarkdownWidget.svelte` - Rendered markdown view (default) using `marked` + `isomorphic-dompurify` - Edit mode: split-pane with textarea left, preview right - Syntax highlighting for code blocks (use existing `marked` setup or add `highlight.js`) - Toggle edit/view mode button - Save updates config via API - Proper typography styling for headers, lists, code, blockquotes ### 3.6 Metric/Counter Widget - [x] Create `src/lib/components/widget/MetricWidget.svelte` - Large centered number with unit suffix - Label below the number - Trend arrow: up (green), down (red), flat (gray) — SVG arrow icon - Auto-refresh at interval - Fetches from `/api/widgets/metric` - Number formatting (locale-aware, abbreviate large numbers) ### 3.7 Link Group Widget - [x] Create `src/lib/components/widget/LinkGroupWidget.svelte` - Compact vertical list of links with optional icons - Each link: icon (Lucide or none) + label, opens in new tab - Collapsible header if config.collapsible is true (slide transition) - Hover highlight on each link row - No external data fetching — config-driven only ### 3.8 Camera/Stream Widget - [x] Create `src/lib/components/widget/CameraStreamWidget.svelte` - Snapshot mode: `` tag refreshed at interval via `/api/widgets/camera` - MJPEG mode: direct `` (continuous stream) - HLS mode: `