'use client'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import Image from 'next/image'; import Header from '@/components/Header'; import { getAwards, Award } from '@/lib/api'; export default function AwardsPage() { const [awards, setAwards] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { async function fetchAwards() { try { const data = await getAwards(); setAwards(data); } catch (err) { setError('Failed to load awards'); console.error(err); } finally { setLoading(false); } } fetchAwards(); }, []); const breadcrumbs = [ { label: 'Home', href: '/' }, { label: 'Awards for Heroism and Gallantry' } ]; // Helper to get image extension const getImagePath = (filename: string) => { // Check for common extensions in public folder const extensions = ['.jpg', '.png', '.jpeg', '.gif']; for (const ext of extensions) { // The filename in the DB might already include extension or not if (filename.toLowerCase().endsWith(ext)) { return `/${filename}`; } } // Default to .jpg if no extension return `/${filename}.jpg`; }; return (
{/* Title Section */}

Awards for Heroism and Gallantry

Those Alumni who “Gave All” on this memorial website who were also recognized for valor and heroism in combat are listed on this page with a link to their profile. These awards honor extraordinary acts of bravery and selfless service in defense of our country.

{/* Awards Grid */}

Military Decorations

{loading && (

Loading awards...

)} {error && (

{error}

)} {!loading && !error && awards.length === 0 && (

No awards found. Please add some through the admin panel.

)} {!loading && !error && awards.length > 0 && (
{awards.map((award) => (
{/* Award Image */}
{award.name}
{/* Award Info */}

{award.name}

{award.short_description}

{award.recipient_count} VMI {award.recipient_count === 1 ? 'Recipient' : 'Recipients'}

))}
)}
); }