Files
homarr/apps/nextjs/src/app/[locale]/widgets/[kind]/page.tsx
Meier Lukas b78d32b81c fix: nextjs is slow dev server (#364)
* fix: nextjs slow compile time

* fix: change optimized package imports and transpile packages

* fix: format issue
2024-04-25 22:06:15 +02:00

37 lines
871 B
TypeScript

import { notFound } from "next/navigation";
import { Center } from "@mantine/core";
import { db } from "@homarr/db";
import type { WidgetKind } from "@homarr/definitions";
import { widgetImports } from "@homarr/widgets";
import { env } from "~/env.mjs";
import { WidgetPreviewPageContent } from "./_content";
interface Props {
params: { kind: string };
}
export default async function WidgetPreview(props: Props) {
if (!(props.params.kind in widgetImports || env.NODE_ENV !== "development")) {
notFound();
}
const integrationData = await db.query.integrations.findMany({
columns: {
id: true,
name: true,
url: true,
kind: true,
},
});
const sort = props.params.kind as WidgetKind;
return (
<Center h="100vh">
<WidgetPreviewPageContent kind={sort} integrationData={integrationData} />
</Center>
);
}