Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
e3ce03b
Replace limits cards with inline limit and alert controls
sarimrmalik Apr 13, 2026
151d688
Refactor each icon into its own file with a common wrapper for shared…
sarimrmalik Apr 14, 2026
e25ca40
Refactor Alert and Limit ASCII icons to use div wrappers instead of S…
sarimrmalik Apr 14, 2026
a2ec03e
Rollback icon refactor since out of scope of this branch
sarimrmalik Apr 14, 2026
adee037
Add ASCII icon components for alert and limit with styled text repres…
sarimrmalik Apr 14, 2026
80f766d
Refactor billing limits management by removing the old LimitForm comp…
sarimrmalik Apr 14, 2026
f8c7998
Refactor dashboard limits management by removing the old limit-sectio…
sarimrmalik Apr 14, 2026
fa3856c
Enhance UsageAlertForm and UsageLimitForm to improve cancel functiona…
sarimrmalik Apr 14, 2026
a510283
Add SetUsageLimitDialog component for setting API usage limits
sarimrmalik Apr 14, 2026
65c7b0c
Refactor UsageAlertForm and UsageLimitForm to use Input components fo…
sarimrmalik Apr 14, 2026
262247b
Refactor RemoveUsageLimitDialog and UsageLimitForm to enhance user in…
sarimrmalik Apr 14, 2026
039e670
Refactor UsageLimits component to improve loading state handling. Con…
sarimrmalik Apr 14, 2026
7189e3d
Run biome format
sarimrmalik Apr 14, 2026
85c4cc7
Add mount check in UsageAlertForm to prevent initial effect execution
sarimrmalik Apr 14, 2026
307ef38
Add currency validation and formatting utilities with comprehensive t…
sarimrmalik Apr 14, 2026
58f76f7
Refactor currency-related tests and forms for improved consistency an…
sarimrmalik Apr 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ next-env.d.ts

# AI agents and related files
CLAUDE.md
.cursor
.agent


Expand Down
45 changes: 45 additions & 0 deletions src/__test__/unit/currency.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { describe, expect, it } from 'vitest'
import {
CurrencyInputSchema,
formatCurrencyValue,
sanitizeCurrencyInput,
} from '@/lib/utils/currency'

describe('sanitizeCurrencyInput', () => {
it.each([
['$1,250', '1250'],
['1250', '1250'],
['abc', ''],
['', ''],
])('returns %p -> %p', (value: string, expected: string) => {
expect(sanitizeCurrencyInput(value)).toBe(expected)
})
})

describe('formatCurrencyValue', () => {
it.each([
[1250, '1,250'],
[100, '100'],
[0, '0'],
[1000000, '1,000,000'],
])('returns %p -> %p', (value: number, expected: string) => {
expect(formatCurrencyValue(value)).toBe(expected)
})
})

describe('CurrencyInputSchema', () => {
it.each(['100', '1', ' 100 ', '999999'])('accepts %p', (value: string) => {
expect(CurrencyInputSchema.safeParse(value).success).toBe(true)
})

it.each([
'',
' ',
'12.50',
'1,250',
'abc',
'0',
])('rejects %p', (value: string) => {
expect(CurrencyInputSchema.safeParse(value).success).toBe(false)
})
})
13 changes: 4 additions & 9 deletions src/app/dashboard/[teamSlug]/limits/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UsageLimits from '@/features/dashboard/limits/usage-limits'
import { Page } from '@/features/dashboard/layouts/page'
import { UsageLimits } from '@/features/dashboard/limits/usage-limits'
import { HydrateClient, prefetch, trpc } from '@/trpc/server'
import Frame from '@/ui/frame'

interface LimitsPageProps {
params: Promise<{ teamSlug: string }>
Expand All @@ -13,14 +13,9 @@ export default async function LimitsPage({ params }: LimitsPageProps) {

return (
<HydrateClient>
<Frame
classNames={{
frame: 'flex flex-col gap-4 max-md:border-none',
wrapper: 'w-full max-md:p-0',
}}
>
<Page>
<UsageLimits />
</Frame>
</Page>
</HydrateClient>
)
}
2 changes: 1 addition & 1 deletion src/features/dashboard/layouts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface PageProps {
}

export const Page = ({ children, className }: PageProps) => (
<div className={cn('mx-auto w-full max-w-[900px]', className)}>
<div className={cn('mx-auto w-full max-w-[900px] px-3 md:px-0', className)}>
{children}
</div>
)
45 changes: 45 additions & 0 deletions src/features/dashboard/limits/alert-ascii-icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type React from 'react'
import { cn } from '@/lib/utils/index'

const LINES = [
' ',
' ',
' ',
' ',
' -********- ',
' -*-- -*- ',
' -*- -*- ',
' **- -** ',
' -*- -*- ',
' -**----------**- ',
' ----**----**---- ',
' -******- ',
' ',
' ',
' ',
' ',
]

const TEXT_STYLE: React.CSSProperties = {
fontSize: '3.802px',
fontFamily: 'var(--font-mono)',
fontWeight: 600,
letterSpacing: '-0.038px',
lineHeight: '4px',
fontFeatureSettings: "'ss03' 1",
}

export const AlertAsciiIcon = ({ className }: { className?: string }) => (
<div className={cn('relative size-[72px]', className)}>
<div
className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 whitespace-nowrap text-fg uppercase"
style={TEXT_STYLE}
>
{LINES.map((line, i) => (
<p key={i} className="m-0 whitespace-pre">
{line}
Comment thread
sarimrmalik marked this conversation as resolved.
</p>
))}
</div>
</div>
)
40 changes: 0 additions & 40 deletions src/features/dashboard/limits/alert-card.tsx

This file was deleted.

45 changes: 45 additions & 0 deletions src/features/dashboard/limits/limit-ascii-icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type React from 'react'
import { cn } from '@/lib/utils/index'

const LINES = [
' ',
' ',
' ',
' ',
' ---**--- ',
' -**------**- ',
' -**- - -**- ',
' ** -**- ** ',
' *- --- -* ',
' ** ** ',
' -**- -**- ',
' -- -- ',
' ',
' ',
' ',
' ',
]

const TEXT_STYLE: React.CSSProperties = {
fontSize: '3.802px',
fontFamily: 'var(--font-mono)',
fontWeight: 600,
letterSpacing: '-0.038px',
lineHeight: '4px',
fontFeatureSettings: "'ss03' 1",
}

export const LimitAsciiIcon = ({ className }: { className?: string }) => (
<div className={cn('relative size-[72px]', className)}>
<div
className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 whitespace-nowrap text-fg uppercase"
style={TEXT_STYLE}
>
{LINES.map((line, i) => (
<p key={i} className="m-0 whitespace-pre">
{line}
</p>
))}
</div>
</div>
)
51 changes: 0 additions & 51 deletions src/features/dashboard/limits/limit-card.tsx

This file was deleted.

Loading
Loading