'use client';

/**
 * TrackingEntryFormIsland
 *
 * Thin Astro-island wrapper around TrackingEntryForm.
 * On successful tracking submission, reloads the page so the return detail
 * page reflects the updated status.
 * Required because Astro cannot pass function props to React islands from
 * frontmatter — the callback lives here in client JS.
 */

import { TrackingEntryForm } from './TrackingEntryForm';

interface TrackingEntryFormIslandProps {
  returnId: string;
}

export function TrackingEntryFormIsland({ returnId }: TrackingEntryFormIslandProps) {
  return (
    <TrackingEntryForm
      returnId={returnId}
      onSuccess={() => {
        location.reload();
      }}
    />
  );
}
