---
import { getCollection } from "astro:content";
import Layout from "@layouts/Layout.astro";
import { getLocale } from "astro-i18n-aut";
import { filterCollection } from "@i18n/utils";
import HeroCard from "@components/HeroCard.astro";

const locale = getLocale(Astro.url);
const pages = await getCollection("projects");
const posts = filterCollection(pages, locale)
  .sort((a, b) => (b.data.date > a.data.date ? 1 : -1))
  .sort((a) => (a.data.featured ? -1 : 1));
---

<Layout title="Dude">
  {posts.map((post) => <HeroCard post={post} />)}
</Layout>
