import config from "@payload-config"; import { getPayload } from "payload"; import type { Award, Media } from "@/payload-types"; import { AwardWithGrantButton } from "@/components/frontend/account/AwardWithGrantButton"; import { Item, ItemContent, ItemHeader, ItemTitle } from "@/components/ui/item"; import { MedalIcon } from "lucide-react"; export const metadata = { title: "Awards", description: "Browse every medal and ribbon that can be granted to a member of Polaris Task Force.", }; const TYPE_LABEL: Record<"ribbon" | "medal", string> = { ribbon: "Ribbons", medal: "Medals", }; export default async function AwardsPage() { const payload = await getPayload({ config }); const res = await payload.find({ collection: "awards", where: { type: { in: ["ribbon", "medal"] }, }, sort: "name", limit: 100, depth: 1, overrideAccess: true, }); const awards: Award[] = res.docs; const ribbons = awards.filter((a) => a.type === "ribbon"); const medals = awards.filter((a) => a.type === "medal"); const sections: { title: string; items: Award[] }[] = []; if (medals.length > 0) sections.push({ title: TYPE_LABEL.medal, items: medals }); if (ribbons.length > 0) sections.push({ title: TYPE_LABEL.ribbon, items: ribbons }); return (

Awards

A reference of every medal and ribbon that can be earned by a member of Polaris Task Force. Review the requirements for each award and its artwork. Commendations are granted on the fly and are not catalogued here.

{awards.length === 0 ? ( No awards defined

No medals or ribbons have been catalogued yet. Check back soon.

) : ( sections.map((section) => (

{section.title}

{section.items.map((award) => { const awardImage = typeof award.image === "object" && award.image ? (award.image as Media) : null; return ( ); })}
)) )}
); }