@@ -31,6 +31,7 @@ const REPOS_PER_PAGE = 10
3131export default function Home ( ) {
3232 const [ apiKey , setApiKey ] = useState < string > ( "" )
3333 const [ noApiKey , setNoApiKey ] = useState ( false )
34+ const [ showApiKeyForm , setShowApiKeyForm ] = useState ( false )
3435 const [ collections , setCollections ] = useState < Collection [ ] > ( [ ] )
3536 const [ selectedCollection , setSelectedCollection ] = useState < Collection | null > ( null )
3637 const [ repositories , setRepositories ] = useState < Repository [ ] > ( [ ] )
@@ -526,6 +527,8 @@ export default function Home() {
526527 onExportCollection = { ( ) => setIsExportModalOpen ( true ) }
527528 onImportCollection = { ( ) => setIsImportModalOpen ( true ) }
528529 isLoading = { isLoading }
530+ onAddApiKey = { ( ) => setShowApiKeyForm ( true ) }
531+ hasApiKey = { ! ! apiKey }
529532 />
530533
531534 < div className = "container mx-auto px-4 py-8 flex-grow" >
@@ -536,7 +539,10 @@ export default function Home() {
536539 < p className = "text-gray-600 dark:text-gray-300 text-center" >
537540 Add a GitHub API key for better rate limits and reliability, or continue without one.
538541 </ p >
539- < GitHubApiKeyForm onSubmit = { handleApiKeySubmit } />
542+ < GitHubApiKeyForm onSubmit = { ( key ) => {
543+ setApiKey ( key )
544+ setShowApiKeyForm ( false )
545+ } } />
540546 < div className = "flex justify-center" >
541547 < Button
542548 onClick = { ( ) => setNoApiKey ( true ) }
@@ -548,6 +554,25 @@ export default function Home() {
548554 </ div >
549555 </ div >
550556 </ div >
557+ ) : showApiKeyForm ? (
558+ < div className = "max-w-md mx-auto" >
559+ < div className = "space-y-4" >
560+ < div className = "flex justify-between items-center" >
561+ < h2 className = "text-xl font-semibold text-gray-900 dark:text-white" > Add GitHub API Key</ h2 >
562+ < Button
563+ variant = "ghost"
564+ size = "sm"
565+ onClick = { ( ) => setShowApiKeyForm ( false ) }
566+ >
567+ Cancel
568+ </ Button >
569+ </ div >
570+ < GitHubApiKeyForm onSubmit = { ( key ) => {
571+ setApiKey ( key )
572+ setShowApiKeyForm ( false )
573+ } } />
574+ </ div >
575+ </ div >
551576 ) : (
552577 < div className = "space-y-6" >
553578 { progressiveLoadingStatus && (
0 commit comments