@@ -19,16 +19,15 @@ import { useAuthProviderDescriptions } from "../data/auth-providers/auth-provide
1919import { ReactComponent as Exclamation2 } from "../images/exclamation2.svg" ;
2020import { AuthProviderType } from "@gitpod/public-api/lib/gitpod/v1/authprovider_pb" ;
2121import { SuggestedRepository } from "@gitpod/public-api/lib/gitpod/v1/scm_pb" ;
22- import { PREDEFINED_REPOS } from "../data/git-providers/predefined-repos" ;
22+ import { PREDEFINED_REPOS , PredefinedRepo } from "../data/git-providers/predefined-repos" ;
2323import { useConfiguration , useListConfigurations } from "../data/configurations/configuration-queries" ;
2424import { useUserLoader } from "../hooks/use-user-loader" ;
2525import { conjunctScmProviders , getDeduplicatedScmProviders } from "../utils" ;
2626import { cn } from "@podkit/lib/cn" ;
2727import { useOrgSuggestedRepos } from "../data/organizations/suggested-repositories-query" ;
2828import { toRemoteURL } from "../projects/render-utils" ;
2929
30- type PredefinedRepoOption = typeof PREDEFINED_REPOS [ number ] ;
31- const isPredefined = ( repo : SuggestedRepository | PredefinedRepoOption ) : boolean => {
30+ const isPredefined = ( repo : SuggestedRepository | PredefinedRepo ) : boolean => {
3231 return (
3332 PREDEFINED_REPOS . some ( ( predefined ) => predefined . url === repo . url ) &&
3433 ! ( repo as SuggestedRepository ) . configurationId
@@ -41,7 +40,7 @@ const resolveIcon = (contextUrl?: string): string => {
4140} ;
4241
4342type PredefinedRepositoryOptionProps = {
44- repo : PredefinedRepoOption ;
43+ repo : PredefinedRepo ;
4544} ;
4645const PredefinedRepositoryOption : FC < PredefinedRepositoryOptionProps > = ( { repo } ) => {
4746 const prettyUrl = toRemoteURL ( repo . url ) ;
@@ -50,7 +49,12 @@ const PredefinedRepositoryOption: FC<PredefinedRepositoryOptionProps> = ({ repo
5049 return (
5150 < div className = "flex flex-col overflow-hidden" aria-label = { `Demo: ${ repo . url } ` } >
5251 < div className = "flex items-center" >
53- < img className = { cn ( "w-5 mr-2 text-pk-content-secondary" ) } src = { icon } alt = "" />
52+ { repo . configurationId ? (
53+ < RepositoryIcon className = { cn ( "w-5 mr-2 text-kumquat-ripe" ) } />
54+ ) : (
55+ < img className = { cn ( "w-5 mr-2 text-pk-content-secondary" ) } src = { icon } alt = "" />
56+ ) }
57+
5458 < span className = "text-sm font-semibold" > { repo . repoName } </ span >
5559 < MiddleDot className = "px-0.5 text-pk-content-secondary" />
5660 < span
@@ -280,6 +284,7 @@ export default function RepositoryFinder({
280284 url : repo . url ,
281285 repoName : repo . repoName ,
282286 description : "" ,
287+ configurationId : repo . configurationId ,
283288 } ) ) ;
284289 }
285290
@@ -317,11 +322,14 @@ export default function RepositoryFinder({
317322 repo . url . toLowerCase ( ) . includes ( searchString . toLowerCase ( ) ) ||
318323 repo . repoName . toLowerCase ( ) . includes ( searchString . toLowerCase ( ) )
319324 ) {
320- result . push ( {
321- id : repo . url ,
322- element : < PredefinedRepositoryOption repo = { repo } /> ,
323- isSelectable : true ,
324- } ) ;
325+ const alreadyPresent = result . find ( ( r ) => r . id === repo . configurationId ) ;
326+ if ( ! alreadyPresent ) {
327+ result . push ( {
328+ id : repo . url ,
329+ element : < PredefinedRepositoryOption repo = { repo } /> ,
330+ isSelectable : true ,
331+ } ) ;
332+ }
325333 }
326334 } ) ;
327335 }
0 commit comments