"use client"; import { useState, useTransition } from "react"; import { usePathname } from "next/navigation"; import { Bug } from "lucide-react"; import { AdminDialog } from "@/components/ui/admin-dialog"; import { reportIssue } from "./report-issue-actions"; const PRIORITIES = [ "P0 — Critical (broken / blocking)", "P1 — High", "P2 — Medium", "P3 — Low", ] as const; export function ReportIssueButton() { const pathname = usePathname(); const [open, setOpen] = useState(false); const [pending, startTransition] = useTransition(); const [error, setError] = useState(null); const [filedIssue, setFiledIssue] = useState<{ number: number; url: string } | null>(null); function close() { setOpen(false); setError(null); setFiledIssue(null); } function onSubmit(e: React.FormEvent) { e.preventDefault(); setError(null); const formData = new FormData(e.currentTarget); formData.set("page", pathname); startTransition(async () => { const result = await reportIssue(formData); if ("error" in result) { setError(result.error); } else { setFiledIssue({ number: result.issueNumber, url: result.issueUrl }); } }); } return ( <> {filedIssue ? (

Thanks — issue #{filedIssue.number} has been filed and queued for an automated fix. You'll see the change in an upcoming release.

) : (