2023-06-26 10:07:12 +00:00
|
|
|
import { Metadata } from "next";
|
2024-08-05 23:31:15 +02:00
|
|
|
import { redirect } from "next/navigation";
|
2024-11-28 08:27:20 +01:00
|
|
|
import { Home } from "./_components/Home";
|
2025-08-20 11:37:39 +02:00
|
|
|
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) {
|
2025-08-20 11:37:39 +02:00
|
|
|
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
|
|
|
}
|