@@ -2,6 +2,7 @@ import Link from "next/link";
22import { ExternalLink } from "lucide-react" ;
33import { Invoice } from "@/ee/features/lighthouse/types" ;
44import { SettingsCard , SettingsCardGroup } from "../components/settingsCard" ;
5+ import { Badge } from "@/components/ui/badge" ;
56import { Button } from "@/components/ui/button" ;
67
78interface RecentInvoicesCardProps {
@@ -26,13 +27,21 @@ export function RecentInvoicesCard({ invoices }: RecentInvoicesCardProps) {
2627}
2728
2829function InvoiceRow ( { invoice } : { invoice : Invoice } ) {
30+ const statusBadge = getStatusBadge ( invoice . status ) ;
2931 return (
3032 < SettingsCard >
3133 < div className = "flex items-center gap-6" >
3234 < p className = "text-sm w-32 shrink-0 font-medium" > { formatDate ( invoice . createdAt ) } </ p >
33- < p className = "text-sm text-muted-foreground flex-1" >
34- { formatCurrency ( invoice . amount , invoice . currency ) }
35- </ p >
35+ < div className = "flex items-center gap-2 flex-1" >
36+ < p className = "text-sm text-muted-foreground" >
37+ { formatCurrency ( invoice . amount , invoice . currency ) }
38+ </ p >
39+ { statusBadge && (
40+ < Badge variant = "outline" className = { statusBadge . className } >
41+ { statusBadge . label }
42+ </ Badge >
43+ ) }
44+ </ div >
3645 { invoice . hostedInvoiceUrl && (
3746 < Button variant = "ghost" asChild >
3847 < Link
@@ -50,6 +59,20 @@ function InvoiceRow({ invoice }: { invoice: Invoice }) {
5059 ) ;
5160}
5261
62+ // Maps Stripe invoice statuses to display badges. See:
63+ // https://docs.stripe.com/invoicing/overview#invoice-statuses
64+ const STATUS_BADGES : Record < string , { label : string ; className : string } > = {
65+ draft : { label : 'Draft' , className : 'border-muted-foreground/30 text-muted-foreground' } ,
66+ open : { label : 'Open' , className : 'border-primary/30 text-primary' } ,
67+ paid : { label : 'Paid' , className : 'border-primary/30 text-primary' } ,
68+ uncollectible : { label : 'Uncollectible' , className : 'border-destructive/30 text-destructive' } ,
69+ void : { label : 'Void' , className : 'border-muted-foreground/30 text-muted-foreground' } ,
70+ } ;
71+
72+ function getStatusBadge ( status : string ) : { label : string ; className : string } | null {
73+ return STATUS_BADGES [ status ] ?? null ;
74+ }
75+
5376function formatDate ( isoDate : string ) : string {
5477 return new Date ( isoDate ) . toLocaleDateString ( 'en-US' , {
5578 month : 'short' ,
0 commit comments