2026-08-17 13:49:55 +02:00
|
|
|
import type { Group } from "@/lib/config/schema";
|
2026-08-17 14:01:53 +02:00
|
|
|
import { widgetId } from "@/lib/config/widgets";
|
2026-08-17 13:49:55 +02:00
|
|
|
import { widgetRegistry } from "@/components/widgets/registry";
|
|
|
|
|
|
2026-08-17 14:01:53 +02:00
|
|
|
export function GroupSection({ group, groupIndex }: { group: Group; groupIndex: number }) {
|
2026-08-17 13:49:55 +02:00
|
|
|
return (
|
|
|
|
|
<section className="flex flex-col gap-3">
|
|
|
|
|
<h2 className="text-xs font-semibold tracking-wide text-fg-muted uppercase">
|
|
|
|
|
{group.name}
|
|
|
|
|
</h2>
|
|
|
|
|
<div className="grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-3">
|
|
|
|
|
{group.widgets.map((widget, index) => {
|
|
|
|
|
const Component = widgetRegistry[widget.type];
|
2026-08-17 14:01:53 +02:00
|
|
|
const id = widgetId(groupIndex, index);
|
|
|
|
|
return <Component key={id} widget={widget as never} widgetId={id} />;
|
2026-08-17 13:49:55 +02:00
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|