@@ -14,7 +14,7 @@ import { Input } from "@/components/ui/input"
1414import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "@/components/ui/select"
1515import { Table , TableBody , TableCell , TableHead , TableHeader , TableRow } from "@/components/ui/table"
1616import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants"
17- import { CodeHostType , getCodeHostCommitUrl , getCodeHostInfoForRepo , getFormattedDate , getRepoImageSrc } from "@/lib/utils"
17+ import { CodeHostType , getCodeHostCommitUrl , getCodeHostInfoForRepo , getRepoImageSrc } from "@/lib/utils"
1818import {
1919 type ColumnDef ,
2020 type ColumnFiltersState ,
@@ -81,14 +81,10 @@ const getStatusBadge = (status: Repo["latestJobStatus"]) => {
8181 return < Badge className = { statusBadgeVariants ( { status } ) } > { labels [ status ] } </ Badge >
8282}
8383
84- const formatDate = ( date : Date | null ) => {
85- if ( ! date ) return "Never"
86- return getFormattedDate ( date ) ;
87- }
88-
8984export const columns : ColumnDef < Repo > [ ] = [
9085 {
9186 accessorKey : "displayName" ,
87+ size : 400 ,
9288 header : ( { column } ) => {
9389 return (
9490 < Button variant = "ghost" onClick = { ( ) => column . toggleSorting ( column . getIsSorted ( ) === "asc" ) } >
@@ -128,11 +124,13 @@ export const columns: ColumnDef<Repo>[] = [
128124 } ,
129125 {
130126 accessorKey : "latestJobStatus" ,
127+ size : 150 ,
131128 header : "Lastest status" ,
132129 cell : ( { row } ) => getStatusBadge ( row . getValue ( "latestJobStatus" ) ) ,
133130 } ,
134131 {
135132 accessorKey : "indexedAt" ,
133+ size : 200 ,
136134 header : ( { column } ) => {
137135 return (
138136 < Button
@@ -157,6 +155,7 @@ export const columns: ColumnDef<Repo>[] = [
157155 } ,
158156 {
159157 accessorKey : "indexedCommitHash" ,
158+ size : 120 ,
160159 header : "Last commit" ,
161160 cell : ( { row } ) => {
162161 const hash = row . getValue ( "indexedCommitHash" ) as string | null ;
@@ -189,6 +188,7 @@ export const columns: ColumnDef<Repo>[] = [
189188 } ,
190189 {
191190 id : "actions" ,
191+ size : 80 ,
192192 enableHiding : false ,
193193 cell : ( { row } ) => {
194194 const repo = row . original
@@ -265,6 +265,8 @@ export const ReposTable = ({ data }: { data: Repo[] }) => {
265265 getFilteredRowModel : getFilteredRowModel ( ) ,
266266 onColumnVisibilityChange : setColumnVisibility ,
267267 onRowSelectionChange : setRowSelection ,
268+ columnResizeMode : 'onChange' ,
269+ enableColumnResizing : false ,
268270 state : {
269271 sorting,
270272 columnFilters,
@@ -315,13 +317,16 @@ export const ReposTable = ({ data }: { data: Repo[] }) => {
315317 </ Button >
316318 </ div >
317319 < div className = "rounded-md border" >
318- < Table >
320+ < Table style = { { tableLayout : 'fixed' , width : '100%' } } >
319321 < TableHeader >
320322 { table . getHeaderGroups ( ) . map ( ( headerGroup ) => (
321323 < TableRow key = { headerGroup . id } >
322324 { headerGroup . headers . map ( ( header ) => {
323325 return (
324- < TableHead key = { header . id } >
326+ < TableHead
327+ key = { header . id }
328+ style = { { width : `${ header . getSize ( ) } px` } }
329+ >
325330 { header . isPlaceholder ? null : flexRender ( header . column . columnDef . header , header . getContext ( ) ) }
326331 </ TableHead >
327332 )
@@ -334,7 +339,12 @@ export const ReposTable = ({ data }: { data: Repo[] }) => {
334339 table . getRowModel ( ) . rows . map ( ( row ) => (
335340 < TableRow key = { row . id } data-state = { row . getIsSelected ( ) && "selected" } >
336341 { row . getVisibleCells ( ) . map ( ( cell ) => (
337- < TableCell key = { cell . id } > { flexRender ( cell . column . columnDef . cell , cell . getContext ( ) ) } </ TableCell >
342+ < TableCell
343+ key = { cell . id }
344+ style = { { width : `${ cell . column . getSize ( ) } px` } }
345+ >
346+ { flexRender ( cell . column . columnDef . cell , cell . getContext ( ) ) }
347+ </ TableCell >
338348 ) ) }
339349 </ TableRow >
340350 ) )
0 commit comments