Files
pulsenode/components/widgets/registry.ts
T

19 lines
612 B
TypeScript
Raw Normal View History

2026-08-17 13:49:55 +02:00
import type { ComponentType } from "react";
import type { Widget } from "@/lib/config/schema";
import { BookmarkWidget } from "./bookmark/Widget";
import { SearchWidget } from "./search/Widget";
import { DockerWidget } from "./docker/Widget";
import { DatabaseWidget } from "./database/Widget";
2026-08-17 13:49:55 +02:00
type WidgetComponent<T extends Widget["type"]> = ComponentType<{
widget: Extract<Widget, { type: T }>;
widgetId: string;
2026-08-17 13:49:55 +02:00
}>;
export const widgetRegistry: { [K in Widget["type"]]: WidgetComponent<K> } = {
bookmark: BookmarkWidget,
search: SearchWidget,
docker: DockerWidget,
database: DatabaseWidget,
2026-08-17 13:49:55 +02:00
};