@@ -10,7 +10,7 @@ import {
10
10
useReactTable ,
11
11
} from "@tanstack/react-table" ;
12
12
13
- import { format } from ' date-fns' ;
13
+ import { format } from " date-fns" ;
14
14
15
15
import { Button } from "@/components/ui/button" ;
16
16
import {
@@ -31,11 +31,17 @@ import VerificationSymbol from "@/app/common/VerificationSymbol";
31
31
const Cell = ( {
32
32
className,
33
33
children,
34
+ tooltipText,
34
35
} : {
35
36
className ?: string ;
36
37
children : React . ReactNode ;
38
+ tooltipText ?: string ;
37
39
} ) => {
38
- return < div className = { cn ( "text-center" , className ) } > { children } </ div > ;
40
+ return (
41
+ < div className = { cn ( "text-center" , className ) } title = { tooltipText } >
42
+ { children }
43
+ </ div >
44
+ ) ;
39
45
} ;
40
46
41
47
export const columns : ColumnDef < TCombinedSession > [ ] = [
@@ -47,7 +53,7 @@ export const columns: ColumnDef<TCombinedSession>[] = [
47
53
const peerData = await getUser ( peer ) ;
48
54
49
55
return (
50
- < Cell className = "capitalize" >
56
+ < Cell className = "capitalize" tooltipText = { peerData . data . username } >
51
57
< Link
52
58
className = "group text-center p-2 rounded-xl hover:bg-white hover:text-primary-900 underline"
53
59
href = { `/user/${ peerData . data . username } ` }
@@ -62,32 +68,38 @@ export const columns: ColumnDef<TCombinedSession>[] = [
62
68
{
63
69
accessorKey : "title" ,
64
70
header : ( ) => < Cell > Question Name</ Cell > ,
65
- cell : ( { row } ) => < Cell > { row . getValue ( "title" ) } </ Cell > ,
71
+ cell : ( { row } ) => {
72
+ const title : string = row . getValue ( "title" ) ;
73
+
74
+ return < Cell tooltipText = { title } > { title } </ Cell > ;
75
+ } ,
66
76
} ,
67
77
{
68
78
accessorKey : "language" ,
69
79
header : ( ) => < Cell > Matched Language</ Cell > ,
70
80
cell : ( { row } ) => {
71
81
const language = row . getValue ( "language" ) as string ;
72
- return (
73
- < Cell > { language . charAt ( 0 ) . toUpperCase ( ) + language . slice ( 1 ) } </ Cell >
74
- ) ;
82
+ const languageFormatted =
83
+ language . charAt ( 0 ) . toUpperCase ( ) + language . slice ( 1 ) ;
84
+ return < Cell tooltipText = { languageFormatted } > { languageFormatted } </ Cell > ;
75
85
} ,
76
86
} ,
77
87
{
78
88
accessorKey : "complexity" ,
79
89
header : ( ) => < Cell > Complexity</ Cell > ,
80
90
cell : ( { row } ) => {
81
- return < Cell > { row . getValue ( "complexity" ) } </ Cell > ;
91
+ const complexity : string = row . getValue ( "complexity" ) ;
92
+ return < Cell tooltipText = { complexity } > { complexity } </ Cell > ;
82
93
} ,
83
94
} ,
84
95
{
85
96
accessorKey : "category" ,
86
97
header : ( ) => < Cell > Category</ Cell > ,
87
98
cell : ( { row } ) => {
88
99
const categories : string [ ] = row . getValue ( "category" ) ;
100
+ const combinedCategories : string = categories . join ( ", " ) ;
89
101
return (
90
- < Cell >
102
+ < Cell tooltipText = { combinedCategories } >
91
103
{ categories . slice ( 0 , 3 ) . join ( ", " ) }
92
104
{ categories . length > 3 ? "..." : "" }
93
105
</ Cell >
@@ -101,8 +113,8 @@ export const columns: ColumnDef<TCombinedSession>[] = [
101
113
const date : Date = row . getValue ( "createdAt" ) ;
102
114
103
115
return (
104
- < Cell >
105
- { format ( date , ' dd-MM-yyyy HH:mm:ss' ) }
116
+ < Cell tooltipText = { format ( date , "dd-MM-yyyy HH:mm:ss" ) } >
117
+ { format ( date , " dd-MM-yyyy HH:mm:ss" ) }
106
118
</ Cell >
107
119
) ;
108
120
} ,
@@ -214,9 +226,11 @@ export function DashboardDataTable({ data }: { data: TCombinedSession[] }) {
214
226
Prev
215
227
</ Button >
216
228
< div >
217
- Page { table . getPageCount ( ) == 0 ? 0 : table . getState ( ) . pagination . pageIndex + 1 }
218
- /
219
- { table . getPageCount ( ) }
229
+ Page{ " " }
230
+ { table . getPageCount ( ) == 0
231
+ ? 0
232
+ : table . getState ( ) . pagination . pageIndex + 1 }
233
+ /{ table . getPageCount ( ) }
220
234
</ div >
221
235
< Button
222
236
variant = "outline"
0 commit comments