Skip to content

Commit 5de0689

Browse files
committed
fix: a11y nested button, file_count locale formatting, scoped query key
1. PackageRow: replaced nested button>checkbox with div[role=checkbox] and visual-only checkbox indicator. Keyboard Enter/Space handled. 2. file_count now uses toLocaleString() matching estimated_functions 3. useUserUsage query key includes userId to prevent cache bleed between users on shared devices
1 parent 7999040 commit 5de0689

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

frontend/src/components/DirectoryPicker.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,29 +263,36 @@ function PackageRow({
263263
onToggle: () => void
264264
}) {
265265
return (
266-
<button
266+
<div
267+
role="checkbox"
268+
aria-checked={isSelected}
269+
tabIndex={0}
267270
onClick={onToggle}
271+
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onToggle() } }}
268272
className={cn(
269-
'flex items-center gap-3 w-full px-6 py-2.5 text-left transition-colors',
273+
'flex items-center gap-3 w-full px-6 py-2.5 text-left transition-colors cursor-pointer',
270274
isSelected
271275
? 'bg-primary/5'
272276
: 'hover:bg-muted/50',
273277
)}
274278
>
275-
<Checkbox checked={isSelected} tabIndex={-1} className="pointer-events-none" />
279+
<div className={cn(
280+
'h-4 w-4 shrink-0 rounded-sm border',
281+
isSelected ? 'bg-primary border-primary' : 'border-muted-foreground/40',
282+
)} />
276283
<span className={cn(
277284
'text-sm flex-1 truncate',
278285
isSelected ? 'text-foreground font-medium' : 'text-muted-foreground',
279286
)}>
280287
{dir.name}
281288
</span>
282289
<span className="text-xs text-muted-foreground tabular-nums w-20 text-right">
283-
{dir.file_count} files
290+
{dir.file_count.toLocaleString()} files
284291
</span>
285292
<span className="text-xs text-muted-foreground tabular-nums w-24 text-right">
286293
~{dir.estimated_functions.toLocaleString()} fn
287294
</span>
288-
</button>
295+
</div>
289296
)
290297
}
291298

frontend/src/components/dashboard/DashboardHome.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function DashboardHome() {
2323
const { session } = useAuth()
2424
const [searchParams, setSearchParams] = useSearchParams()
2525
const { data: repos = [], isLoading: reposLoading, invalidate: refreshRepos } = useRepos(session?.access_token)
26-
const { data: usage } = useUserUsage(session?.access_token)
26+
const { data: usage } = useUserUsage(session?.access_token, session?.user?.id)
2727

2828
const [selectedRepo, setSelectedRepo] = useState<string | null>(null)
2929
const [activeTab, setActiveTab] = useState<RepoTab>('overview')

frontend/src/hooks/useCachedQuery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ export function useRepos(apiKey: string | undefined) {
192192

193193

194194
/** User usage and tier limits from backend -- single source of truth */
195-
export function useUserUsage(apiKey: string | undefined) {
195+
export function useUserUsage(apiKey: string | undefined, userId?: string) {
196196
return useQuery({
197-
queryKey: ['user', 'usage'],
197+
queryKey: ['user', 'usage', userId],
198198
queryFn: async () => {
199199
const data = await fetchWithAuth(`${API_URL}/users/usage`, apiKey!)
200200
return data as {

0 commit comments

Comments
 (0)