Files
supabase/apps/studio/components/interfaces/DiskManagement/DiskManagementReviewAndSubmitDialog/DiskManagementReviewAndSubmitDialog.components.tsx
Joshen Lim 6d08d66b7d Add eslint rule for google translate dynamic spans + address all issues (#52949)
## Context

We've been seeing many `NotFoundError: Failed to execute 'removeChild'
on 'Node'` and `NotFoundError: Failed to execute 'insertBefore' on
'Node'` events on Sentry which are historically known to be caused by
Google Translate in the browser.

There's technically no _right way_ to address this unfortunately, but
one of the solutions which should address most of these issues is to
wrap any dynamic text within a span - we've considered that quite a
while back tbh but never took the time to do this until today with the
help of Claude. Although just a heads up that it might not necessarily
completely eradicate those issues.

Also added an eslint rule which should prevent future occurences of this
<img width="1264" height="192" alt="image"
src="https://github.com/user-attachments/assets/b2c32ea0-45a2-4ccd-82fe-1a859905fc29"
/>
2026-11-05 23:28:46 +08:00

39 lines
1.3 KiB
TypeScript

import { cn } from 'ui'
import { formatCurrency } from '@/lib/helpers'
export interface BreakdownRowProps {
label: string
description?: string
children: React.ReactNode
}
export const BreakdownRow = ({ label, description, children }: BreakdownRowProps) => (
<div className="flex items-start justify-between py-3 px-0 border-b border-dashed last:border-b-0">
<div className="flex flex-col gap-0.5">
<span className="text-sm text-foreground-light">{label}</span>
{description && <span className="text-xs text-warning-600 max-w-72">{description}</span>}
</div>
{children}
</div>
)
export const ValueChange = ({ from, to }: { from: string; to: string }) => (
<span className="text-sm font-mono uppercase">
<span className="text-foreground-lighter">{from}</span>
<span className="text-foreground-lighter mx-2">&rarr;</span>
<span className="text-foreground">{to}</span>
</span>
)
export const PriceDelta = ({ delta }: { delta: number }) => (
<span className={cn('text-xs', delta >= 0 ? 'text-primary' : 'text-destructive')}>
{delta >= 0 ? (
<span>{`+${formatCurrency(delta)}`}</span>
) : (
<span>{`-${formatCurrency(Math.abs(delta))}`}</span>
)}{' '}
<span className="text-foreground-lighter">per month</span>
</span>
)