22
33import { Badge } from "@/components/ui/badge"
44import { Button } from "@/components/ui/button"
5- import {
6- DropdownMenu ,
7- DropdownMenuContent ,
8- DropdownMenuItem ,
9- DropdownMenuLabel ,
10- DropdownMenuSeparator ,
11- DropdownMenuTrigger ,
12- } from "@/components/ui/dropdown-menu"
135import { InputGroup , InputGroupAddon , InputGroupInput } from "@/components/ui/input-group"
146import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "@/components/ui/select"
157import { Table , TableBody , TableCell , TableHead , TableHeader , TableRow } from "@/components/ui/table"
168import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants"
17- import { cn , getCodeHostCommitUrl , getCodeHostIcon , getCodeHostInfoForRepo , getRepoImageSrc , isServiceError } from "@/lib/utils"
9+ import { cn , getCodeHostCommitUrl , getCodeHostIcon , getRepoImageSrc , isServiceError } from "@/lib/utils"
1810import {
1911 type ColumnDef ,
2012 type VisibilityState ,
@@ -23,7 +15,7 @@ import {
2315 useReactTable ,
2416} from "@tanstack/react-table"
2517import { cva } from "class-variance-authority"
26- import { ArrowDown , ArrowUp , ArrowUpDown , ExternalLink , Loader2 , MoreHorizontal , RefreshCwIcon } from "lucide-react"
18+ import { ArrowDown , ArrowUp , ArrowUpDown , Loader2 , RefreshCwIcon } from "lucide-react"
2719import Image from "next/image"
2820import Link from "next/link"
2921import { useEffect , useRef , useState } from "react"
@@ -36,6 +28,7 @@ import { NotificationDot } from "../../components/notificationDot"
3628import { CodeHostType } from "@sourcebot/db"
3729import { useHotkeys } from "react-hotkeys-hook"
3830import { indexRepo } from "@/features/workerApi/actions"
31+ import { RepoActionsDropdown } from "./repoActionsDropdown"
3932
4033// @see : https://v0.app/chat/repo-indexing-status-uhjdDim8OUS
4134
@@ -256,47 +249,7 @@ export const getColumns = (context: ColumnsContext): ColumnDef<Repo>[] => [
256249 enableHiding : false ,
257250 cell : ( { row } ) => {
258251 const repo = row . original
259- const codeHostInfo = getCodeHostInfoForRepo ( {
260- codeHostType : repo . codeHostType ,
261- name : repo . name ,
262- displayName : repo . displayName ?? undefined ,
263- webUrl : repo . webUrl ?? undefined ,
264- } ) ;
265- const isSyncing = context . syncingRepoId === repo . id ;
266-
267- return (
268- < DropdownMenu >
269- < DropdownMenuTrigger asChild >
270- < Button variant = "ghost" className = "h-8 w-8 p-0" >
271- < span className = "sr-only" > Open menu</ span >
272- < MoreHorizontal className = "h-4 w-4" />
273- </ Button >
274- </ DropdownMenuTrigger >
275- < DropdownMenuContent align = "end" >
276- < DropdownMenuLabel > Actions</ DropdownMenuLabel >
277- < DropdownMenuItem asChild >
278- < Link href = { `/${ SINGLE_TENANT_ORG_DOMAIN } /repos/${ repo . id } ` } > View details</ Link >
279- </ DropdownMenuItem >
280- { repo . webUrl && (
281- < >
282- < DropdownMenuSeparator />
283- < DropdownMenuItem
284- onClick = { ( ) => context . onTriggerSync ( repo . id ) }
285- disabled = { isSyncing }
286- >
287- Trigger Sync
288- </ DropdownMenuItem >
289- < DropdownMenuItem asChild >
290- < a href = { repo . webUrl } target = "_blank" rel = "noopener noreferrer" className = "flex items-center" >
291- Open in { codeHostInfo . codeHostName }
292- < ExternalLink className = "ml-2 h-3 w-3" />
293- </ a >
294- </ DropdownMenuItem >
295- </ >
296- ) }
297- </ DropdownMenuContent >
298- </ DropdownMenu >
299- )
252+ return < RepoActionsDropdown repo = { repo } />
300253 } ,
301254 } ,
302255]
0 commit comments