1- import type { ColumnDef } from '@tanstack/react-table' ;
1+ import type { CellContext , ColumnDef } from '@tanstack/react-table' ;
22
33import type { JSX } from 'react' ;
44
@@ -22,12 +22,43 @@ import {
2222} from '@/components/Table/DetailsColumn' ;
2323import { UNKNOWN_STRING } from '@/utils/constants/backend' ;
2424
25+ const INDENT_WIDTH = 20 ;
26+
27+ const PathCell = ( {
28+ row,
29+ getValue,
30+ } : CellContext < TPathTests , unknown > ) : JSX . Element => {
31+ const value = getValue ( ) as string ;
32+ const depth = row . depth ;
33+ const indent = depth * INDENT_WIDTH ;
34+
35+ const hasSubGroups =
36+ row . original . sub_groups !== undefined && row . original . sub_groups . length > 0 ;
37+ const hasIndividualTests = row . original . individual_tests . length > 0 ;
38+ const isExpandable = hasSubGroups || hasIndividualTests ;
39+
40+ return (
41+ < div className = "flex items-center" style = { { paddingLeft : `${ indent } px` } } >
42+ { isExpandable && (
43+ < span className = "mr-2" >
44+ < ChevronRightAnimate
45+ isExpanded = { row . getIsExpanded ( ) }
46+ animated = { false }
47+ />
48+ </ span >
49+ ) }
50+ < span > { value } </ span >
51+ </ div >
52+ ) ;
53+ } ;
54+
2555export const defaultColumns : ColumnDef < TPathTests > [ ] = [
2656 {
2757 accessorKey : 'path_group' ,
2858 header : ( { column } ) : JSX . Element => (
2959 < TableHeader column = { column } intlKey = "global.path" />
3060 ) ,
61+ cell : PathCell ,
3162 } ,
3263 {
3364 accessorKey : 'pass_tests' ,
@@ -52,10 +83,6 @@ export const defaultColumns: ColumnDef<TPathTests>[] = [
5283 ) ;
5384 } ,
5485 } ,
55- {
56- id : 'chevron' ,
57- cell : ( ) : JSX . Element => < ChevronRightAnimate /> ,
58- } ,
5986] ;
6087
6188export const defaultInnerColumns : ColumnDef < TIndividualTest > [ ] = [
0 commit comments