|
2 | 2 |
|
3 | 3 | import { Button } from "@/components/ui/button" |
4 | 4 | import type { ColumnDef } from "@tanstack/react-table" |
5 | | -import { ArrowUpDown, ExternalLink, Clock, Loader2, CheckCircle2, XCircle, Trash2, Check, ListFilter } from "lucide-react" |
| 5 | +import { ArrowUpDown, Clock, Loader2, CheckCircle2, XCircle, Trash2, Check, ListFilter } from "lucide-react" |
6 | 6 | import Image from "next/image" |
7 | 7 | import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" |
8 | 8 | import { cn, getRepoImageSrc } from "@/lib/utils" |
9 | 9 | import { RepoIndexingStatus } from "@sourcebot/db"; |
10 | 10 | import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" |
| 11 | +import Link from "next/link" |
| 12 | +import { getBrowsePath } from "../browse/hooks/useBrowseNavigation" |
11 | 13 |
|
12 | 14 | export type RepositoryColumnInfo = { |
13 | 15 | repoId: number |
14 | | - name: string |
| 16 | + repoName: string; |
| 17 | + repoDisplayName: string |
15 | 18 | imageUrl?: string |
16 | 19 | repoIndexingStatus: RepoIndexingStatus |
17 | 20 | lastIndexed: string |
18 | | - url: string |
19 | 21 | } |
20 | 22 |
|
21 | 23 | const statusLabels = { |
@@ -90,42 +92,38 @@ const StatusIndicator = ({ status }: { status: RepoIndexingStatus }) => { |
90 | 92 |
|
91 | 93 | export const columns = (domain: string): ColumnDef<RepositoryColumnInfo>[] => [ |
92 | 94 | { |
93 | | - accessorKey: "name", |
| 95 | + accessorKey: "repoDisplayName", |
94 | 96 | header: 'Repository', |
95 | | - cell: ({ row }) => { |
96 | | - const repo = row.original |
97 | | - const url = repo.url |
98 | | - const isRemoteRepo = url.length > 0 |
99 | | - |
| 97 | + cell: ({ row: { original: { repoId, repoName, repoDisplayName, imageUrl } } }) => { |
100 | 98 | return ( |
101 | 99 | <div className="flex flex-row items-center gap-3 py-2"> |
102 | 100 | <div className="relative h-8 w-8 overflow-hidden rounded-md border bg-muted"> |
103 | | - {repo.imageUrl ? ( |
| 101 | + {imageUrl ? ( |
104 | 102 | <Image |
105 | | - src={getRepoImageSrc(repo.imageUrl, repo.repoId, domain) || "/placeholder.svg"} |
106 | | - alt={`${repo.name} logo`} |
| 103 | + src={getRepoImageSrc(imageUrl, repoId, domain) || "/placeholder.svg"} |
| 104 | + alt={`${repoDisplayName} logo`} |
107 | 105 | width={32} |
108 | 106 | height={32} |
109 | 107 | className="object-cover" |
110 | 108 | /> |
111 | 109 | ) : ( |
112 | 110 | <div className="flex h-full w-full items-center justify-center bg-muted text-xs font-medium uppercase text-muted-foreground"> |
113 | | - {repo.name.charAt(0)} |
| 111 | + {repoDisplayName.charAt(0)} |
114 | 112 | </div> |
115 | 113 | )} |
116 | 114 | </div> |
117 | 115 | <div className="flex items-center gap-2"> |
118 | | - <span |
119 | | - className={isRemoteRepo ? "font-medium text-primary hover:underline cursor-pointer" : "font-medium"} |
120 | | - onClick={() => { |
121 | | - if (isRemoteRepo) { |
122 | | - window.open(url, "_blank") |
123 | | - } |
124 | | - }} |
| 116 | + <Link |
| 117 | + className={"font-medium text-primary hover:underline cursor-pointer"} |
| 118 | + href={getBrowsePath({ |
| 119 | + repoName: repoName, |
| 120 | + path: '/', |
| 121 | + pathType: 'tree', |
| 122 | + domain |
| 123 | + })} |
125 | 124 | > |
126 | | - {repo.name.length > 40 ? `${repo.name.slice(0, 40)}...` : repo.name} |
127 | | - </span> |
128 | | - {isRemoteRepo && <ExternalLink className="h-3.5 w-3.5 text-muted-foreground" />} |
| 125 | + {repoDisplayName.length > 40 ? `${repoDisplayName.slice(0, 40)}...` : repoDisplayName} |
| 126 | + </Link> |
129 | 127 | </div> |
130 | 128 | </div> |
131 | 129 | ) |
|
0 commit comments