Skip to content

Commit 2a03f4f

Browse files
committed
splits the commit-based data into separate headers and cells, with sorting
1 parent 099c221 commit 2a03f4f

File tree

2 files changed

+74
-95
lines changed

2 files changed

+74
-95
lines changed

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

+49-60
Original file line numberDiff line numberDiff line change
@@ -201,71 +201,60 @@ export const PullRequestsTable: FC<
201201
<TableCell sx={{ p: CELL_PAD }}>
202202
<PrMetaCell pr={pr} />
203203
</TableCell>
204-
<TableCell sx={{ p: CELL_PAD }}>
205-
<Box width="100%" display="flex" alignItems="center">
206-
<LightTooltip arrow title={<PrChangesTooltip pr={pr} />}>
204+
{enabledColumnsSet?.has('commits') && (
205+
<TableCell sx={{ p: CELL_PAD }}>
206+
{enabledColumnsSet?.has('commits') && (
207207
<Box
208208
display="flex"
209+
flex={1}
210+
gap={1}
209211
alignItems="center"
210-
bgcolor={theme.colors.secondary.lighter}
211-
borderRadius={1}
212-
overflow="hidden"
213-
maxWidth="220px"
214-
gap={2}
215-
py={1 / 2}
216-
px={1}
212+
color={alpha(theme.colors.secondary.main, 0.8)}
217213
>
218-
{enabledColumnsSet?.has('commits') && (
219-
<Box
220-
display="flex"
221-
flex={1}
222-
gap={1}
223-
alignItems="center"
224-
justifyContent="flex-start"
225-
color={alpha(theme.colors.secondary.main, 0.8)}
226-
>
227-
<IoGitCommit />
228-
<Box fontWeight={600}>{pr.commits}</Box>
229-
</Box>
230-
)}
231-
{enabledColumnsSet?.has('lines_changed') && (
232-
<Box
233-
display="flex"
234-
flex={1}
235-
gap={1}
236-
alignItems="center"
237-
justifyContent="center"
238-
color={
239-
pr.additions + pr.deletions
240-
? 'warning.main'
241-
: 'secondary.light'
242-
}
243-
>
244-
<VscRequestChanges />
245-
<Box fontWeight={600}>
246-
{pr.additions + pr.deletions}
247-
</Box>
248-
</Box>
249-
)}
250-
{enabledColumnsSet?.has('comments') && (
251-
<Box
252-
display="flex"
253-
flex={1}
254-
gap={1}
255-
alignItems="center"
256-
justifyContent="flex-end"
257-
color={
258-
pr.comments ? 'info.main' : 'secondary.light'
259-
}
260-
>
261-
<GoCommentDiscussion />
262-
<Box fontWeight={600}>{pr.comments}</Box>
263-
</Box>
264-
)}
214+
<IoGitCommit />
215+
<Box fontWeight={600}>{pr.commits}</Box>
265216
</Box>
266-
</LightTooltip>
267-
</Box>
268-
</TableCell>
217+
)}
218+
</TableCell>
219+
)}
220+
{enabledColumnsSet?.has('lines_changed') && (
221+
<TableCell sx={{ p: CELL_PAD }}>
222+
{
223+
<Box
224+
display="flex"
225+
flex={1}
226+
gap={1}
227+
alignItems="center"
228+
color={
229+
pr.additions + pr.deletions
230+
? 'warning.main'
231+
: 'secondary.light'
232+
}
233+
>
234+
<VscRequestChanges />
235+
<Box fontWeight={600}>
236+
{pr.additions + pr.deletions}
237+
</Box>
238+
</Box>
239+
}
240+
</TableCell>
241+
)}
242+
{enabledColumnsSet?.has('comments') && (
243+
<TableCell sx={{ p: CELL_PAD }}>
244+
{
245+
<Box
246+
display="flex"
247+
flex={1}
248+
gap={1}
249+
alignItems="center"
250+
color={pr.comments ? 'info.main' : 'secondary.light'}
251+
>
252+
<GoCommentDiscussion />
253+
<Box fontWeight={600}>{pr.comments}</Box>
254+
</Box>
255+
}
256+
</TableCell>
257+
)}
269258
{enabledColumnsSet.has('base_branch') && (
270259
<TableCell sx={{ p: CELL_PAD }}>{pr.base_branch}</TableCell>
271260
)}

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

+25-35
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { ScheduleRounded } from '@mui/icons-material';
22
import {
3-
Box,
43
Checkbox,
54
TableCell,
65
TableHead,
@@ -95,46 +94,37 @@ export const PullRequestsTableHead: FC<PullRequestsTableHeadProps> = ({
9594
Pull Request
9695
</TableSortLabel>
9796
</TableCell>
98-
<TableCell sx={{ p: CELL_PAD, py: 1.5 }}>
97+
98+
<TableCell sx={{ minWidth: '40%', p: CELL_PAD, py: 1.5 }}>
9999
<TableSortLabel
100100
direction={conf.field === 'commits' ? conf.order : 'asc'}
101101
active={conf.field === 'commits'}
102-
onClick={() => {
103-
if (enabledColumnsSet?.has('commits')) {
104-
return updateSortConf('commits');
105-
}
106-
if (enabledColumnsSet?.has('lines_changed')) {
107-
return updateSortConf('additions');
108-
}
109-
if (enabledColumnsSet?.has('comments')) {
110-
return updateSortConf('comments');
111-
}
112-
}}
102+
onClick={() => updateSortConf('commits')}
113103
>
114-
<Box
115-
display="flex"
116-
gap={1}
117-
alignItems="center"
118-
justifyContent="center"
119-
>
120-
{enabledColumnsSet?.has('commits') && (
121-
<>
122-
<Box color="secondary.main">Commits</Box>
123-
<Box>/</Box>
124-
</>
125-
)}
126-
{enabledColumnsSet?.has('lines_changed') && (
127-
<>
128-
<Box color="warning.main">Lines</Box>
129-
<Box>/</Box>
130-
</>
131-
)}
132-
{enabledColumnsSet?.has('comments') && (
133-
<Box color="info.main">Comments</Box>
134-
)}
135-
</Box>
104+
Commits
136105
</TableSortLabel>
137106
</TableCell>
107+
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>
117+
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>
127+
138128
{enabledColumnsSet.has('base_branch') && (
139129
<TableCell
140130
align="center"

0 commit comments

Comments
 (0)