link-stack/apps/link/app/(main)/page.tsx

46 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-06-26 10:07:12 +00:00
import { Metadata } from "next";
import { redirect } from "next/navigation";
2024-11-28 08:27:20 +01:00
import { Home } from "./_components/Home";
import { createLogger } from "@link-stack/logger";
const logger = createLogger('link-page');
2024-11-28 08:27:20 +01:00
// import { getServerSession } from "app/_lib/authentication";
// import { Home } from "@link-stack/leafcutter-ui";
// import { getUserVisualizations } from "@link-stack/opensearch-common";
// import { LeafcutterWrapper } from "@link-stack/leafcutter-ui";
2023-06-26 10:07:12 +00:00
export const metadata: Metadata = {
2024-08-07 12:02:33 +02:00
title: "CDR Link - Home",
2023-06-26 10:07:12 +00:00
};
2024-03-20 17:51:21 +01:00
export default async function Page() {
2024-08-07 12:02:33 +02:00
const leafcutterEnabled = process.env.LEAFCUTTER_ENABLED === "true";
2024-11-28 08:27:20 +01:00
const dashboardURL = process.env.LEAFCUTTER_DEFAULT_DASHBOARD_URL;
2024-08-07 12:02:33 +02:00
if (!leafcutterEnabled) {
redirect("/overview/recent");
}
2024-11-28 08:27:20 +01:00
/*
2024-03-20 17:51:21 +01:00
const session = await getServerSession();
const {
user: { email },
}: any = session;
2024-11-28 08:27:20 +01:00
*/
let visualizations = [];
/*
try {
visualizations = await getUserVisualizations(email ?? "none", 20);
} catch (e) {
logger.error({ meta: e.meta }, "Error metadata");
2024-11-28 08:27:20 +01:00
}
2024-08-07 12:02:33 +02:00
2024-03-20 17:51:21 +01:00
return (
<LeafcutterWrapper>
<Home visualizations={visualizations} showWelcome={false} />
</LeafcutterWrapper>
);
2024-11-28 08:27:20 +01:00
*/
return <Home url={dashboardURL} />;
2023-06-26 10:07:12 +00:00
}