'use client'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import { getConflicts, Conflict } from '@/lib/api'; import Image from 'next/image'; export default function Home() { const [conflicts, setConflicts] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { async function fetchConflicts() { try { const data = await getConflicts(); setConflicts(data); } catch (err) { setError('Failed to load conflicts'); console.error(err); } finally { setLoading(false); } } fetchConflicts(); }, []); return (
{/* Header */}
{/* VMI Seal placeholder - replace with actual image */}
VMI
Virginia Military Institute
Lexington, Virginia
{/* Navigation */}
{/* Main Content */}
{/* Title */}

VMI Virtual Memorial

{/* Welcome Card */}

Since 1839, the Virginia Military Institute has produced leaders of character who have served their country in peace and at war. From the Mexican War to the War on Terrorism, VMI cadets and alumni have answered the call to service.

This virtual memorial lists the names of VMI Alumni who died on the Field of Honor. Their class year is shown with their names. Links for those highlighted provide more information on their story and how they "Gave All."

{/* Placeholder for statue image */}
VMI Memorial Statue - Virginia Mourning Her Dead

"In Pace Paratus"

Prepared in Peace

{/* Conflicts List */}

Browse by Conflict

{loading && (

Loading conflicts...

)} {error && (

{error}

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

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

)} {!loading && !error && conflicts.length > 0 && (
    {conflicts.map((conflict) => (
  • {conflict.name}

    {conflict.start_year === conflict.end_year ? conflict.start_year : `${conflict.start_year} – ${conflict.end_year || 'Present'}`}

    {conflict.casualty_count}

    Casualties

  • ))}
)}
); }