Files
supabase/apps/studio/components/interfaces/Billing/Payment/PaymentMethods/StripePaymentConnection.tsx
Joshen Lim 09a1f431bc Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## Context

This is largely just a mechanical change here:
Opting to use lucide icons with the `Icon` suffix across all icon
imports within `studio`
- so that it’s clearer which components are icons + reduces the
possibility of name collision with our own components
- e.g <User /> vs <UserIcon />

Also added a eslint rule for this:
<img width="1069" height="167" alt="image"
src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc"
/>

And updated `AGENTS.md` as such:
```
Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced).
```
2026-10-14 12:56:55 +02:00

90 lines
2.9 KiB
TypeScript

import { ExternalLinkIcon } from 'lucide-react'
import { Button } from 'ui'
import { Admonition } from 'ui-patterns/Admonition'
import PartnerIcon from '@/components/ui/PartnerIcon'
import { MANAGED_BY } from '@/lib/constants/infrastructure'
export type StripeTokenStatus = 'connected' | 'attention' | 'unknown'
export const STRIPE_DASHBOARD_URL = 'https://dashboard.stripe.com'
export const STRIPE_PROJECTS_DOCS_URL = 'https://docs.stripe.com/projects'
interface StripePaymentConnectionProps {
status?: StripeTokenStatus
tokenLast4?: string | null
tokenExpiresAt?: number | null
}
const formatStripeTokenExpiry = (expiresAt?: number | null) => {
if (!expiresAt) return undefined
return new Date(expiresAt * 1000).toLocaleDateString('en-US', { month: 'short', year: 'numeric' })
}
export function StripePaymentConnection({
status = 'connected',
tokenLast4,
tokenExpiresAt,
}: StripePaymentConnectionProps) {
const tokenExpiry = formatStripeTokenExpiry(tokenExpiresAt)
const hasTokenSummary =
tokenLast4 !== null && tokenLast4 !== undefined && tokenExpiry !== undefined
if (status === 'attention') {
return (
<Admonition
type="warning"
title="Stripe payment connection needs attention"
description="The payment token linked to this organisation may be invalid or expired. To keep billing active, review and update it in your Stripe Dashboard."
actions={
<Button asChild variant="warning" iconRight={<ExternalLinkIcon size={14} />}>
<a href={STRIPE_DASHBOARD_URL} target="_blank" rel="noopener noreferrer">
Review in Stripe Dashboard
</a>
</Button>
}
/>
)
}
if (status === 'unknown') {
return (
<Admonition
type="default"
title="Stripe payment setup in progress"
description="Your Stripe payment connection is being configured. Check back shortly."
/>
)
}
return (
<div className="flex flex-col items-center gap-y-3 py-4 text-center">
<PartnerIcon
organization={{ managed_by: MANAGED_BY.STRIPE_PROJECTS }}
showTooltip={false}
size="large"
/>
<div className="space-y-1">
<p className="text-sm text-foreground">Payment managed through Stripe</p>
<p className="text-sm text-foreground-light max-w-sm text-balance">
Billing for this organisation is handled via a connected Stripe payment token.
</p>
{hasTokenSummary && (
<p className="text-xs text-foreground-light">
Token ending in {tokenLast4} expires {tokenExpiry}.
</p>
)}
</div>
<Button asChild iconRight={<ExternalLinkIcon size={14} />}>
<a
href={`${STRIPE_PROJECTS_DOCS_URL}#manage-billing`}
target="_blank"
rel="noopener noreferrer"
>
Manage via Stripe CLI
</a>
</Button>
</div>
)
}