Add stopwatch to API widget type validation and defaults

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 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-06-20 12:03:35 +02:00
parent 04d14b3aea
commit b82e0e68c5
+8 -2
View File
@@ -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<WidgetType, WidgetDefaults> = {
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;
}