1
1
import { DateTime } from 'luxon' ;
2
2
import Gravatar from 'react-gravatar' ;
3
3
import { RouteComponentProps } from 'react-router-dom' ;
4
+ import { useBenchmarksForUser } from '../hooks/benchmark' ;
4
5
import { useUser } from '../hooks/users' ;
6
+ import benchmarkModel from './Benchmarks/BenchmarkModel' ;
7
+ import BenchmarkRow from './Benchmarks/BenchmarkRow' ;
5
8
import Header from './Page/Header' ;
6
9
import Page from './Page/Page' ;
7
10
@@ -17,6 +20,14 @@ const User = ({ match }: RouteComponentProps<UserParams>) => {
17
20
error,
18
21
} = useUser ( match . params . id ) ;
19
22
23
+ let benchmarks : benchmarkModel [ ] = [ ] ;
24
+ const {
25
+ isLoading : isBenchmarksLoading ,
26
+ isError : isBenchmarksError ,
27
+ data : benchmarksData ,
28
+ error : benchmarksError ,
29
+ } = useBenchmarksForUser ( match . params . id ) ;
30
+
20
31
if ( isProfileLoading ) {
21
32
return < span > Loading....</ span > ;
22
33
}
@@ -26,6 +37,11 @@ const User = ({ match }: RouteComponentProps<UserParams>) => {
26
37
return < span > Error: { error . message } </ span > ;
27
38
}
28
39
}
40
+
41
+ if ( benchmarksData ) {
42
+ benchmarks = benchmarksData ;
43
+ }
44
+
29
45
return (
30
46
< Page >
31
47
< Header title = "Profile" />
@@ -83,7 +99,7 @@ const User = ({ match }: RouteComponentProps<UserParams>) => {
83
99
84
100
{ /* <!-- Experience and education --> */ }
85
101
< div className = "bg-white p-3 shadow-sm rounded-sm" >
86
- < div className = "grid grid-cols-2 " >
102
+ < div className = "grid grid-cols-1 " >
87
103
< div >
88
104
< div className = "flex items-center space-x-2 font-semibold text-gray-900 leading-8 mb-3" >
89
105
< span className = "text-green-500" >
@@ -95,49 +111,64 @@ const User = ({ match }: RouteComponentProps<UserParams>) => {
95
111
stroke = "currentColor"
96
112
>
97
113
< path
98
- stroke-linecap = "round"
99
- stroke-linejoin = "round"
100
- stroke-width = "2"
114
+ strokeLinecap = "round"
115
+ strokeLinejoin = "round"
116
+ strokeWidth = "2"
101
117
d = "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
102
118
/>
103
119
</ svg >
104
120
</ span >
105
- < span className = "tracking-wide" > Experience</ span >
121
+ < span className = "tracking-wide" >
122
+ Published benchmarks
123
+ </ span >
106
124
</ div >
107
- < ul className = "list-inside space-y-2" >
108
- < li >
109
- < div className = "text-teal-600" >
110
- Owner at Her Company Inc.
111
- </ div >
112
- < div className = "text-gray-500 text-xs" >
113
- March 2020 - Now
125
+ < div className = "-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8" >
126
+ < div className = "py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8" >
127
+ < div className = "shadow overflow-hidden border-b border-gray-200 sm:rounded-lg" >
128
+ < table className = "min-w-full divide-y divide-gray-200" >
129
+ < thead className = "bg-gray-50 dark:bg-gray-800" >
130
+ < tr >
131
+ < th
132
+ scope = "col"
133
+ className = "dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
134
+ >
135
+ Title
136
+ </ th >
137
+ < th
138
+ scope = "col"
139
+ className = "dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
140
+ >
141
+ Subject
142
+ </ th >
143
+ < th
144
+ scope = "col"
145
+ className = "dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
146
+ >
147
+ Difficulty
148
+ </ th >
149
+ < th
150
+ scope = "col"
151
+ className = "dark:text-gray-100 px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
152
+ >
153
+ Creator
154
+ </ th >
155
+ < th scope = "col" className = "relative px-6 py-3" >
156
+ < span className = "sr-only" > View</ span >
157
+ </ th >
158
+ </ tr >
159
+ </ thead >
160
+ < tbody className = "bg-white dark:bg-gray-300 divide-y divide-gray-200" >
161
+ { benchmarks . map ( ( benchmark : benchmarkModel ) => (
162
+ < BenchmarkRow
163
+ key = { benchmark . id ?. toString ( ) }
164
+ benchmark = { benchmark }
165
+ />
166
+ ) ) }
167
+ </ tbody >
168
+ </ table >
114
169
</ div >
115
- </ li >
116
- < li >
117
- < div className = "text-teal-600" >
118
- Owner at Her Company Inc.
119
- </ div >
120
- < div className = "text-gray-500 text-xs" >
121
- March 2020 - Now
122
- </ div >
123
- </ li >
124
- < li >
125
- < div className = "text-teal-600" >
126
- Owner at Her Company Inc.
127
- </ div >
128
- < div className = "text-gray-500 text-xs" >
129
- March 2020 - Now
130
- </ div >
131
- </ li >
132
- < li >
133
- < div className = "text-teal-600" >
134
- Owner at Her Company Inc.
135
- </ div >
136
- < div className = "text-gray-500 text-xs" >
137
- March 2020 - Now
138
- </ div >
139
- </ li >
140
- </ ul >
170
+ </ div >
171
+ </ div >
141
172
</ div >
142
173
</ div >
143
174
{ /* <!-- End of Experience and education grid --> */ }
0 commit comments