"use client"; import { useRouter } from "next/navigation"; import { useState } from "react"; type InvoiceStatusLookupProps = { initialValue?: string; compact?: boolean; }; export default function InvoiceStatusLookup({ initialValue = "", compact = false, }: InvoiceStatusLookupProps) { const router = useRouter(); const [invoiceId, setInvoiceId] = useState(initialValue); const [error, setError] = useState(null); const handleSubmit = (event: React.FormEvent) => { event.preventDefault(); const trimmed = invoiceId.trim(); if (!trimmed) { setError("Enter an invoice id to continue."); return; } setError(null); router.push(`/invoice/${trimmed}`); }; return (
setInvoiceId(event.target.value)} placeholder="e.g. 9d2f2b3c-8a77-4c2b-b9d4-..." autoComplete="off" spellCheck={false} required />
{compact ? null : (

Read-only status view. Refresh the page to see new detections.

)} {error ? (

{error}

) : null}
); }