Skip to content

Commit 3a5236d

Browse files
committed
fix: address PR review -- a11y, tier limit, backdrop guard
5 findings verified and fixed: 1. AddRepoForm close button: add aria-label='Close' for screen readers 2. AddRepoForm backdrop: use isBusy (loading || analyzing) guard instead of just loading -- prevents dismissal during analyze API call 3. DirectoryPicker close button: add aria-label='Close' 4. DirectoryPicker props: add functionLimit to interface (was destructured but missing from type definition) 5. DashboardHome: derive userTier from session metadata with 'free' fallback instead of hardcoded TIER_FUNCTION_LIMITS.free Skipped: TierName move to types.ts -- type derives from TIER_FUNCTION_LIMITS via keyof typeof, colocating with the constant is cleaner than re-exporting. Build passes.
1 parent 0748123 commit 3a5236d

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

frontend/src/components/AddRepoForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function AddRepoForm({ onAdd, onAnalyzed, loading, isOpen, onOpenChange }
9191
animate={{ opacity: 1 }}
9292
exit={{ opacity: 0 }}
9393
className="fixed inset-0 bg-background/80 backdrop-blur-md flex items-center justify-center z-50"
94-
onClick={() => !loading && setShowForm(false)}
94+
onClick={() => !isBusy && setShowForm(false)}
9595
>
9696
<motion.div
9797
initial={{ opacity: 0, scale: 0.95, y: 20 }}
@@ -113,6 +113,7 @@ export function AddRepoForm({ onAdd, onAnalyzed, loading, isOpen, onOpenChange }
113113
</div>
114114
<button
115115
onClick={() => setShowForm(false)}
116+
aria-label="Close"
116117
className="w-8 h-8 flex items-center justify-center rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors"
117118
disabled={isBusy}
118119
>

frontend/src/components/DirectoryPicker.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface DirectoryPickerProps {
2121
repoInfo: AnalyzeResult
2222
onConfirm: (selectedPaths: string[]) => void
2323
loading: boolean
24+
functionLimit?: number
2425
}
2526

2627
export function DirectoryPicker({
@@ -187,6 +188,7 @@ function PickerHeader({
187188
<button
188189
onClick={onClose}
189190
disabled={loading}
191+
aria-label="Close"
190192
className="w-8 h-8 flex items-center justify-center rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors"
191193
>
192194
<X className="w-4 h-4" />

frontend/src/components/dashboard/DashboardHome.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { DirectoryPicker } from '../DirectoryPicker'
1616
import { GitHubRepoSelector } from '../GitHubRepoSelector'
1717
import { IndexingProgressModal } from '../IndexingProgressModal'
1818
import { UpgradeLimitModal } from '../UpgradeLimitModal'
19-
import { TIER_FUNCTION_LIMITS } from '../../config/api'
19+
import { TIER_FUNCTION_LIMITS, type TierName } from '../../config/api'
2020
import type { GitHubRepo } from '../../hooks/useGitHubRepos'
2121
import type { AnalyzeResult, RepoTab } from '../../types'
2222

@@ -25,6 +25,9 @@ export function DashboardHome() {
2525
const [searchParams, setSearchParams] = useSearchParams()
2626
const { data: repos = [], isLoading: reposLoading, invalidate: refreshRepos } = useRepos(session?.access_token)
2727

28+
// User tier -- defaults to free, will be replaced when user profile API is available
29+
const userTier: TierName = (session?.user?.user_metadata?.tier as TierName) || 'free'
30+
2831
const [selectedRepo, setSelectedRepo] = useState<string | null>(null)
2932
const [activeTab, setActiveTab] = useState<RepoTab>('overview')
3033
const [loading, setLoading] = useState(false)
@@ -256,7 +259,8 @@ export function DashboardHome() {
256259
repoInfo={analyzeResult}
257260
onConfirm={handleDirectoryConfirm}
258261
loading={loading}
259-
functionLimit={TIER_FUNCTION_LIMITS.free}
262+
// TODO: replace with actual user tier once GET /users/me returns tier
263+
functionLimit={TIER_FUNCTION_LIMITS[userTier]}
260264
/>
261265
)}
262266

0 commit comments

Comments
 (0)