Skip to content

Commit deec257

Browse files
authored
Merge pull request #586 from sahitya-chandra/LT-table-fields-swap
Response and Commit to open fields position swaped in LT table
2 parents 55e6bef + 68a8b7f commit deec257

File tree

1 file changed

+44
-38
lines changed

1 file changed

+44
-38
lines changed

web-server/src/components/PRTable/PullRequestsTableHead.tsx

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const PullRequestsTableHead: FC<PullRequestsTableHeadProps> = ({
6767
<Checkbox
6868
checked={allPrsSelected}
6969
indeterminate={somePrsSelected}
70-
onChange={(e) => {
70+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
7171
const isChecked = e.target.checked;
7272
if (isChecked && noPrsSelected) {
7373
selectedPrIds.set(prs.map((pr) => pr.id));
@@ -95,35 +95,41 @@ export const PullRequestsTableHead: FC<PullRequestsTableHeadProps> = ({
9595
</TableSortLabel>
9696
</TableCell>
9797

98-
<TableCell sx={{ minWidth: '40%', p: CELL_PAD, py: 1.5 }}>
99-
<TableSortLabel
100-
direction={conf.field === 'commits' ? conf.order : 'asc'}
101-
active={conf.field === 'commits'}
102-
onClick={() => updateSortConf('commits')}
103-
>
104-
Commits
105-
</TableSortLabel>
106-
</TableCell>
98+
{enabledColumnsSet.has('commits') && (
99+
<TableCell sx={{ minWidth: '40%', p: CELL_PAD, py: 1.5 }}>
100+
<TableSortLabel
101+
direction={conf.field === 'commits' ? conf.order : 'asc'}
102+
active={conf.field === 'commits'}
103+
onClick={() => updateSortConf('commits')}
104+
>
105+
Commits
106+
</TableSortLabel>
107+
</TableCell>
108+
)}
107109

108-
<TableCell sx={{ minWidth: '40%', p: CELL_PAD, py: 1.5 }}>
109-
<TableSortLabel
110-
direction={conf.field === 'additions' ? conf.order : 'asc'}
111-
active={conf.field === 'additions'}
112-
onClick={() => updateSortConf('additions')}
113-
>
114-
Lines
115-
</TableSortLabel>
116-
</TableCell>
110+
{enabledColumnsSet.has('lines_changed') && (
111+
<TableCell sx={{ minWidth: '40%', p: CELL_PAD, py: 1.5 }}>
112+
<TableSortLabel
113+
direction={conf.field === 'additions' ? conf.order : 'asc'}
114+
active={conf.field === 'additions'}
115+
onClick={() => updateSortConf('additions')}
116+
>
117+
Lines
118+
</TableSortLabel>
119+
</TableCell>
120+
)}
117121

118-
<TableCell sx={{ minWidth: '40%', p: CELL_PAD, py: 1.5 }}>
119-
<TableSortLabel
120-
direction={conf.field === 'comments' ? conf.order : 'asc'}
121-
active={conf.field === 'comments'}
122-
onClick={() => updateSortConf('comments')}
123-
>
124-
Comments
125-
</TableSortLabel>
126-
</TableCell>
122+
{enabledColumnsSet.has('comments') && (
123+
<TableCell sx={{ minWidth: '40%', p: CELL_PAD, py: 1.5 }}>
124+
<TableSortLabel
125+
direction={conf.field === 'comments' ? conf.order : 'asc'}
126+
active={conf.field === 'comments'}
127+
onClick={() => updateSortConf('comments')}
128+
>
129+
Comments
130+
</TableSortLabel>
131+
</TableCell>
132+
)}
127133

128134
{enabledColumnsSet.has('base_branch') && (
129135
<TableCell
@@ -197,29 +203,29 @@ export const PullRequestsTableHead: FC<PullRequestsTableHeadProps> = ({
197203
</TableSortLabel>
198204
</TableCell>
199205
)}
200-
{enabledColumnsSet.has('first_response_time') && (
206+
{enabledColumnsSet.has('first_commit_to_open') && (
201207
<TableCell align="center" sx={{ p: CELL_PAD, py: 1.5 }}>
202208
<TableSortLabel
203209
direction={
204-
conf.field === 'first_response_time' ? conf.order : 'asc'
210+
conf.field === 'first_commit_to_open' ? conf.order : 'asc'
205211
}
206-
active={conf.field === 'first_response_time'}
207-
onClick={() => updateSortConf('first_response_time')}
212+
active={conf.field === 'first_commit_to_open'}
213+
onClick={() => updateSortConf('first_commit_to_open')}
208214
>
209-
Response <ClockIcon />
215+
Commit to Open <ClockIcon />
210216
</TableSortLabel>
211217
</TableCell>
212218
)}
213-
{enabledColumnsSet.has('first_commit_to_open') && (
219+
{enabledColumnsSet.has('first_response_time') && (
214220
<TableCell align="center" sx={{ p: CELL_PAD, py: 1.5 }}>
215221
<TableSortLabel
216222
direction={
217-
conf.field === 'first_commit_to_open' ? conf.order : 'asc'
223+
conf.field === 'first_response_time' ? conf.order : 'asc'
218224
}
219-
active={conf.field === 'first_commit_to_open'}
220-
onClick={() => updateSortConf('first_commit_to_open')}
225+
active={conf.field === 'first_response_time'}
226+
onClick={() => updateSortConf('first_response_time')}
221227
>
222-
Commit to Open <ClockIcon />
228+
Response <ClockIcon />
223229
</TableSortLabel>
224230
</TableCell>
225231
)}

0 commit comments

Comments
 (0)