diff --git a/frontend/__tests__/components/features/home/repo-selection-form.test.tsx b/frontend/__tests__/components/features/home/repo-selection-form.test.tsx index e164a48e45..563f0d3c16 100644 --- a/frontend/__tests__/components/features/home/repo-selection-form.test.tsx +++ b/frontend/__tests__/components/features/home/repo-selection-form.test.tsx @@ -252,8 +252,6 @@ describe("RepositorySelectionForm", () => { expect(searchedRepo).toBeInTheDocument(); await userEvent.click(searchedRepo); - expect(mockOnRepoSelection).toHaveBeenCalledWith( - MOCK_SEARCH_REPOS[0].full_name, - ); + expect(mockOnRepoSelection).toHaveBeenCalledWith(MOCK_SEARCH_REPOS[0]); }); }); diff --git a/frontend/src/components/features/home/repo-connector.tsx b/frontend/src/components/features/home/repo-connector.tsx index 92426e6eea..8dbbf0e4f6 100644 --- a/frontend/src/components/features/home/repo-connector.tsx +++ b/frontend/src/components/features/home/repo-connector.tsx @@ -4,9 +4,10 @@ import { RepositorySelectionForm } from "./repo-selection-form"; import { useConfig } from "#/hooks/query/use-config"; import { RepoProviderLinks } from "./repo-provider-links"; import { useUserProviders } from "#/hooks/use-user-providers"; +import { GitRepository } from "#/types/git"; interface RepoConnectorProps { - onRepoSelection: (repoTitle: string | null) => void; + onRepoSelection: (repo: GitRepository | null) => void; } export function RepoConnector({ onRepoSelection }: RepoConnectorProps) { diff --git a/frontend/src/components/features/home/repo-selection-form.tsx b/frontend/src/components/features/home/repo-selection-form.tsx index 3c4107e4b6..45b219fdf9 100644 --- a/frontend/src/components/features/home/repo-selection-form.tsx +++ b/frontend/src/components/features/home/repo-selection-form.tsx @@ -19,7 +19,7 @@ import { } from "./repository-selection"; interface RepositorySelectionFormProps { - onRepoSelection: (repoTitle: string | null) => void; + onRepoSelection: (repo: GitRepository | null) => void; } export function RepositorySelectionForm({ @@ -94,8 +94,7 @@ export function RepositorySelectionForm({ const handleRepoSelection = (key: React.Key | null) => { const selectedRepo = allRepositories?.find((repo) => repo.id === key); - - if (selectedRepo) onRepoSelection(selectedRepo.full_name); + if (selectedRepo) onRepoSelection(selectedRepo); setSelectedRepository(selectedRepo || null); setSelectedBranch(null); // Reset branch selection when repo changes branchManuallyClearedRef.current = false; // Reset the flag when repo changes diff --git a/frontend/src/components/features/home/tasks/task-suggestions.tsx b/frontend/src/components/features/home/tasks/task-suggestions.tsx index cfef06a7b1..14e0b15b91 100644 --- a/frontend/src/components/features/home/tasks/task-suggestions.tsx +++ b/frontend/src/components/features/home/tasks/task-suggestions.tsx @@ -6,16 +6,24 @@ import { TaskSuggestionsSkeleton } from "./task-suggestions-skeleton"; import { cn } from "#/utils/utils"; import { I18nKey } from "#/i18n/declaration"; import { TooltipButton } from "#/components/shared/buttons/tooltip-button"; +import { GitRepository } from "#/types/git"; interface TaskSuggestionsProps { - filterFor?: string | null; + filterFor?: GitRepository | null; } export function TaskSuggestions({ filterFor }: TaskSuggestionsProps) { const { t } = useTranslation(); const { data: tasks, isLoading } = useSuggestedTasks(); + const suggestedTasks = filterFor - ? tasks?.filter((task) => task.title === filterFor) + ? tasks?.filter( + (element) => + element.title === filterFor.full_name && + !!element.tasks.find( + (task) => task.git_provider === filterFor.git_provider, + ), + ) : tasks; const hasSuggestedTasks = suggestedTasks && suggestedTasks.length > 0; diff --git a/frontend/src/routes/home.tsx b/frontend/src/routes/home.tsx index 258e03fe95..62ec424893 100644 --- a/frontend/src/routes/home.tsx +++ b/frontend/src/routes/home.tsx @@ -4,14 +4,15 @@ import { HomeHeader } from "#/components/features/home/home-header"; import { RepoConnector } from "#/components/features/home/repo-connector"; import { TaskSuggestions } from "#/components/features/home/tasks/task-suggestions"; import { useUserProviders } from "#/hooks/use-user-providers"; +import { GitRepository } from "#/types/git"; ; function HomeScreen() { const { providers } = useUserProviders(); - const [selectedRepoTitle, setSelectedRepoTitle] = React.useState< - string | null - >(null); + const [selectedRepo, setSelectedRepo] = React.useState( + null, + ); const providersAreSet = providers.length > 0; @@ -25,11 +26,9 @@ function HomeScreen() {
- setSelectedRepoTitle(title)} - /> + setSelectedRepo(repo)} />
- {providersAreSet && } + {providersAreSet && }
);