Skip to content

Commit d1595c6

Browse files
committed
feat(quota): add subtle dividers between quota entries in compact card
1 parent cbfc212 commit d1595c6

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

packages/frontend/src/components/quota/CompactQuotasCard.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { clsx } from 'clsx';
23
import { useNavigate } from 'react-router-dom';
34
import { AlertTriangle } from 'lucide-react';
45
import type { QuotaCheckerInfo, Meter } from '../../types/quota';
@@ -31,13 +32,20 @@ export const CompactQuotasCard: React.FC<CompactQuotasCardProps> = ({ allowanceQ
3132
}
3233
}}
3334
>
34-
{allowanceQuotas.map((quota) => {
35+
{allowanceQuotas.map((quota, idx) => {
3536
const displayName = getCheckerDisplayName(quota.checkerType, quota.checkerId);
3637
const allowanceMeters = getAllowanceMeters(quota.meters);
38+
const isLast = idx === allowanceQuotas.length - 1;
3739

3840
if (!quota.success) {
3941
return (
40-
<div key={quota.checkerId} className="flex items-center gap-2 min-w-0 py-0.5">
42+
<div
43+
key={quota.checkerId}
44+
className={clsx(
45+
'flex items-center gap-2 min-w-0 py-0.5',
46+
!isLast && 'border-b border-border/40'
47+
)}
48+
>
4149
<span className="text-[11px] text-text-secondary truncate flex-1">{displayName}</span>
4250
<AlertTriangle className="w-3 h-3 text-danger flex-shrink-0" />
4351
</div>
@@ -46,7 +54,13 @@ export const CompactQuotasCard: React.FC<CompactQuotasCardProps> = ({ allowanceQ
4654

4755
if (allowanceMeters.length === 0) {
4856
return (
49-
<div key={quota.checkerId} className="flex items-center gap-2 min-w-0 py-0.5">
57+
<div
58+
key={quota.checkerId}
59+
className={clsx(
60+
'flex items-center gap-2 min-w-0 py-0.5',
61+
!isLast && 'border-b border-border/40'
62+
)}
63+
>
5064
<span className="text-[11px] text-text-secondary truncate flex-1">{displayName}</span>
5165
<span className="text-[11px] text-text-muted"></span>
5266
</div>
@@ -55,7 +69,10 @@ export const CompactQuotasCard: React.FC<CompactQuotasCardProps> = ({ allowanceQ
5569

5670
// Show the service name once, then stack all allowance meters below it
5771
return (
58-
<div key={quota.checkerId} className="py-0.5">
72+
<div
73+
key={quota.checkerId}
74+
className={clsx('py-0.5', !isLast && 'border-b border-border/40')}
75+
>
5976
<span className="text-[11px] text-text-muted pl-0 block truncate mb-0.5">
6077
{displayName}
6178
</span>

0 commit comments

Comments
 (0)