1- import type { GitHubIssue , GitHubPullRequest , GitLogEntry , ModelOption } from "../../../types" ;
1+ import type { GitHubIssue , GitHubPullRequest , GitLogEntry } from "../../../types" ;
22import type { MouseEvent as ReactMouseEvent } from "react" ;
3- import { useCallback , useEffect , useRef , useState } from "react" ;
3+ import { useCallback , useEffect , useState } from "react" ;
44import { openUrl } from "@tauri-apps/plugin-opener" ;
55import ArrowLeftRight from "lucide-react/dist/esm/icons/arrow-left-right" ;
66import ChevronDown from "lucide-react/dist/esm/icons/chevron-down" ;
77import ChevronRight from "lucide-react/dist/esm/icons/chevron-right" ;
8- import Cpu from "lucide-react/dist/esm/icons/cpu" ;
98import Download from "lucide-react/dist/esm/icons/download" ;
109import RotateCcw from "lucide-react/dist/esm/icons/rotate-ccw" ;
1110import RotateCw from "lucide-react/dist/esm/icons/rotate-cw" ;
@@ -15,11 +14,6 @@ import {
1514 MagicSparkleIcon ,
1615 MagicSparkleLoaderIcon ,
1716} from "@/features/shared/components/MagicSparkleIcon" ;
18- import {
19- PopoverMenuItem ,
20- PopoverSurface ,
21- } from "../../design-system/components/popover/PopoverPrimitives" ;
22- import { useDismissibleMenu } from "../../app/hooks/useDismissibleMenu" ;
2317import type { GitPanelMode } from "../types" ;
2418import type { PerFileDiffGroup } from "../utils/perFileThreadDiffs" ;
2519import {
@@ -330,9 +324,6 @@ type GitDiffModeContentProps = {
330324 commitMessageLoading : boolean ;
331325 canGenerateCommitMessage : boolean ;
332326 onGenerateCommitMessage ?: ( ) => void | Promise < void > ;
333- models : ModelOption [ ] ;
334- commitMessageModelId : string | null ;
335- onCommitMessageModelChange ?: ( id : string | null ) => void ;
336327 stagedFiles : DiffFile [ ] ;
337328 unstagedFiles : DiffFile [ ] ;
338329 commitLoading : boolean ;
@@ -389,9 +380,6 @@ export function GitDiffModeContent({
389380 commitMessageLoading,
390381 canGenerateCommitMessage,
391382 onGenerateCommitMessage,
392- models,
393- commitMessageModelId,
394- onCommitMessageModelChange,
395383 stagedFiles,
396384 unstagedFiles,
397385 commitLoading,
@@ -416,20 +404,6 @@ export function GitDiffModeContent({
416404 onShowFileMenu,
417405 onDiffListClick,
418406} : GitDiffModeContentProps ) {
419- const [ commitModelOpen , setCommitModelOpen ] = useState ( false ) ;
420- const commitModelRef = useRef < HTMLDivElement | null > ( null ) ;
421- useDismissibleMenu ( {
422- isOpen : commitModelOpen ,
423- containerRef : commitModelRef ,
424- onClose : ( ) => setCommitModelOpen ( false ) ,
425- } ) ;
426- const selectedCommitModel = commitMessageModelId
427- ? models . find ( ( m ) => m . model === commitMessageModelId ) ?? null
428- : models . find ( ( m ) => m . isDefault ) ?? models [ 0 ] ?? null ;
429- const commitModelLabel = selectedCommitModel ?. displayName ?. trim ( )
430- || selectedCommitModel ?. model ?. trim ( )
431- || "Model" ;
432-
433407 const normalizedGitRoot = normalizeRootPath ( gitRoot ) ;
434408 const missingRepo = isMissingRepo ( error ) ;
435409 const gitRootNotFound = isGitRootNotFound ( error ) ;
@@ -572,61 +546,6 @@ export function GitDiffModeContent({
572546 ) }
573547 </ button >
574548 </ div >
575- { models . length > 0 && (
576- < div className = "open-app-menu commit-model-menu" ref = { commitModelRef } >
577- < div className = "open-app-button" >
578- < button
579- type = "button"
580- className = "ghost open-app-action"
581- onClick = { ( ) => setCommitModelOpen ( ( prev ) => ! prev ) }
582- disabled = { commitMessageLoading }
583- aria-label = "Select model for commit message"
584- >
585- < span className = "open-app-label" >
586- < Cpu size = { 14 } aria-hidden />
587- { commitModelLabel }
588- </ span >
589- </ button >
590- < button
591- type = "button"
592- className = "ghost open-app-toggle"
593- onClick = { ( ) => setCommitModelOpen ( ( prev ) => ! prev ) }
594- disabled = { commitMessageLoading }
595- aria-haspopup = "menu"
596- aria-expanded = { commitModelOpen }
597- aria-label = "Toggle model menu"
598- >
599- < ChevronDown size = { 14 } aria-hidden />
600- </ button >
601- </ div >
602- { commitModelOpen && (
603- < PopoverSurface
604- className = "open-app-dropdown commit-model-dropdown"
605- role = "menu"
606- >
607- { models . map ( ( m ) => {
608- const isActive = commitMessageModelId
609- ? m . model === commitMessageModelId
610- : m === selectedCommitModel ;
611- return (
612- < PopoverMenuItem
613- key = { m . id }
614- className = "open-app-option"
615- onClick = { ( ) => {
616- onCommitMessageModelChange ?.( m . model ) ;
617- setCommitModelOpen ( false ) ;
618- } }
619- icon = { < Cpu size = { 14 } aria-hidden /> }
620- active = { isActive }
621- >
622- { m . displayName ?. trim ( ) || m . model }
623- </ PopoverMenuItem >
624- ) ;
625- } ) }
626- </ PopoverSurface >
627- ) }
628- </ div >
629- ) }
630549 < CommitButton
631550 commitMessage = { commitMessage }
632551 hasStagedFiles = { stagedFiles . length > 0 }
0 commit comments