From b82e0e68c5c5d720164a236a1707c6b65038e929 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 20 Jun 2026 12:03:35 +0200 Subject: [PATCH] Add stopwatch to API widget type validation and defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API has its own WidgetType and normalizeWidgetType that were not updated when the stopwatch widget was added, causing 'Widget-Typ ist ungültig' on creation. Co-Authored-By: Claude Sonnet 4.6 --- src/app/api/widgets/route.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/api/widgets/route.ts b/src/app/api/widgets/route.ts index f08ff5a..b220c62 100644 --- a/src/app/api/widgets/route.ts +++ b/src/app/api/widgets/route.ts @@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from "next/server"; import { requireCurrentUser, UnauthorizedError } from "@/lib/auth"; import { prisma } from "@/lib/prisma"; -type WidgetType = "favorites" | "note" | "search" | "calendar" | "calculator" | "clock" | "domain-check"; +type WidgetType = "favorites" | "note" | "search" | "calendar" | "calculator" | "clock" | "domain-check" | "stopwatch"; type ExistingWidgetBox = { x: number; @@ -54,6 +54,11 @@ const widgetCatalog: Record = { title: "Domainprüfung", w: 16, h: 12 + }, + stopwatch: { + title: "Stoppuhr", + w: 12, + h: 20 } }; @@ -65,7 +70,8 @@ function normalizeWidgetType(value: unknown): WidgetType | null { value === "calendar" || value === "calculator" || value === "clock" || - value === "domain-check" + value === "domain-check" || + value === "stopwatch" ) { return value; }