11"use client" ;
22
33import { useState } from "react" ;
4- import { GitBranch , X , Link , Loader2 , CloudUpload } from "lucide-react" ;
4+ import { GitBranch , X , Link , Loader2 , CloudUpload , GitMerge , Shield } from "lucide-react" ;
55import { AccordionItem , AccordionTrigger , AccordionContent } from "@/components/ui/accordion" ;
66import { Badge } from "@/components/ui/badge" ;
77import { Button } from "@/components/ui/button" ;
88
99type Repository = {
1010 url : string ;
1111 branch ?: string ;
12+ baseBranch ?: string ;
13+ featureBranch ?: string ;
14+ allowProtectedWork ?: boolean ;
15+ sync ?: {
16+ url : string ;
17+ branch ?: string ;
18+ } ;
1219} ;
1320
1421type UploadedFile = {
@@ -78,7 +85,7 @@ export function RepositoriesAccordion({
7885 < p className = "text-sm text-muted-foreground" >
7986 Add additional context to improve AI responses.
8087 </ p >
81-
88+
8289 { /* Context Items List (Repos + Uploaded Files) */ }
8390 { totalContextItems === 0 ? (
8491 < div className = "text-center py-6" >
@@ -98,26 +105,70 @@ export function RepositoriesAccordion({
98105 const repoName = repo . url . split ( '/' ) . pop ( ) ?. replace ( '.git' , '' ) || `repo-${ idx } ` ;
99106 const isRemoving = removingRepo === repoName ;
100107
108+ // Determine which branch info to show
109+ const baseBranch = repo . baseBranch || repo . branch || 'main' ;
110+ const featureBranch = repo . featureBranch ;
111+ const hasSync = ! ! repo . sync ?. url ;
112+ const allowProtected = repo . allowProtectedWork ;
113+
101114 return (
102- < div key = { `repo-${ idx } ` } className = "flex items-center gap-2 p-2 border rounded bg-muted/30 hover:bg-muted/50 transition-colors" >
103- < GitBranch className = "h-4 w-4 text-muted-foreground flex-shrink-0" />
104- < div className = "flex-1 min-w-0" >
105- < div className = "text-sm font-medium truncate" > { repoName } </ div >
106- < div className = "text-xs text-muted-foreground truncate" > { repo . url } </ div >
115+ < div key = { `repo-${ idx } ` } className = "border rounded-lg bg-muted/30 hover:bg-muted/50 transition-colors" >
116+ < div className = "flex items-start gap-2 p-3" >
117+ < GitBranch className = "h-4 w-4 text-muted-foreground flex-shrink-0 mt-0.5" />
118+ < div className = "flex-1 min-w-0" >
119+ < div className = "flex items-center gap-2 mb-1" >
120+ < div className = "text-sm font-medium truncate" > { repoName } </ div >
121+ { hasSync && (
122+ < Badge variant = "outline" className = "text-xs" >
123+ < GitMerge className = "h-3 w-3 mr-1" />
124+ Synced
125+ </ Badge >
126+ ) }
127+ { allowProtected && (
128+ < Badge variant = "outline" className = "text-xs text-orange-600 border-orange-300" >
129+ < Shield className = "h-3 w-3 mr-1" />
130+ Protected
131+ </ Badge >
132+ ) }
133+ </ div >
134+ < div className = "text-xs text-muted-foreground truncate mb-2" > { repo . url } </ div >
135+
136+ { /* Branch information */ }
137+ < div className = "flex flex-wrap gap-1 text-xs" >
138+ < div className = "inline-flex items-center gap-1 bg-background px-2 py-0.5 rounded border" >
139+ < span className = "text-muted-foreground" > Base:</ span >
140+ < span className = "font-mono" > { baseBranch } </ span >
141+ </ div >
142+ { featureBranch && (
143+ < div className = "inline-flex items-center gap-1 bg-blue-50 dark:bg-blue-950 px-2 py-0.5 rounded border border-blue-200 dark:border-blue-800" >
144+ < span className = "text-blue-700 dark:text-blue-300" > Feature:</ span >
145+ < span className = "font-mono text-blue-900 dark:text-blue-100" > { featureBranch } </ span >
146+ </ div >
147+ ) }
148+ { hasSync && (
149+ < div className = "inline-flex items-center gap-1 bg-green-50 dark:bg-green-950 px-2 py-0.5 rounded border border-green-200 dark:border-green-800" >
150+ < GitMerge className = "h-3 w-3 text-green-600 dark:text-green-400" />
151+ < span className = "text-green-700 dark:text-green-300" >
152+ { repo . sync ?. url . split ( '/' ) . pop ( ) ?. replace ( '.git' , '' ) }
153+ </ span >
154+ </ div >
155+ ) }
156+ </ div >
157+ </ div >
158+ < Button
159+ variant = "ghost"
160+ size = "sm"
161+ className = "h-7 w-7 p-0 flex-shrink-0"
162+ onClick = { ( ) => handleRemoveRepo ( repoName ) }
163+ disabled = { isRemoving }
164+ >
165+ { isRemoving ? (
166+ < Loader2 className = "h-3 w-3 animate-spin" />
167+ ) : (
168+ < X className = "h-3 w-3" />
169+ ) }
170+ </ Button >
107171 </ div >
108- < Button
109- variant = "ghost"
110- size = "sm"
111- className = "h-7 w-7 p-0 flex-shrink-0"
112- onClick = { ( ) => handleRemoveRepo ( repoName ) }
113- disabled = { isRemoving }
114- >
115- { isRemoving ? (
116- < Loader2 className = "h-3 w-3 animate-spin" />
117- ) : (
118- < X className = "h-3 w-3" />
119- ) }
120- </ Button >
121172 </ div >
122173 ) ;
123174 } ) }
@@ -166,4 +217,3 @@ export function RepositoriesAccordion({
166217 </ AccordionItem >
167218 ) ;
168219}
169-
0 commit comments