Skip to content

Commit 02b1531

Browse files
authored
Merge pull request #222 from bcgsc/release/v6.11.1
Release/v6.11.1
2 parents 167b364 + 71a079a commit 02b1531

File tree

6 files changed

+84
-69
lines changed

6 files changed

+84
-69
lines changed

app/components/ReportToolbar/index.jsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import {
77
import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';
88
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
99
import startCase from '@/utils/startCase';
10+
import {
11+
REPORT_TYPE_TO_TITLE,
12+
REPORT_TYPE_TO_SUFFIX,
13+
} from '@/constants';
1014

1115
import './index.scss';
1216

@@ -21,16 +25,10 @@ function ReportToolbar(props) {
2125
} = props;
2226

2327
const reportTitle = useMemo(() => {
24-
if (type === 'probe') {
25-
return 'Targeted Gene';
26-
}
27-
if (type === 'genomic') {
28-
return 'Genomic';
29-
}
30-
if (type === 'pharmacogenomic') {
31-
return 'Pharmacogenomic and Germline Targeted Gene';
32-
}
33-
return '';
28+
const titleFirstPart = REPORT_TYPE_TO_SUFFIX[type];
29+
const titleSecondPart = REPORT_TYPE_TO_TITLE[type];
30+
if (!titleFirstPart && !titleSecondPart) return '';
31+
return `${titleFirstPart}${titleFirstPart ? ` - ${titleSecondPart}` : titleSecondPart}`;
3432
}, [type]);
3533

3634
return (

app/constants/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,21 @@ const CNVSTATE = {
1111
AMP: ['Amp', 'amplification'],
1212
};
1313

14+
const REPORT_TYPE_TO_TITLE = {
15+
genomic: 'Genomic',
16+
probe: 'Targeted Gene',
17+
pharmacogenomic: 'Pharmacogenomic and Cancer Predisposition Targeted Gene',
18+
};
19+
20+
const REPORT_TYPE_TO_SUFFIX = {
21+
genomic: '',
22+
probe: 'Somatic',
23+
pharmacogenomic: 'Germline',
24+
};
25+
1426
export {
27+
REPORT_TYPE_TO_TITLE,
28+
REPORT_TYPE_TO_SUFFIX,
1529
EXPLEVEL,
1630
CNVSTATE,
1731
};

app/views/PrintView/index.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import PageBreak from '@/components/PageBreak';
1212
import startCase from '@/utils/startCase';
1313
import { ReportType } from '@/context/ReportContext/types';
1414
import { TemplateType } from '@/common';
15+
import {
16+
REPORT_TYPE_TO_TITLE,
17+
REPORT_TYPE_TO_SUFFIX,
18+
} from '@/constants';
1519
import Summary from '../ReportView/components/Summary';
1620
import RunningLeft from './components/RunningLeft';
1721
import RunningCenter from './components/RunningCenter';
@@ -25,16 +29,6 @@ const TherapeuticTargets = lazy(() => import('../ReportView/components/Therapeut
2529
const Slides = lazy(() => import('../ReportView/components/Slides'));
2630
const Appendices = lazy(() => import('../ReportView/components/Appendices'));
2731

28-
const REPORT_TYPE_TO_PRINT_TITLE = {
29-
probe: 'Targeted Gene Report',
30-
pharmacogenomic: 'Pharmacogenomic and Cancer Predisposition Targeted Gene Report',
31-
};
32-
33-
const REPORT_TYPE_TO_PRINT_SUFFIX = {
34-
probe: 'Somatic',
35-
pharmacogenomic: 'Germline',
36-
};
37-
3832
const reducer = (state, action) => {
3933
switch (action.type) {
4034
case 'summary':
@@ -152,9 +146,9 @@ const Print = (): JSX.Element => {
152146

153147
const titleBar = useMemo(() => {
154148
if (report && template) {
155-
const printTitle = REPORT_TYPE_TO_PRINT_TITLE[template.name];
149+
const printTitle = REPORT_TYPE_TO_TITLE[template.name];
156150
const headerSubtitle = report.patientId;
157-
const headerSubtitleSuffix = REPORT_TYPE_TO_PRINT_SUFFIX[template.name];
151+
const headerSubtitleSuffix = REPORT_TYPE_TO_SUFFIX[template.name];
158152
return (
159153
<div className="print__headers">
160154
<div className="print__header-left">
@@ -163,7 +157,7 @@ const Print = (): JSX.Element => {
163157
)}
164158
</div>
165159
<div className="print__header-right">
166-
{printTitle && <Typography variant="h1">{printTitle}</Typography>}
160+
{printTitle && (<Typography variant="h1">{`${printTitle} Report`}</Typography>)}
167161
<Typography variant="h2">
168162
{`${headerSubtitle}${headerSubtitleSuffix ? ` - ${headerSubtitleSuffix}` : ''}`}
169163
</Typography>

app/views/ReportView/components/PathwayAnalysis/components/Pathway/index.tsx

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {
2-
useEffect, useState, useContext, useCallback,
2+
useEffect, useState, useContext, useCallback, useMemo,
33
} from 'react';
44
import { useSnackbar } from 'notistack';
55
import {
@@ -59,6 +59,7 @@ const Pathway = ({
5959
const newPathway = new FormData();
6060

6161
newPathway.append('pathway', uploadedFile);
62+
newPathway.set('legend', 'v2');
6263

6364
let pathwayResp: PathwayImageType;
6465
if (initialPathway) {
@@ -76,7 +77,7 @@ const Pathway = ({
7677
true,
7778
).request(isSigned);
7879
}
79-
80+
8081
setPathwayImage(pathwayResp);
8182
setIsPathwayLoading(false);
8283
onChange(pathwayResp);
@@ -86,53 +87,61 @@ const Pathway = ({
8687
}
8788
}, [initialPathway, isSigned, onChange, report, snackbar]);
8889

90+
const pathwayUpload = useMemo(() => {
91+
let component = null;
92+
if (canEdit && !isPrint) {
93+
component = (
94+
<Button
95+
className="pathway__legend-button"
96+
component="label"
97+
color="secondary"
98+
variant="outlined"
99+
>
100+
{!isPathwayLoading && (
101+
<>
102+
Upload Pathway Image
103+
<PublishIcon />
104+
<input
105+
accept=".svg"
106+
onChange={handlePathwayUpload}
107+
type="file"
108+
hidden
109+
/>
110+
</>
111+
)}
112+
{isPathwayLoading && (
113+
<CircularProgress size="small" color="secondary" />
114+
)}
115+
</Button>
116+
);
117+
if (pathwayImage?.pathway) {
118+
component = (
119+
<IconButton
120+
className="pathway__button"
121+
color="secondary"
122+
component="label"
123+
size="large"
124+
>
125+
<PublishIcon />
126+
<input
127+
accept=".svg"
128+
onChange={handlePathwayUpload}
129+
type="file"
130+
hidden
131+
/>
132+
</IconButton>
133+
);
134+
}
135+
}
136+
return component;
137+
}, [handlePathwayUpload, canEdit, isPrint, pathwayImage?.pathway, isPathwayLoading]);
138+
89139
return (
90140
<div>
91141
{imageError && (
92142
<Typography align="center" color="error">{imageError}</Typography>
93143
)}
94-
{canEdit && !isPrint && (
95-
<>
96-
{pathwayImage?.pathway ? (
97-
<IconButton
98-
className="pathway__button"
99-
color="secondary"
100-
component="label"
101-
size="large">
102-
<PublishIcon />
103-
<input
104-
accept=".svg"
105-
onChange={handlePathwayUpload}
106-
type="file"
107-
hidden
108-
/>
109-
</IconButton>
110-
) : (
111-
<Button
112-
className="pathway__legend-button"
113-
component="label"
114-
color="secondary"
115-
variant="outlined"
116-
>
117-
{!isPathwayLoading && (
118-
<>
119-
Upload Pathway Image
120-
<PublishIcon />
121-
<input
122-
accept=".svg"
123-
onChange={handlePathwayUpload}
124-
type="file"
125-
hidden
126-
/>
127-
</>
128-
)}
129-
{isPathwayLoading && (
130-
<CircularProgress size="small" color="secondary" />
131-
)}
132-
</Button>
133-
)}
134-
</>
135-
)}
144+
{pathwayUpload}
136145
{pathwayImage?.pathway && (
137146
<SvgImage image={pathwayImage.pathway} isPrint={isPrint} />
138147
)}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "ipr-client",
4-
"version": "6.11.0",
4+
"version": "6.11.1",
55
"keywords": [],
66
"license": "GPL-3.0",
77
"sideEffects": false,

0 commit comments

Comments
 (0)