import { useEffect, useState } from 'react' import { useParams, useNavigate } from 'react-router-dom' import { ArrowLeft, RefreshCw } from 'lucide-react' import { fetchPendingOrders } from '../api' import OrderCard from '../components/OrderCard' const POLL_MS = 15_000 export default function IncomingOrdersPage() { const { siteId } = useParams() const navigate = useNavigate() const [orders, setOrders] = useState([]) const [loading, setLoading] = useState(true) async function load() { try { const data = await fetchPendingOrders(siteId) setOrders(data) } finally { setLoading(false) } } useEffect(() => { load() const timer = setInterval(load, POLL_MS) return () => clearInterval(timer) }, [siteId]) return (

Incoming Orders

{loading ? (
) : orders.length === 0 ? (

No pending orders

New orders will appear here automatically.

) : ( orders.map(o => ) )}
) }