1- import { Link } from '@inertiajs/react'
1+ import { Link , useForm } from '@inertiajs/react'
22import {
33 ArrowLeft ,
44 Hammer ,
@@ -21,6 +21,7 @@ import {
2121 DollarSign ,
2222 TableProperties ,
2323 Activity ,
24+ Coins ,
2425} from 'lucide-react'
2526import type { LucideIcon } from 'lucide-react'
2627import { Card , CardContent } from '@/components/admin/ui/card'
@@ -106,6 +107,12 @@ export default function AdminStaticPagesIndex({
106107 is_superadmin,
107108} : AdminDashboardProps ) {
108109 const can = ( perm : string ) => permissions [ perm ]
110+ const payoutAllForm = useForm ( { } )
111+
112+ function handlePayoutAll ( ) {
113+ if ( ! confirm ( 'Are you sure you want to approve all pending reel payouts? This cannot be undone.' ) ) return
114+ payoutAllForm . post ( '/admin/reel_payouts/payout_all' )
115+ }
109116
110117 return (
111118 < div className = "max-w-6xl mx-auto space-y-8" >
@@ -182,6 +189,27 @@ export default function AdminStaticPagesIndex({
182189 { is_superadmin && (
183190 < Section title = "Superadmin" >
184191 < Tile href = "/admin/airtable_queue" label = "Airtable Queue" icon = { TableProperties } />
192+ < button
193+ type = "button"
194+ onClick = { handlePayoutAll }
195+ disabled = { payoutAllForm . processing }
196+ className = "w-full text-left"
197+ >
198+ < Card className = "hover:bg-accent transition-colors cursor-pointer" >
199+ < CardContent className = "p-4" >
200+ < div className = "flex items-center gap-3" >
201+ < div className = "rounded-md bg-muted p-2 text-foreground inline-flex items-center justify-center" >
202+ < Coins className = "size-5" />
203+ </ div >
204+ < div className = "flex-1 min-w-0" >
205+ < div className = "text-sm font-medium truncate" >
206+ { payoutAllForm . processing ? 'Processing…' : 'Payout All Reels' }
207+ </ div >
208+ </ div >
209+ </ div >
210+ </ CardContent >
211+ </ Card >
212+ </ button >
185213 </ Section >
186214 ) }
187215 </ div >
0 commit comments