From 339984fe948c8c6ef5824233b801a4e3111af605 Mon Sep 17 00:00:00 2001 From: Viktor Vorona Date: Thu, 19 Oct 2023 09:29:35 +0200 Subject: [PATCH] [NO-JIRA] Fix code smells --- .../Github/GitHubProjectCreateRenderer.tsx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreateRenderer.tsx b/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreateRenderer.tsx index df96843b995..e6239952a64 100644 --- a/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreateRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreateRenderer.tsx @@ -46,7 +46,7 @@ import { Paging } from '../../../../types/types'; import AlmRepoItem from '../components/AlmRepoItem'; import AlmSettingsInstanceDropdown from '../components/AlmSettingsInstanceDropdown'; -export interface GitHubProjectCreateRendererProps { +interface GitHubProjectCreateRendererProps { canAdmin: boolean; error: boolean; loadingBindings: boolean; @@ -66,18 +66,27 @@ export interface GitHubProjectCreateRendererProps { onSelectedAlmInstanceChange: (instance: AlmSettingsInstance) => void; } +type RepositoryListProps = Pick< + GitHubProjectCreateRendererProps, + | 'loadingRepositories' + | 'repositories' + | 'repositoryPaging' + | 'searchQuery' + | 'selectedOrganization' + | 'onLoadMore' + | 'onSearch' +> & { + selected: Set; + checkAll: () => void; + uncheckAll: () => void; + onCheck: (key: string) => void; +}; + function orgToOption({ key, name }: GithubOrganization) { return { value: key, label: name }; } -function RepositoryList( - props: GitHubProjectCreateRendererProps & { - selected: Set; - checkAll: () => void; - uncheckAll: () => void; - onCheck: (key: string) => void; - }, -) { +function RepositoryList(props: RepositoryListProps) { const { loadingRepositories, repositories, -- 2.39.5