import { GetStaticProps, NextPage } from "next"; import { NextSeo } from "next-seo"; import Link from "next/link"; import { Link as LinkType } from "@prisma/client"; import useUser from "@utils/hooks/useUser"; import prisma from "@utils/prisma"; import EmptyPage from "@components/EmptyPage"; import Layout from "@components/Layout"; import LinkComponent from "@components/LinkComponent"; const LinksPage: NextPage<{ links: LinkType[] }> = ({ links }) => { const user = useUser(); return (

Links

This is a collection of quick usefull links
{user !== null && (
new
)}
{links.length < 1 &&

No links yet

} {links.map((link) => ( ))}
); }; export const getStaticProps: GetStaticProps = async () => { const links = await prisma.link .findMany({ orderBy: { id: "desc" }, take: 5 }) .catch(() => []); return { props: { links }, revalidate: 1 * 60 }; }; export default LinksPage;