@@ -5,14 +5,17 @@ import { ColumnDefinitionType } from 'src/common/components/Table';
55import { theme } from 'src/app/theme' ;
66import { Pipe } from 'src/common/components/Pipe' ;
77import { useTranslation } from 'react-i18next' ;
8- import { getSelectedFiltersIds } from 'src/features/bugsPage/bugsPageSlice' ;
8+ import {
9+ getSelectedBugId ,
10+ getSelectedFiltersIds ,
11+ } from 'src/features/bugsPage/bugsPageSlice' ;
912import { useGetCampaignsByCidBugsQuery } from 'src/features/api' ;
1013import { TableDatum } from './types' ;
1114import { BugTitle } from './BugTitle' ;
1215
1316export const useTableData = ( campaignId : number ) => {
1417 const { t } = useTranslation ( ) ;
15-
18+ const currentBugId = getSelectedBugId ( ) ;
1619 const filterBy = getSelectedFiltersIds ( ) ;
1720
1821 const columns : ColumnDefinitionType < TableDatum , keyof TableDatum > [ ] = [
@@ -59,56 +62,64 @@ export const useTableData = (campaignId: number) => {
5962
6063 const mapBugsToTableData = useMemo < TableDatum [ ] > ( ( ) => {
6164 if ( ! bugs || ! bugs . items ) return [ ] ;
62- return bugs . items . map ( ( bug ) => ( {
63- id : bug . id . toString ( ) ,
64- bugId : (
65- < span style = { { color : theme . palette . grey [ 700 ] } } >
66- { bug . id . toString ( ) }
67- </ span >
68- ) ,
69- severity : (
70- < SeverityPill
71- severity = { bug . severity . name . toLowerCase ( ) as Severities }
72- />
73- ) ,
74- title : (
75- < div >
76- < BugTitle isUnread = { ! bug . read } > { bug . title . compact } </ BugTitle >
77- { bug . title . context && (
78- < Pill isBold = { ! bug . read } > { bug . title . context } </ Pill >
79- ) }
80- { bug . tags ?. map ( ( tag ) => (
81- < Pill isBold = { ! bug . read } > { tag . tag_name } </ Pill >
82- ) ) }
83- { bug . type . name && (
84- < >
85- < Pipe size = "small" />
86- < Pill isBold style = { { marginLeft : theme . space . xs } } >
87- { bug . type . name }
88- </ Pill >
89- </ >
90- ) }
91- { ! bug . read && (
92- < >
93- < Pipe size = "small" />
94- < Pill
95- isBold
96- backgroundColor = "transparent"
97- color = { theme . palette . blue [ 600 ] }
98- >
99- { t ( '__PAGE_BUGS_UNREAD_PILL' , 'Unread' ) }
100- </ Pill >
101- </ >
102- ) }
103- </ div >
104- ) ,
105- isHighlighted : ! bug . read ,
106- created : bug . created ,
107- updated : bug . updated ,
108- borderColor :
109- theme . colors . bySeverity [ bug . severity . name . toLowerCase ( ) as Severities ] ,
110- } ) ) ;
111- } , [ bugs ] ) ;
65+ return bugs . items . map ( ( bug ) => {
66+ const isPillBold = ( currentBugId && currentBugId === bug . id ) || ! bug . read ;
67+ return {
68+ id : bug . id . toString ( ) ,
69+ bugId : (
70+ < span style = { { color : theme . palette . grey [ 700 ] } } >
71+ { bug . id . toString ( ) }
72+ </ span >
73+ ) ,
74+ severity : (
75+ < SeverityPill
76+ severity = { bug . severity . name . toLowerCase ( ) as Severities }
77+ />
78+ ) ,
79+ title : (
80+ < div >
81+ < BugTitle isUnread = { ! bug . read } > { bug . title . compact } </ BugTitle >
82+ { bug . title . context && (
83+ < Pill isBold = { isPillBold } > { bug . title . context } </ Pill >
84+ ) }
85+ { bug . tags ?. map ( ( tag ) => (
86+ < Pill isBold = { isPillBold } > { tag . tag_name } </ Pill >
87+ ) ) }
88+ { bug . type . name && (
89+ < >
90+ < Pipe size = "small" />
91+ < Pill
92+ isBold = { isPillBold }
93+ style = { { marginLeft : theme . space . xs } }
94+ >
95+ { bug . type . name }
96+ </ Pill >
97+ </ >
98+ ) }
99+ { ! bug . read && (
100+ < >
101+ < Pipe size = "small" />
102+ < Pill
103+ isBold
104+ backgroundColor = "transparent"
105+ color = { theme . palette . blue [ 600 ] }
106+ >
107+ { t ( '__PAGE_BUGS_UNREAD_PILL' , 'Unread' ) }
108+ </ Pill >
109+ </ >
110+ ) }
111+ </ div >
112+ ) ,
113+ isHighlighted : ! bug . read ,
114+ created : bug . created ,
115+ updated : bug . updated ,
116+ borderColor :
117+ theme . colors . bySeverity [
118+ bug . severity . name . toLowerCase ( ) as Severities
119+ ] ,
120+ } ;
121+ } ) ;
122+ } , [ bugs , currentBugId ] ) ;
112123
113124 if ( isLoading || isFetching || ! bugs || ! bugs . items )
114125 return { columns, data : [ ] , isLoading : true } ;
0 commit comments