Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix mobile fee

Kiran K4eb9948cf138
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/invoices/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/invoices/page-client.tsx
index c6ff4be134..0c26c31b3a 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/invoices/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/billing/invoices/page-client.tsx
@@ -8,7 +8,6 @@ import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";
import {
Button,
buttonVariants,
- InvoiceDollar,
Receipt2,
StatusBadge,
TabSelect,
@@ -113,92 +112,182 @@ const InvoiceCard = ({
PAYMENT_METHODS[invoice.paymentMethod ?? "us_bank_account"];
return (
- <div
- className={cn(
- "grid gap-4 px-6 py-4 sm:px-12",
- displayPaymentMethod ? "grid-cols-4" : "grid-cols-3",
- )}
- >
- <div className="text-sm">
- <div className="font-medium">{invoice.description}</div>
- <div className="text-neutral-500">
- {new Date(invoice.createdAt).toLocaleDateString("en-US", {
- month: "short",
- year: "numeric",
- day: "numeric",
- })}
+ <div className="px-4 py-6 sm:px-12">
+ {/* Mobile layout - button at top right */}
+ <div className="block sm:hidden">
+ <div className="mb-4 flex items-start justify-between">
+ <div className="text-sm">
+ <div className="font-medium">{invoice.description}</div>
+ <div className="text-neutral-500">
+ {new Date(invoice.createdAt).toLocaleDateString("en-US", {
+ month: "short",
+ year: "numeric",
+ day: "numeric",
+ })}
+ </div>
+ </div>
+ <div className="flex items-center">
+ {invoice.pdfUrl ? (
+ <a
+ href={invoice.pdfUrl}
+ target="_blank"
+ className={cn(
+ buttonVariants({ variant: "secondary" }),
+ "flex h-9 items-center justify-center rounded-md border px-3 text-sm",
+ )}
+ >
+ <span>View invoice</span>
+ </a>
+ ) : (
+ <Button
+ className="h-9 px-3"
+ variant="secondary"
+ text="View invoice"
+ disabled
+ disabledTooltip={
+ invoice.failedReason ||
+ "Invoice not available. Contact support if you need assistance."
+ }
+ />
+ )}
+ </div>
+ </div>
+
+ <div className="space-y-4">
+ {/* Total section */}
+ <div className="text-left text-sm">
+ <div className="font-medium">Total</div>
+ <div className="flex items-center gap-1.5 text-neutral-500">
+ <span className="text-sm font-medium">
+ {currencyFormatter(invoice.total / 100)}
+ </span>
+ {invoice.status &&
+ (() => {
+ const badge = PayoutStatusBadges[invoice.status];
+ return (
+ <StatusBadge
+ icon={null}
+ variant={badge.variant}
+ className="rounded-md py-0.5"
+ >
+ {badge.label}
+ </StatusBadge>
+ );
+ })()}
+ </div>
+ </div>
+
+ {/* Payment method section - shown on mobile for partner payouts */}
+ {displayPaymentMethod && (
+ <div className="text-left text-sm">
+ <div className="font-medium">Method</div>
+ {paymentMethod ? (
+ <div className="flex items-center gap-1.5 text-neutral-500">
+ <div className="text-content-subtle text-sm font-medium">
+ {paymentMethod.label}
+ </div>
+ <StatusBadge
+ icon={null}
+ variant="neutral"
+ className="rounded-md py-0.5 text-xs font-semibold text-neutral-700"
+ >
+ {paymentMethod.duration}
+ </StatusBadge>
+ </div>
+ ) : (
+ <span className="text-neutral-500">-</span>
+ )}
+ </div>
+ )}
</div>
</div>
- <div className="text-left text-sm">
- <div className="font-medium">Total</div>
- <div className="flex items-center gap-1.5 text-neutral-500">
- <span className="text-sm">
- {currencyFormatter(invoice.total / 100)}
- </span>
- {invoice.status &&
- (() => {
- const badge = PayoutStatusBadges[invoice.status];
- return (
+ {/* Desktop layout - original grid */}
+ <div className="hidden sm:grid sm:grid-cols-3 sm:gap-4 lg:grid-cols-4">
+ {/* Header section */}
+ <div className="text-sm sm:col-span-1">
+ <div className="font-medium">{invoice.description}</div>
+ <div className="text-neutral-500">
+ {new Date(invoice.createdAt).toLocaleDateString("en-US", {
+ month: "short",
+ year: "numeric",
+ day: "numeric",
+ })}
+ </div>
+ </div>
+
+ {/* Total section */}
+ <div className="text-left text-sm sm:col-span-1">
+ <div className="font-medium">Total</div>
+ <div className="flex items-center gap-1.5 text-neutral-500">
+ <span className="text-sm font-medium">
+ {currencyFormatter(invoice.total / 100)}
+ </span>
+ {invoice.status &&
+ (() => {
+ const badge = PayoutStatusBadges[invoice.status];
+ return (
+ <StatusBadge
+ icon={null}
+ variant={badge.variant}
+ className="rounded-md py-0.5"
+ >
+ {badge.label}
+ </StatusBadge>
+ );
+ })()}
+ </div>
+ </div>
+
+ {/* Payment method section - desktop only for partner payouts */}
+ {displayPaymentMethod && (
+ <div className="text-left text-sm sm:col-span-1 lg:block">
+ <div className="font-medium">Method</div>
+ {paymentMethod ? (
+ <div className="flex items-center gap-1.5 text-neutral-500">
+ <div className="text-content-subtle text-sm font-medium">
+ {paymentMethod.label}
+ </div>
<StatusBadge
icon={null}
- variant={badge.variant}
- className="rounded-md py-0.5"
+ variant="neutral"
+ className="rounded-md py-0.5 text-xs font-semibold text-neutral-700"
>
- {badge.label}
+ {paymentMethod.duration}
</StatusBadge>
- );
- })()}
- </div>
- </div>
-
- {displayPaymentMethod && (
- <div className="text-left text-sm">
- <div className="font-medium">Method</div>
- {paymentMethod ? (
- <div className="flex items-center gap-1.5 text-neutral-500">
- <div className="text-content-subtle text-sm font-medium">
- {paymentMethod.label}
</div>
- <StatusBadge
- icon={null}
- variant="neutral"
- className="rounded-md py-0.5 text-xs font-semibold text-neutral-700"
- >
- {paymentMethod.duration}
- </StatusBadge>
- </div>
+ ) : (
+ <span className="text-neutral-500">-</span>
+ )}
+ </div>
+ )}
+
+ {/* Button section - desktop */}
+ <div className="flex items-center justify-end sm:col-span-1 sm:justify-end">
+ {invoice.pdfUrl ? (
+ <a
+ href={invoice.pdfUrl}
+ target="_blank"
+ className={cn(
+ buttonVariants({ variant: "secondary" }),
+ "flex h-9 items-center justify-center rounded-md border px-3 text-sm",
+ )}
+ >
+ <span>View invoice</span>
+ </a>
) : (
- "-"
+ <Button
+ className="h-9 px-3"
+ variant="secondary"
+ text="View invoice"
+ disabled
+ disabledTooltip={
+ invoice.failedReason ||
+ "Invoice not available. Contact support if you need assistance."
+ }
+ />
)}
</div>
- )}
-
- <div className="flex items-center justify-end">
- {invoice.pdfUrl ? (
- <a
- href={invoice.pdfUrl}
- target="_blank"
- className={cn(
- buttonVariants({ variant: "secondary" }),
- "flex size-8 items-center justify-center rounded-md border text-sm sm:size-auto sm:h-9 sm:px-3",
- )}
- >
- <p className="hidden sm:block">View invoice</p>
- <InvoiceDollar className="size-4 sm:hidden" />
- </a>
- ) : (
- <Button
- className="w-fit"
- variant="secondary"
- text="View invoice"
- disabled
- disabledTooltip={
- invoice.failedReason ||
- "Invoice not available. Contact support if you need assistance."
- }
- />
- )}
</div>
</div>
);
@@ -210,30 +299,54 @@ const InvoiceCardSkeleton = ({
displayPaymentMethod?: boolean;
}) => {
return (
- <div
- className={cn(
- "grid gap-4 px-6 py-4 sm:px-12",
- displayPaymentMethod ? "grid-cols-4" : "grid-cols-3",
- )}
- >
- <div className="flex flex-col gap-1 text-sm">
- <div className="h-4 w-32 animate-pulse rounded-md bg-neutral-200" />
- <div className="h-4 w-24 animate-pulse rounded-md bg-neutral-200" />
- </div>
- <div className="flex flex-col gap-1">
- <div className="h-4 w-16 animate-pulse rounded-md bg-neutral-200" />
- <div className="h-4 w-20 animate-pulse rounded-md bg-neutral-200" />
+ <div className="px-4 py-6 sm:px-12">
+ {/* Mobile skeleton */}
+ <div className="block sm:hidden">
+ <div className="mb-4 flex items-start justify-between">
+ <div className="flex flex-col gap-1 text-sm">
+ <div className="h-4 w-32 animate-pulse rounded-md bg-neutral-200" />
+ <div className="h-4 w-24 animate-pulse rounded-md bg-neutral-200" />
+ </div>
+ <div className="h-9 w-24 animate-pulse rounded-md bg-neutral-200" />
+ </div>
+
+ <div className="space-y-4">
+ <div className="flex flex-col gap-1">
+ <div className="h-4 w-16 animate-pulse rounded-md bg-neutral-200" />
+ <div className="h-4 w-20 animate-pulse rounded-md bg-neutral-200" />
+ </div>
+
+ {displayPaymentMethod && (
+ <div className="flex flex-col gap-1">
+ <div className="h-4 w-12 animate-pulse rounded-md bg-neutral-200" />
+ <div className="h-4 w-20 animate-pulse rounded-md bg-neutral-200" />
+ </div>
+ )}
+ </div>
</div>
- {displayPaymentMethod && (
- <div className="flex flex-col gap-1">
- <div className="h-4 w-12 animate-pulse rounded-md bg-neutral-200" />
+ {/* Desktop skeleton */}
+ <div className="hidden sm:grid sm:grid-cols-3 sm:gap-4 lg:grid-cols-4">
+ <div className="flex flex-col gap-1 text-sm sm:col-span-1">
+ <div className="h-4 w-32 animate-pulse rounded-md bg-neutral-200" />
+ <div className="h-4 w-24 animate-pulse rounded-md bg-neutral-200" />
+ </div>
+
+ <div className="flex flex-col gap-1 sm:col-span-1">
+ <div className="h-4 w-16 animate-pulse rounded-md bg-neutral-200" />
<div className="h-4 w-20 animate-pulse rounded-md bg-neutral-200" />
</div>
- )}
- <div className="flex items-center justify-end">
- <div className="h-8 w-16 animate-pulse rounded-md bg-neutral-200" />
+ {displayPaymentMethod && (
+ <div className="flex flex-col gap-1 sm:col-span-1">
+ <div className="h-4 w-12 animate-pulse rounded-md bg-neutral-200" />
+ <div className="h-4 w-20 animate-pulse rounded-md bg-neutral-200" />
+ </div>
+ )}
+
+ <div className="flex items-center justify-end sm:col-span-1 sm:justify-end">
+ <div className="h-9 w-24 animate-pulse rounded-md bg-neutral-200" />
+ </div>
</div>
</div>
);