diff --git a/packages/ui/src/components/chat/composer/ui/ComposerAttachmentControls.tsx b/packages/ui/src/components/chat/composer/ui/ComposerAttachmentControls.tsx index 85788b5b..2387ccb9 100644 --- a/packages/ui/src/components/chat/composer/ui/ComposerAttachmentControls.tsx +++ b/packages/ui/src/components/chat/composer/ui/ComposerAttachmentControls.tsx @@ -18,6 +18,7 @@ import { } from '@/components/ui/dropdown-menu'; import { useI18n } from '@/lib/i18n'; import { cn } from '@/lib/utils'; +import type { GitProvider } from '@/lib/gitProvider'; type ComposerAttachmentControlsProps = { isVSCode: boolean; @@ -26,6 +27,8 @@ type ComposerAttachmentControlsProps = { handlePickLocalFiles: () => void; openIssuePicker: () => void; openPrPicker: () => void; + /** Only shows the GitHub issue/PR attach actions when the repo is GitHub. */ + gitProvider?: GitProvider | null; onOpenSettings?: () => void; onMenuOpenChange?: (open: boolean) => void; /** Mobile: open the attachment bottom sheet instead of the dropdown menu. */ @@ -41,6 +44,7 @@ export const ComposerAttachmentControls = React.memo(function ComposerAttachment handlePickLocalFiles, openIssuePicker, openPrPicker, + gitProvider, onOpenSettings, } = props; @@ -98,22 +102,26 @@ export const ComposerAttachmentControls = React.memo(function ComposerAttachment {t('chat.chatInput.actions.attachFiles')} - { - requestAnimationFrame(openIssuePicker); - }} - > - - {t('chat.chatInput.actions.linkGithubIssue')} - - { - requestAnimationFrame(openPrPicker); - }} - > - - {t('chat.chatInput.actions.linkGithubPr')} - + {gitProvider === 'github' ? ( + <> + { + requestAnimationFrame(openIssuePicker); + }} + > + + {t('chat.chatInput.actions.linkGithubIssue')} + + { + requestAnimationFrame(openPrPicker); + }} + > + + {t('chat.chatInput.actions.linkGithubPr')} + + + ) : null} )} @@ -136,6 +144,7 @@ export const ComposerAttachmentControls = React.memo(function ComposerAttachment prev.isVSCode === next.isVSCode && prev.footerIconButtonClass === next.footerIconButtonClass && prev.iconSizeClass === next.iconSizeClass + && prev.gitProvider === next.gitProvider && prev.onOpenSettings === next.onOpenSettings && prev.onMenuOpenChange === next.onMenuOpenChange && prev.onOpenMobileSheet === next.onOpenMobileSheet diff --git a/packages/ui/src/components/chat/composer/ui/ComposerFooter.tsx b/packages/ui/src/components/chat/composer/ui/ComposerFooter.tsx index cc52fdc9..e633475d 100644 --- a/packages/ui/src/components/chat/composer/ui/ComposerFooter.tsx +++ b/packages/ui/src/components/chat/composer/ui/ComposerFooter.tsx @@ -18,6 +18,7 @@ import { ComposerDictation } from '@/components/dictation/ComposerDictation'; import { Icon } from '@/components/icon/Icon'; import { useI18n } from '@/lib/i18n'; import { cn } from '@/lib/utils'; +import { useGitProvider } from '@/lib/gitProvider'; import { ModelControls } from '../../ModelControls'; import { ComposerActionButtons } from './ComposerActionButtons'; import { ComposerAttachmentControls } from './ComposerAttachmentControls'; @@ -106,6 +107,8 @@ export function ComposerFooter(props: ComposerFooterProps) { onDictationContentHeightChange, } = props; + const gitProvider = useGitProvider(directory); + return (
@@ -199,6 +203,7 @@ export function ComposerFooter(props: ComposerFooterProps) { handlePickLocalFiles={onPickLocalFiles} openIssuePicker={onOpenIssuePicker} openPrPicker={onOpenPrPicker} + gitProvider={gitProvider} onOpenSettings={onOpenSettings} />