@@ -10,12 +10,15 @@ import { classNames } from "components/organisms/RepositoriesTable/repositories-
10
10
import useContributorPullRequests from "lib/hooks/api/useContributorPullRequests" ;
11
11
import useRepoList from "lib/hooks/useRepoList" ;
12
12
import { useFetchUser } from "lib/hooks/useFetchUser" ;
13
+ import Checkbox from "components/atoms/Checkbox/checkbox" ;
13
14
import { getActivity } from "../RepoRow/repo-row" ;
14
15
import DevProfile from "../DevProfile/dev-profile" ;
15
16
16
17
interface ContributorListTableRow {
17
18
contributor : DbPRContributor ;
18
19
topic : string ;
20
+ selected ?: boolean ;
21
+ handleOnSelectContributor ?: ( state : boolean , contributor : DbPRContributor ) => void ;
19
22
}
20
23
21
24
function getLastContributionDate ( contributions : DbRepoPR [ ] ) {
@@ -39,7 +42,12 @@ function getLastContributedRepo(pullRequests: DbRepoPR[]) {
39
42
40
43
return sortedPullRequests [ 0 ] . full_name ;
41
44
}
42
- const ContributorListTableRow = ( { contributor, topic } : ContributorListTableRow ) => {
45
+ const ContributorListTableRow = ( {
46
+ contributor,
47
+ topic,
48
+ selected,
49
+ handleOnSelectContributor,
50
+ } : ContributorListTableRow ) => {
43
51
const [ tableOpen , setTableOpen ] = useState ( false ) ;
44
52
45
53
const { data : user } = useFetchUser ( contributor . author_login ) ;
@@ -62,9 +70,18 @@ const ContributorListTableRow = ({ contributor, topic }: ContributorListTableRow
62
70
return (
63
71
< >
64
72
{ /* Mobile version */ }
65
- < div className = "px-5 py-2 overflow-hidden odd:bg-white md:hidden even:bg-light-slate-2" >
73
+ < div className = "px-2 py-2 overflow-hidden md:px-5 odd:bg-white md:hidden even:bg-light-slate-2" >
66
74
< div className = "flex items-center gap-x-3 text-light-slate-12" >
67
- < div className = "w-[66%]" >
75
+ { handleOnSelectContributor && (
76
+ < Checkbox
77
+ checked = { selected ? true : false }
78
+ disabled = { ! user }
79
+ title = { ! user ? "Connect to GitHub" : "" }
80
+ onCheckedChange = { ( state ) => handleOnSelectContributor ?.( state as boolean , contributor ) }
81
+ className = { `${ user && "border-orange-500 hover:bg-orange-600" } ` }
82
+ />
83
+ ) }
84
+ < div className = "w-[68%]" >
68
85
< DevProfile company = { user ?. company || getLastContributedRepo ( data ) } username = { contributor . author_login } />
69
86
</ div >
70
87
< div className = "w-[34%] text-normal text-light-slate-11 h-full" >
@@ -121,34 +138,36 @@ const ContributorListTableRow = ({ contributor, topic }: ContributorListTableRow
121
138
{ /* Desktop Version */ }
122
139
123
140
< div className = { `${ classNames . row } !gap-6 text-light-slate-11` } >
124
- { /* <Checkbox
125
- checked={true}
126
- onCheckedChange={() => console.log("yeah")}
127
- disabled={!user}
128
- title={!user ? "Connect to GitHub" : ""}
129
- className={`${user && "border-orange-500 hover:bg-orange-600"}`}
130
- /> */ }
141
+ { handleOnSelectContributor && (
142
+ < Checkbox
143
+ checked = { selected ? true : false }
144
+ disabled = { ! user }
145
+ title = { ! user ? "Connect to GitHub" : "" }
146
+ onCheckedChange = { ( state ) => handleOnSelectContributor ?.( state as boolean , contributor ) }
147
+ className = { `${ user && "border-orange-500 hover:bg-orange-600" } ` }
148
+ />
149
+ ) }
131
150
132
151
{ /* Column: Contributors */ }
133
- < div className = { clsx ( "flex-1 lg:min-w-[250px ] overflow-hidden" ) } >
152
+ < div className = { clsx ( "flex-1 lg:min-w-[12.5rem ] overflow-hidden" ) } >
134
153
< DevProfile company = { user ?. company || getLastContributedRepo ( data ) } username = { contributor . author_login } />
135
154
</ div >
136
155
137
156
{ /* Column: Act */ }
138
- < div className = { clsx ( "flex-1 flex lg:max-w-[100px ] w-fit justify-center" ) } >
157
+ < div className = { clsx ( "flex-1 flex lg:max-w-[6.25rem ] w-fit justify-center" ) } >
139
158
{ getActivity ( totalPrs , false ) }
140
159
</ div >
141
160
142
161
{ /* Column Repositories */ }
143
- < div className = { clsx ( "flex-1 lg:max-w-[100px ] flex justify-center " ) } > { repoList . length } </ div >
162
+ < div className = { clsx ( "flex-1 lg:max-w-[6.25rem ] flex justify-center " ) } > { repoList . length } </ div >
144
163
145
164
{ /* Column: Last Contribution */ }
146
165
< div className = { clsx ( "flex-1 lg:max-w-[130px] flex text-light-slate-11 justify-center " ) } >
147
166
< div className = "flex" > { < p > { getLastContributionDate ( mergedPrs ) } </ p > } </ div >
148
167
</ div >
149
168
150
169
{ /* Column: Language */ }
151
- < div className = { clsx ( "flex-1 hidden lg:max-w-[120px ] justify-center lg:flex" ) } >
170
+ < div className = { clsx ( "flex-1 hidden lg:max-w-[7.5rem ] justify-center lg:flex" ) } >
152
171
{ contributorLanguageList . length > 0 ? (
153
172
< p >
154
173
{ contributorLanguageList [ 0 ] }
@@ -160,16 +179,16 @@ const ContributorListTableRow = ({ contributor, topic }: ContributorListTableRow
160
179
</ div >
161
180
162
181
{ /* Column: Time Zone */ }
163
- < div className = { clsx ( "flex-1 hidden lg:max-w-[80px ] text-light-slate-11 justify-center lg:flex " ) } >
182
+ < div className = { clsx ( "flex-1 hidden lg:max-w-[5rem ] text-light-slate-11 justify-center lg:flex " ) } >
164
183
< div className = "flex gap-x-3" > { user && user . timezone ? < p > { user . timezone } </ p > : "-" } </ div >
165
184
</ div >
166
185
167
186
{ /* Column: Contributions */ }
168
- < div className = { clsx ( "flex-1 hidden justify-center lg:flex lg:max-w-[120px ]" ) } >
187
+ < div className = { clsx ( "flex-1 hidden justify-center lg:flex lg:max-w-[7.5rem ]" ) } >
169
188
< p > { mergedPrs . length } </ p >
170
189
</ div >
171
190
{ /* Column Last 30 Days */ }
172
- < div className = { clsx ( "flex-1 lg:min-w-[150px ] hidden lg:flex justify-center" ) } >
191
+ < div className = { clsx ( "flex-1 lg:min-w-[9.37rem ] hidden lg:flex justify-center" ) } >
173
192
{ last30days ? < Sparkline data = { last30days } width = "100%" height = { 54 } /> : "-" }
174
193
</ div >
175
194
</ div >
0 commit comments