@@ -13,14 +13,20 @@ import {
13
13
import { CopilotOpportunity } from '../../models/CopilotOpportunity'
14
14
import { copilotRoutesMap } from '../../copilots.routes'
15
15
import { CopilotOpportunitiesResponse , useCopilotOpportunities } from '../../services/copilot-opportunities'
16
+ import { ProjectTypeLabels } from '../../constants'
16
17
17
18
import styles from './styles.module.scss'
18
19
19
20
const tableColumns : TableColumn < CopilotOpportunity > [ ] = [
20
21
{
21
22
label : 'Title' ,
22
23
propertyName : 'projectName' ,
23
- type : 'text' ,
24
+ renderer : ( copilotOpportunity : CopilotOpportunity ) => (
25
+ < div className = { styles . title } >
26
+ { copilotOpportunity . projectName }
27
+ </ div >
28
+ ) ,
29
+ type : 'element' ,
24
30
} ,
25
31
{
26
32
label : 'Status' ,
@@ -33,23 +39,43 @@ const tableColumns: TableColumn<CopilotOpportunity>[] = [
33
39
type : 'element' ,
34
40
} ,
35
41
{
42
+ isSortable : false ,
36
43
label : 'Skills Required' ,
37
44
propertyName : 'skills' ,
38
- renderer : ( copilotOpportunity : CopilotOpportunity ) => (
39
- < div className = { styles . skillsContainer } >
40
- { copilotOpportunity . skills . map ( ( skill : any ) => (
41
- < div key = { skill . id } className = { styles . skillPill } >
42
- { skill . name }
43
- </ div >
44
- ) ) }
45
- </ div >
46
- ) ,
45
+ renderer : ( copilotOpportunity : CopilotOpportunity ) => {
46
+ const visibleSkills = copilotOpportunity . skills . slice ( 0 , 3 )
47
+ const remainingSkills = copilotOpportunity . skills . slice ( 3 )
48
+ return (
49
+ < div className = { styles . skillsContainer } >
50
+ { visibleSkills . map ( ( skill : { id : string | number ; name : string } ) => (
51
+ < div key = { skill . id } className = { styles . skillPill } >
52
+ { skill . name }
53
+ </ div >
54
+ ) ) }
55
+ { remainingSkills . length > 0 && (
56
+ < div
57
+ className = { styles . skillPill }
58
+ title = { remainingSkills . map ( skill => skill . name )
59
+ . join ( ', ' ) }
60
+ >
61
+ +
62
+ { remainingSkills . length }
63
+ </ div >
64
+ ) }
65
+ </ div >
66
+ )
67
+ } ,
47
68
type : 'element' ,
48
69
} ,
49
70
{
50
71
label : 'Type' ,
51
72
propertyName : 'type' ,
52
- type : 'text' ,
73
+ renderer : ( copilotOpportunity : CopilotOpportunity ) => (
74
+ < div className = { styles . type } >
75
+ { ProjectTypeLabels [ copilotOpportunity . projectType ] }
76
+ </ div >
77
+ ) ,
78
+ type : 'element' ,
53
79
} ,
54
80
{
55
81
label : 'Starting Date' ,
@@ -62,7 +88,7 @@ const tableColumns: TableColumn<CopilotOpportunity>[] = [
62
88
type : 'text' ,
63
89
} ,
64
90
{
65
- label : 'Hours per week needed ' ,
91
+ label : 'Hours/Week ' ,
66
92
propertyName : 'numHoursPerWeek' ,
67
93
type : 'number' ,
68
94
} ,
@@ -80,7 +106,10 @@ const CopilotOpportunityList: FC<{}> = () => {
80
106
data : opportunities , isValidating, size, setSize,
81
107
} : CopilotOpportunitiesResponse = useCopilotOpportunities ( )
82
108
83
- const tableData = useMemo ( ( ) => opportunities , [ opportunities ] )
109
+ const tableData = useMemo ( ( ) => opportunities . map ( opportunity => ( {
110
+ ...opportunity ,
111
+ type : ProjectTypeLabels [ opportunity . projectType ] ?? '' ,
112
+ } ) ) , [ opportunities ] )
84
113
85
114
function loadMore ( ) : void {
86
115
setSize ( size + 1 )
@@ -103,6 +132,7 @@ const CopilotOpportunityList: FC<{}> = () => {
103
132
moreToLoad = { isValidating || opportunities . length > 0 }
104
133
onLoadMoreClick = { loadMore }
105
134
onRowClick = { handleRowClick }
135
+ removeDefaultSort
106
136
/>
107
137
{ opportunitiesLoading && (
108
138
< LoadingSpinner overlay />
0 commit comments