Skip to content

Commit 2fb38cb

Browse files
authored
Merge pull request #411 from AppQuality/UN-429-sibling-column
feat(bugs): Add siblings column
2 parents db0a768 + 84172bd commit 2fb38cb

File tree

6 files changed

+43
-6
lines changed

6 files changed

+43
-6
lines changed

src/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"__BUGS_SEARCH_INPUT_PLACEHOLDER": "Search bugs",
7474
"__BUGS_SEVERITY_FILTER_ITEM_NO_ITEMS": "Severity",
7575
"__BUGS_TABLE_BUG_ID_HEADER_COLUMN": "Bug id",
76+
"__BUGS_TABLE_DUPLICATE_HEADER_COLUMN": "Duplicates",
7677
"__BUGS_TABLE_SEVERITY_HEADER_COLUMN": "Severity",
7778
"__BUGS_TABLE_TITLE_HEADER_COLUMN": "Bug",
7879
"__BUGS_TYPES_FILTER_ITEM_NO_ITEMS": "Typology",

src/locales/it/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"__BUGS_SEARCH_INPUT_PLACEHOLDER": "Cerca bug",
7474
"__BUGS_SEVERITY_FILTER_ITEM_NO_ITEMS": "Severity",
7575
"__BUGS_TABLE_BUG_ID_HEADER_COLUMN": "Bug id",
76+
"__BUGS_TABLE_DUPLICATE_HEADER_COLUMN": "Duplicati",
7677
"__BUGS_TABLE_SEVERITY_HEADER_COLUMN": "Severity",
7778
"__BUGS_TABLE_TITLE_HEADER_COLUMN": "Bug",
7879
"__BUGS_TYPES_FILTER_ITEM_NO_ITEMS": "Tipologia",
Lines changed: 4 additions & 0 deletions
Loading

src/pages/Bugs/BugsTable/hooks/useTableColumns.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ export const useTableColumns = () => {
1010
header: t('__BUGS_TABLE_TITLE_HEADER_COLUMN'),
1111
width: 'auto',
1212
},
13+
{
14+
key: 'siblings',
15+
header: t('__BUGS_TABLE_DUPLICATE_HEADER_COLUMN'),
16+
width: '90px',
17+
},
1318
{
1419
key: 'severity',
1520
header: t('__BUGS_TABLE_SEVERITY_HEADER_COLUMN'),

src/pages/Bugs/BugsTable/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface TableDatum {
99
id: string;
1010
bugId: ReactNode;
1111
title: ReactNode;
12+
siblings: number;
1213
severity: ReactNode;
1314
created: string;
1415
updated?: string;

src/pages/Bugs/BugsTable/utils/mapBugsToTableData.tsx

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
import { TFunction } from 'react-i18next';
2-
import { theme } from 'src/app/theme';
2+
import { SM } from '@appquality/unguess-design-system';
3+
import { theme as globalTheme } from 'src/app/theme';
34
import { Pill } from 'src/common/components/pills/Pill';
45
import { SeverityPill } from 'src/common/components/pills/SeverityPill';
56
import { Pipe } from 'src/common/components/Pipe';
67
import { getSelectedBugId } from 'src/features/bugsPage/bugsPageSlice';
7-
import { TableBugType } from '../../types';
8+
import styled from 'styled-components';
89
import { BugTitle } from '../components/BugTitle';
10+
import { TableBugType } from '../../types';
11+
import { ReactComponent as FatherIcon } from '../assets/father-icon.svg';
12+
13+
const DuplicateContainer = styled((props) => <SM isBold {...props} />)`
14+
display: flex;
15+
align-items: center;
16+
justify-content: center;
17+
gap: ${({ theme }) => theme.space.xxs};
18+
line-height: ${({ theme }) => theme.lineHeights.md};
19+
`;
920

1021
export const mapBugsToTableData = (bugs: TableBugType[], t: TFunction) => {
1122
const currentBugId = getSelectedBugId();
@@ -15,8 +26,17 @@ export const mapBugsToTableData = (bugs: TableBugType[], t: TFunction) => {
1526
return {
1627
key: bug.id.toString(),
1728
id: bug.id.toString(),
29+
siblings:
30+
bug.siblings > 0 ? (
31+
<DuplicateContainer>
32+
{!bug.duplicated_of_id ? (
33+
<FatherIcon style={{ color: globalTheme.palette.grey[500] }} />
34+
) : null}
35+
+{bug.siblings}
36+
</DuplicateContainer>
37+
) : null,
1838
bugId: (
19-
<span style={{ color: theme.palette.grey[700] }}>
39+
<span style={{ color: globalTheme.palette.grey[700] }}>
2040
{bug.id.toString()}
2141
</span>
2242
),
@@ -37,7 +57,10 @@ export const mapBugsToTableData = (bugs: TableBugType[], t: TFunction) => {
3757
{bug.type.name && (
3858
<>
3959
<Pipe size="small" />
40-
<Pill isBold={isPillBold} style={{ marginLeft: theme.space.xs }}>
60+
<Pill
61+
isBold={isPillBold}
62+
style={{ marginLeft: globalTheme.space.xs }}
63+
>
4164
{bug.type.name}
4265
</Pill>
4366
</>
@@ -48,7 +71,7 @@ export const mapBugsToTableData = (bugs: TableBugType[], t: TFunction) => {
4871
<Pill
4972
isBold
5073
backgroundColor="transparent"
51-
color={theme.palette.blue[600]}
74+
color={globalTheme.palette.blue[600]}
5275
>
5376
{t('__PAGE_BUGS_UNREAD_PILL', 'Unread')}
5477
</Pill>
@@ -60,7 +83,9 @@ export const mapBugsToTableData = (bugs: TableBugType[], t: TFunction) => {
6083
created: bug.created,
6184
updated: bug.updated,
6285
borderColor:
63-
theme.colors.bySeverity[bug.severity.name.toLowerCase() as Severities],
86+
globalTheme.colors.bySeverity[
87+
bug.severity.name.toLowerCase() as Severities
88+
],
6489
};
6590
});
6691
};

0 commit comments

Comments
 (0)