import { Metadata } from "next"; import Link from "next/link"; import { getArtifacts } from "@utils"; import styles from "./page.module.css"; export const metadata: Metadata = { title: "ryan christoffersen | artifacts", }; async function getArtifactsByGroup() { return [ { group: "essays", items: getArtifacts("essays").sort((a, b) => b.order - a.order), }, { group: "film / video", items: [...getArtifacts("film"), ...getArtifacts("videos")].sort( (a, b) => b.order - a.order, ), }, { group: "software", items: getArtifacts("software").sort((a, b) => b.order - a.order), }, ]; } const ArtifactsPage = async () => { const artifacts = await getArtifactsByGroup(); return (
{!artifacts.length ? (

{"failed to load artifacts"}

) : (
{artifacts.map(({ group, items }) => (

{group}

    {items.map( ({ id, category, title, description, created, updated, }) => (
  • {title}

    {description}

    {`created: ${created.toDateString()}`} {" | "} {`updated: ${updated.toDateString()}`}

  • ), )}
))}
)}
); }; export default ArtifactsPage;