@@ -10,6 +10,8 @@ import Section from '../components/Section'
10
10
11
11
import { GET_PROJECT } from '../operations/queries/ProjectQueries'
12
12
13
+ import { getHandle , selectCurrencyInformation } from '../scripts/selectors'
14
+
13
15
const ProjectDetailPage = ( props ) => {
14
16
15
17
const { projectId } = useParams ( )
@@ -31,6 +33,9 @@ const ProjectDetailPage = (props) => {
31
33
32
34
const project = dataProject . getProjectById
33
35
36
+ console . log ( 'project' )
37
+ console . log ( project )
38
+
34
39
const renderContributors = ( contributors ) => {
35
40
return contributors . map ( contributor => {
36
41
return (
@@ -46,6 +51,37 @@ const ProjectDetailPage = (props) => {
46
51
} )
47
52
}
48
53
54
+ const renderPayments = ( payments ) => {
55
+ return payments . map ( payment => {
56
+ return (
57
+ < div className = 'payment bg-white-light rounded-lg p-4 grid grid-flow-row auto-rows-max' >
58
+ < div className = 'flex grid grid-cols-2 gap-4 ' >
59
+ < div className = 'text-left' >
60
+ { payment . contributor &&
61
+ < >
62
+ < p className = 'text-xl font-bold' >
63
+ { payment . contributor . name }
64
+ </ p >
65
+ < p >
66
+ { `@${ getHandle ( payment . contributor . github_handle ) } ` }
67
+ </ p >
68
+ </ >
69
+ }
70
+ </ div >
71
+ < div >
72
+ < p className = 'text-xl font-bold text-right' >
73
+ { `${ selectCurrencyInformation ( { currency : payment . currency } ) . symbol } ${ payment . amount } ` }
74
+ </ p >
75
+ </ div >
76
+ </ div >
77
+ < button type = 'button' className = 'text-right w-fit ml-auto' onClick = { ( ) => history . push ( `/payments/edit/${ payment . id } ` ) } >
78
+ < Icon className = 'fas fa-pen text-grey' fontSize = 'small' />
79
+ </ button >
80
+ </ div >
81
+ )
82
+ } )
83
+ }
84
+
49
85
return (
50
86
< div className = 'ProjectDetailPage mb-10' >
51
87
< button type = 'button' className = 'w-fit' onClick = { ( ) => history . push ( '/dashboard' ) } >
@@ -140,7 +176,7 @@ const ProjectDetailPage = (props) => {
140
176
</ div >
141
177
</ Section >
142
178
< Section >
143
- < p className = 'font-bold text-xl mb-4 ' >
179
+ < p className = 'font-bold text-xl mb-2 ' >
144
180
Issues
145
181
</ p >
146
182
< div className = 'rounded-lg bg-white-light p-4' >
@@ -184,6 +220,14 @@ const ProjectDetailPage = (props) => {
184
220
</ div >
185
221
</ Section >
186
222
< OpenInGithubButton url = { `${ project . github_url } /pulls` } />
223
+ < Section >
224
+ < p className = 'font-bold text-xl mb-2' >
225
+ Payments
226
+ </ p >
227
+ < div className = 'grid gap-4' >
228
+ { renderPayments ( project . payments ) }
229
+ </ div >
230
+ </ Section >
187
231
< CreatePaymentFloatingBadge projectId = { projectId } />
188
232
</ div >
189
233
)
0 commit comments