Skip to content

Commit b62b5b8

Browse files
committed
refactor: extract MAX_FREE_REPOS to config/api.ts, remove duplication
Was hardcoded as 3 in RepoListView.tsx and DashboardHome.tsx. Now exported from config/api.ts as single source of truth.
1 parent 263cba3 commit b62b5b8

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

frontend/src/components/dashboard/DashboardHome.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { AnimatePresence } from 'framer-motion'
77
import { toast } from 'sonner'
88
import { useAuth } from '../../contexts/AuthContext'
99
import { useRepos } from '../../hooks/useCachedQuery'
10-
import { API_URL } from '../../config/api'
10+
import { API_URL, MAX_FREE_REPOS } from '../../config/api'
1111
import { extractErrorMessage, isUpgradeError } from '../../lib/api-errors'
1212
import { RepoListView } from './RepoListView'
1313
import { RepoDetailView } from './RepoDetailView'
@@ -208,7 +208,7 @@ export function DashboardHome() {
208208
isOpen={showGitHubSelector}
209209
onClose={() => setShowGitHubSelector(false)}
210210
onImport={handleGitHubImport}
211-
maxSelectable={3}
211+
maxSelectable={MAX_FREE_REPOS}
212212
currentRepoCount={repos.length}
213213
/>
214214

frontend/src/components/dashboard/RepoListView.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import { Plus, Github } from 'lucide-react'
66
import { Button } from '../ui/button'
77
import { RepoList } from '../RepoList'
88
import { DashboardStats } from './DashboardStats'
9+
import { MAX_FREE_REPOS } from '../../config/api'
910
import type { Repository } from '../../types'
1011

11-
const MAX_FREE_REPOS = 3
12-
1312
interface RepoListViewProps {
1413
repos: Repository[]
1514
loading: boolean

frontend/src/config/api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ export const buildWsUrl = (path: string): string => {
5757
const cleanPath = path.startsWith('/') ? path : `/${path}`
5858
return `${WS_URL}${cleanPath}`
5959
}
60+
61+
// free tier repo limit -- used in dashboard and GitHub import
62+
export const MAX_FREE_REPOS = 3

0 commit comments

Comments
 (0)