fix(frontend): Show actions when idle (#8507)

This commit is contained in:
sp.wack 2025-05-14 22:53:32 +04:00 committed by GitHub
parent 6145552841
commit d956abe56b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,11 +1,11 @@
import posthog from "posthog-js";
import React from "react";
import { useSelector } from "react-redux";
import { useTranslation } from "react-i18next";
import { SuggestionItem } from "#/components/features/suggestions/suggestion-item";
import type { RootState } from "#/store";
import { I18nKey } from "#/i18n/declaration";
import { useUserProviders } from "#/hooks/use-user-providers";
import { useConversation } from "#/context/conversation-context";
import { useUserConversation } from "#/hooks/query/use-user-conversation";
interface ActionSuggestionsProps {
onSuggestionsClick: (value: string) => void;
@ -16,17 +16,13 @@ export function ActionSuggestions({
}: ActionSuggestionsProps) {
const { t } = useTranslation();
const { providers } = useUserProviders();
const { selectedRepository } = useSelector(
(state: RootState) => state.initialQuery,
);
const { conversationId } = useConversation();
const { data: conversation } = useUserConversation(conversationId);
const [hasPullRequest, setHasPullRequest] = React.useState(false);
const providersAreSet = providers.length > 0;
const isGitLab =
selectedRepository !== null &&
selectedRepository.git_provider &&
selectedRepository.git_provider.toLowerCase() === "gitlab";
const isGitLab = providers.includes("gitlab");
const pr = isGitLab ? "merge request" : "pull request";
const prShort = isGitLab ? "MR" : "PR";
@ -45,7 +41,7 @@ export function ActionSuggestions({
return (
<div className="flex flex-col gap-2 mb-2">
{providersAreSet && selectedRepository && (
{providersAreSet && conversation?.selected_repository && (
<div className="flex flex-row gap-2 justify-center w-full">
{!hasPullRequest ? (
<>