@@ -112,88 +112,90 @@ export function GitHubInstallationModal({
112112 < ChipModalBody >
113113 < ChipModalField
114114 type = 'custom'
115- title = 'GitHub App'
116- hint = 'The app indexes selected repositories. Each person connects their own GitHub account to search only content they can access.'
115+ title = { data ?. needsUserConnection ? 'GitHub account' : 'Installation' }
116+ hint = {
117+ data ?. available && ! data . needsUserConnection && choices . length === 0
118+ ? 'Install the app, then refresh.'
119+ : undefined
120+ }
117121 >
118- { installations . isError ? (
119- < SettingsQueryErrorState
120- error = { installations . error }
121- fallback = 'Could not load GitHub installations'
122- isRetrying = { installations . isFetching }
123- onRetry = { ( ) => void installations . refetch ( ) }
124- variant = 'inline'
125- />
126- ) : ! data ? (
127- < SettingsEmptyState variant = 'inline' > Loading GitHub setup…</ SettingsEmptyState >
128- ) : ! data . available ? (
129- < SettingsEmptyState variant = 'inline' >
130- GitHub App indexing is unavailable in this deployment.
131- </ SettingsEmptyState >
132- ) : data . needsUserConnection ? (
133- < div className = 'flex flex-col gap-3' >
134- < p className = 'text-[var(--text-body)] text-small' >
135- { waitingForAccount
136- ? 'Finish connecting your account in the other tab, then refresh.'
137- : 'Connect your GitHub account to verify the installations you can manage.' }
138- </ p >
139- < div className = 'flex flex-wrap gap-2' >
140- < Chip variant = 'primary' disabled = { pending } onClick = { connectGitHubAccount } >
141- { waitingForAccount ? 'Open account connection' : 'Connect your GitHub account' }
142- </ Chip >
143- < Chip
144- disabled = { pending || installations . isFetching }
145- onClick = { ( ) => void installations . refetch ( ) }
146- >
147- Refresh
148- </ Chip >
122+ { ( aria ) =>
123+ installations . isError ? (
124+ < SettingsQueryErrorState
125+ error = { installations . error }
126+ fallback = 'Could not load GitHub installations'
127+ isRetrying = { installations . isFetching }
128+ onRetry = { ( ) => void installations . refetch ( ) }
129+ variant = 'inline'
130+ />
131+ ) : ! data ? (
132+ < SettingsEmptyState variant = 'inline' > Loading GitHub setup…</ SettingsEmptyState >
133+ ) : ! data . available ? (
134+ < SettingsEmptyState variant = 'inline' >
135+ GitHub App indexing is unavailable in this deployment.
136+ </ SettingsEmptyState >
137+ ) : data . needsUserConnection ? (
138+ < div className = 'flex flex-col gap-3' >
139+ < p className = 'text-[var(--text-body)] text-small' >
140+ { waitingForAccount
141+ ? 'Finish connecting your account in the other tab, then refresh.'
142+ : 'Connect your GitHub account to verify the installations you can manage.' }
143+ </ p >
144+ < div className = 'flex flex-wrap gap-2' >
145+ < Chip variant = 'primary' disabled = { pending } onClick = { connectGitHubAccount } >
146+ { waitingForAccount ? 'Open account connection' : 'Connect your GitHub account' }
147+ </ Chip >
148+ < Chip
149+ disabled = { pending || installations . isFetching }
150+ onClick = { ( ) => void installations . refetch ( ) }
151+ >
152+ Refresh
153+ </ Chip >
154+ </ div >
149155 </ div >
150- </ div >
151- ) : (
152- < div className = 'flex flex-col gap-3' >
153- < p className = 'text-[var(--text-body)] text-small' >
154- Install the app on your account or organization and choose its repositories, then
155- refresh.
156- </ p >
157- < div className = 'flex flex-wrap gap-2' >
158- { data . installUrl && (
159- < ChipLink href = { data . installUrl } target = '_blank' rel = 'noopener noreferrer' >
160- Install GitHub App
161- </ ChipLink >
156+ ) : (
157+ < div className = 'flex flex-col gap-3' >
158+ { choices . length > 0 ? (
159+ < ChipCombobox
160+ { ...aria }
161+ aria-label = 'Installation'
162+ options = { choices . map ( ( item ) => ( {
163+ value : item . installationId ,
164+ label : item . accountLogin ,
165+ } ) ) }
166+ value = { selected ?. installationId }
167+ onChange = { setInstallationId }
168+ placeholder = 'Select an installation'
169+ disabled = { pending || installations . isFetching }
170+ />
171+ ) : (
172+ < SettingsEmptyState variant = 'inline' >
173+ No eligible installations found.
174+ </ SettingsEmptyState >
162175 ) }
163- < Chip
164- disabled = { pending || installations . isFetching }
165- onClick = { ( ) => void installations . refetch ( ) }
166- >
167- Refresh
168- </ Chip >
176+ < div className = 'flex flex-wrap gap-2' >
177+ { data . installUrl && (
178+ < ChipLink
179+ { ...aria }
180+ href = { data . installUrl }
181+ target = '_blank'
182+ rel = 'noopener noreferrer'
183+ >
184+ Install GitHub App
185+ </ ChipLink >
186+ ) }
187+ < Chip
188+ { ...aria }
189+ disabled = { pending || installations . isFetching }
190+ onClick = { ( ) => void installations . refetch ( ) }
191+ >
192+ Refresh
193+ </ Chip >
194+ </ div >
169195 </ div >
170- </ div >
171- ) }
196+ )
197+ }
172198 </ ChipModalField >
173- { data ?. available && ! data . needsUserConnection && (
174- < ChipModalField
175- type = 'custom'
176- title = 'Installation'
177- hint = 'Only installations on your account or organizations you administer appear here.'
178- >
179- { choices . length > 0 ? (
180- < ChipCombobox
181- options = { choices . map ( ( item ) => ( {
182- value : item . installationId ,
183- label : item . accountLogin ,
184- } ) ) }
185- value = { selected ?. installationId }
186- onChange = { setInstallationId }
187- placeholder = 'Select an installation'
188- disabled = { pending || installations . isFetching }
189- />
190- ) : (
191- < SettingsEmptyState variant = 'inline' >
192- No eligible installations found.
193- </ SettingsEmptyState >
194- ) }
195- </ ChipModalField >
196- ) }
197199 < ChipModalError >
198200 { connectionError ??
199201 ensureAccounts . error ?. message ??
0 commit comments