import { getServerSession } from "next-auth";
import { authOptions } from "app/_lib/auth";
import { getUserVisualizations } from "app/_lib/opensearch";
import { Home } from "@link-stack/leafcutter-ui";

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

  return <Home visualizations={visualizations} />;
}
