mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-07 01:56:53 +00:00
fix(web): prevent list cell text and badge overflow (#5510)
* fix(ui): prevent table cell text overflow - add default truncation with hover details for text cells in shared and static data tables to prevent content from spilling into adjacent columns. - adjust API key group, model, and IP restriction columns to fix badge overlap and left alignment drift. - reuse a shared truncated cell component and add width constraints for composite badge cells. * fix(table): prevent badge content from overflowing columns - make table text and badge cells shrink within constrained columns so long values truncate instead of bleeding into adjacent cells. - add a shared BadgeCell wrapper to keep badge alignment consistent across API keys and other list pages. - update affected list views to use constrained wrappers for group, provider, pricing, OAuth, and API info values.
This commit is contained in:
+9
-4
@@ -20,6 +20,7 @@ import { useMemo } from 'react'
|
||||
import { type ColumnDef } from '@tanstack/react-table'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { formatQuota } from '@/lib/format'
|
||||
import { BadgeCell } from '@/components/data-table'
|
||||
import { GroupBadge } from '@/components/group-badge'
|
||||
import { StatusBadge } from '@/components/status-badge'
|
||||
import { TableId } from '@/components/table-id'
|
||||
@@ -48,7 +49,7 @@ export function useSubscriptionsColumns(): ColumnDef<PlanRecord>[] {
|
||||
cell: ({ row }) => {
|
||||
const plan = row.original.plan
|
||||
return (
|
||||
<div className='max-w-[200px]'>
|
||||
<div className='max-w-full min-w-0'>
|
||||
<div className='truncate font-medium'>{plan.title}</div>
|
||||
{plan.subtitle && (
|
||||
<div className='text-muted-foreground truncate text-xs'>
|
||||
@@ -134,7 +135,7 @@ export function useSubscriptionsColumns(): ColumnDef<PlanRecord>[] {
|
||||
cell: ({ row }) => {
|
||||
const plan = row.original.plan
|
||||
return (
|
||||
<div className='flex gap-1'>
|
||||
<BadgeCell>
|
||||
{plan.stripe_price_id && (
|
||||
<StatusBadge
|
||||
label='Stripe'
|
||||
@@ -152,7 +153,7 @@ export function useSubscriptionsColumns(): ColumnDef<PlanRecord>[] {
|
||||
copyable={false}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</BadgeCell>
|
||||
)
|
||||
},
|
||||
size: 140,
|
||||
@@ -182,7 +183,11 @@ export function useSubscriptionsColumns(): ColumnDef<PlanRecord>[] {
|
||||
<span className='text-muted-foreground'>{t('No Upgrade')}</span>
|
||||
)
|
||||
}
|
||||
return <GroupBadge group={group} />
|
||||
return (
|
||||
<BadgeCell>
|
||||
<GroupBadge group={group} />
|
||||
</BadgeCell>
|
||||
)
|
||||
},
|
||||
size: 120,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user