* fix: nextjs slow compile time * fix: change optimized package imports and transpile packages * fix: format issue
37 lines
871 B
TypeScript
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>
|
|
);
|
|
}
|