diff --git a/components/bounty/WrapResultsPage.tsx b/components/bounty/WrapResultsPage.tsx new file mode 100644 index 000000000..39868549a --- /dev/null +++ b/components/bounty/WrapResultsPage.tsx @@ -0,0 +1,113 @@ + +"use client"; +import { useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Trophy, Archive, Megaphone, ExternalLink } from "lucide-react"; +import { Textarea } from "@/components/ui/textarea"; + +interface Winner { rank: number; participantName: string; tierAmount: number; payoutTx?: string; } +interface WrapResultsPageProps { + bountyId: string; + bountyTitle: string; + winners: Winner[]; + isArchived: boolean; + onPublishAnnouncement: (message: string, winnerIds: string[]) => Promise; + onArchive: () => Promise; + onRestore: () => Promise; +} + +export function WrapResultsPage({ + bountyId, bountyTitle, winners, isArchived, onPublishAnnouncement, onArchive, onRestore +}: WrapResultsPageProps) { + const [announcement, setAnnouncement] = useState(""); + const [publishing, setPublishing] = useState(false); + const [announced, setAnnounced] = useState(false); + const [archiving, setArchiving] = useState(false); + + const handlePublish = async () => { + setPublishing(true); + try { + await onPublishAnnouncement(announcement, winners.map((_, i) => String(i))); + setAnnounced(true); + } finally { + setPublishing(false); + } + }; + + const rankLabel = (r: number) => r === 1 ? "1st" : r === 2 ? "2nd" : r === 3 ? "3rd" : ; + + return ( +
+ + + + + Results — {bountyTitle} + + Final winners and payouts + + + {winners.length === 0 ? ( +

No winners selected.

+ ) : winners.map((w, i) => ( +
+
+ {rankLabel(w.rank)} + {w.participantName} +
+
+ {w.tierAmount} USDC + {w.payoutTx && ( + + + + )} +
+
+ ))} +
+
+ + {!announced && ( + + + + Publish Announcement + + + +