import { Metadata } from "next";
import { getServerSession } from "app/_lib/authentication";
import { Home } from "leafcutter-ui";
import { getUserVisualizations } from "opensearch-common";
import { LeafcutterWrapper } from "leafcutter-ui";

export const metadata: Metadata = {
  title: "Link",
};

export default async function Page() {
  const session = await getServerSession();
  const {
    user: { email },
  }: any = session;
  const visualizations = await getUserVisualizations(email ?? "none", 20);

  return (
    <LeafcutterWrapper>
      <Home visualizations={visualizations} showWelcome={false} />
    </LeafcutterWrapper>
  );
}
