Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVSU-2267 - Rework 'Beta' Print View #461

Merged
merged 10 commits into from
May 16, 2024
2 changes: 1 addition & 1 deletion app/commonComponents.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type SummaryProps = {
templateName: string;
isPrint: boolean;
printVersion?: 'stable' | 'beta' | null;
printVersion?: 'standardLayout' | 'condensedLayout' | null;
loadedDispatch?: (type: Record<'type', string>) => void;
visibleSections: string[] | null;
[x: string]: unknown;
Expand Down
63 changes: 43 additions & 20 deletions app/components/ReportSidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,48 @@ const ReportSidebar = (props) => {
return null;
}

const standardPrintOption = () => (
<MenuItem>
<Link
to={{ pathname: `/print/${report.ident}` }}
target="_blank"
rel="noopener noreferrer"
className="report-sidebar__list-link"
>
<Typography>Standard Layout</Typography>
</Link>
</MenuItem>
);

const condensedPrintOption = () => (
<MenuItem>
<Link
to={{ pathname: `/condensedLayoutPrint/${report.ident}` }}
target="_blank"
rel="noopener noreferrer"
className="report-sidebar__list-link"
>
<Typography>Condensed Layout</Typography>
</Link>
</MenuItem>
);

const printOptions = () => {
if (report.template.name === 'genomic') {
return (
<>
{standardPrintOption()}
{condensedPrintOption()}
</>
);
}
return (
<>
{standardPrintOption()}
</>
);
};

return (
<div className="report-sidebar">
<List dense classes={{ root: 'report-sidebar__list' }}>
Expand All @@ -49,26 +91,7 @@ const ReportSidebar = (props) => {
open={Boolean(anchorEl)}
onClose={handlePrintMenuClose}
>
<MenuItem>
<Link
to={{ pathname: `/print/${report.ident}` }}
target="_blank"
rel="noopener noreferrer"
className="report-sidebar__list-link"
>
<Typography>Stable</Typography>
</Link>
</MenuItem>
<MenuItem>
<Link
to={{ pathname: `/printBeta/${report.ident}` }}
target="_blank"
rel="noopener noreferrer"
className="report-sidebar__list-link"
>
<Typography>Beta</Typography>
</Link>
</MenuItem>
{printOptions()}
</Menu>
</ListItem>
{allSections.map((section) => (
Expand Down
4 changes: 2 additions & 2 deletions app/views/MainView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const TermsView = lazy(() => import('../TermsView'));
const ReportsView = lazy(() => import('../ReportsView'));
const ReportView = lazy(() => import('../ReportView'));
const PrintView = lazy(() => import('../PrintView'));
const BetaPrintView = (props) => <PrintView {...props} printVersion="beta" />;
const CondensedPrintView = (props) => <PrintView {...props} printVersion="condensedLayout" />;
const GermlineView = lazy(() => import('../GermlineView'));
const AdminView = lazy(() => import('../AdminView'));
const LinkOutView = lazy(() => import('../LinkOutView'));
Expand Down Expand Up @@ -184,7 +184,7 @@ const Main = (): JSX.Element => {
<Redirect exact from="/report/:ident/(genomic|probe)/summary" to="/report/:ident/summary" />
<AuthenticatedRoute component={ReportView} path="/report/:ident" />
<AuthenticatedRoute component={PrintView} path="/print/:ident" showNav={false} onToggleNav={setIsNavVisible} />
<AuthenticatedRoute component={BetaPrintView} path="/printBeta/:ident" showNav={false} onToggleNav={setIsNavVisible} />
<AuthenticatedRoute component={CondensedPrintView} path="/condensedLayoutPrint/:ident" showNav={false} onToggleNav={setIsNavVisible} />
<AuthenticatedRoute component={GermlineView} path="/germline" />
<AuthenticatedRoute component={ProjectsView} path="/projects" />
<AuthenticatedRoute adminRequired component={AdminView} path="/admin" />
Expand Down
2 changes: 1 addition & 1 deletion app/views/PrintView/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}
}

.printbeta {
.condensedLayout {
&__logo {
max-width: 250px;
}
Expand Down
16 changes: 8 additions & 8 deletions app/views/PrintView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const PrintTitleBar = ({
subtitle,
subtitleSuffix,
headerImageURI,
printVersion = 'stable',
printVersion = 'standardLayout',
}: PrintTitleBarProps) => {
if (!report) { return null; }

Expand All @@ -85,15 +85,15 @@ const PrintTitleBar = ({
biopsyText = biopsyText.concat(`(${report.patientInformation.tumourSample})`);
}

if (printVersion === 'beta') {
if (printVersion === 'condensedLayout') {
return (
<div className="printbeta__headers">
<div className="printbeta__header-left">
<div className="condensedLayout__headers">
<div className="condensedLayout__header-left">
{headerImageURI && (
<img className="printbeta__logo" src={headerImageURI} alt="" />
<img className="condensedLayout__logo" src={headerImageURI} alt="" />
)}
</div>
<div className="printbeta__header-right">
<div className="condensedLayout__header-right">
<Typography variant="h2">{`${title ? `${title} Report: ` : ''} ${subtitle}${subtitleSuffix ? ` - ${subtitleSuffix}` : ''}`}</Typography>
<Typography variant="body2">{biopsyText}</Typography>
</div>
Expand Down Expand Up @@ -126,7 +126,7 @@ type PrintPropTypes = {
};

const Print = ({
printVersion = 'stable',
printVersion = 'standardLayout',
}: PrintPropTypes): JSX.Element => {
const params = useParams<{
ident: string;
Expand Down Expand Up @@ -250,7 +250,7 @@ const Print = ({

return (
<ReportContext.Provider value={reportContextValue}>
<div className={`${printVersion === 'beta' ? 'printbeta' : 'print'}`}>
<div className={`${printVersion === 'condensedLayout' ? 'condensedLayout' : 'print'}`}>
{report ? (
<>
<RunningLeft className="running-left" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Shared styling between both versions
.key-alterations, .key-alterations-print {
&__stable {
&__standardLayout {
margin: 0 0 32px 0;
}
}
Expand All @@ -14,7 +14,7 @@
margin: 0 auto;
padding: 0 20px;

&__stable {
&__standardLayout {

&-title {
margin: 0 0 8px;
Expand All @@ -25,7 +25,7 @@
}
}

&__beta {
&__condensedLayout {

&-content {
margin-top: 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const customTypeSort = (variant) => {

type KeyAlterationsProps = {
isPrint: boolean;
printVersion?: 'stable' | 'beta' | null;
printVersion?: 'standardLayout' | 'condensedLayout' | null;
} & WithLoadingInjectedProps;

const KeyAlterations = ({
Expand Down Expand Up @@ -162,14 +162,14 @@ const KeyAlterations = ({

const alterationsSection = useMemo(() => {
let titleSection = (
<div className={`${classNamePrefix}__stable-title`}>
<div className={`${classNamePrefix}__standardLayout-title`}>
<Typography variant="h3">
Key Genomic and Transcriptomic Alterations Identified
</Typography>
</div>
);
let dataSection = (
<div className={`${classNamePrefix}__stable-content`}>
<div className={`${classNamePrefix}__standardLayout-content`}>
<VariantCounts
filter={variantFilter}
counts={variantCounts}
Expand All @@ -185,7 +185,7 @@ const KeyAlterations = ({
</div>
);

if (printVersion === 'beta') {
if (printVersion === 'condensedLayout') {
titleSection = (
<Typography variant="h5" fontWeight="bold" display="inline">Key Genomic and Transcriptomic Alterations Identified</Typography>
);
Expand All @@ -199,7 +199,7 @@ const KeyAlterations = ({
});
});
dataSection = (
<div className={`${classNamePrefix}__beta-content`}>
<div className={`${classNamePrefix}__condensedLayout-content`}>
<SummaryPrintTable
data={categorizedDataArray}
labelKey="key"
Expand Down
8 changes: 4 additions & 4 deletions app/views/ReportView/components/GenomicSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import './index.scss';
type GenomicSummaryProps = {
loadedDispatch?: ({ type }: { type: string }) => void;
isPrint: boolean;
printVersion?: 'stable' | 'beta' | null;
printVersion?: 'standardLayout' | 'condensedLayout' | null;
} & WithLoadingInjectedProps;

const GenomicSummary = ({
Expand Down Expand Up @@ -438,7 +438,7 @@ const GenomicSummary = ({
</div>
);

if (printVersion === 'beta') {
if (printVersion === 'condensedLayout') {
titleSection = (
<div className={`${classNamePrefix}__patient-information-title`}>
<Typography variant="h5" fontWeight="bold" display="inline">
Expand Down Expand Up @@ -503,7 +503,7 @@ const GenomicSummary = ({
</div>
);

if (printVersion === 'beta') {
if (printVersion === 'condensedLayout') {
titleSection = (
<div className={`${classNamePrefix}__tumour-summary-title`}>
<Typography variant="h5" fontWeight="bold" display="inline">Tumour Summary</Typography>
Expand All @@ -530,7 +530,7 @@ const GenomicSummary = ({
return null;
}

if (printVersion === 'beta') {
if (printVersion === 'condensedLayout') {
return (
<div className={classNamePrefix}>
<DemoDescription>
Expand Down
6 changes: 3 additions & 3 deletions app/views/ReportView/components/TherapeuticTargets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const filterType = (

type TherapeuticProps = {
isPrint?: boolean;
printVersion?: 'stable' | 'beta' | null;
printVersion?: 'standardLayout' | 'condensedLayout' | null;
} & WithLoadingInjectedProps;

const Therapeutic = ({
Expand Down Expand Up @@ -205,7 +205,7 @@ const Therapeutic = ({
}
}, [chemoresistanceData, therapeuticData, report]);

if (isPrint && printVersion === 'stable') {
if (isPrint && printVersion === 'standardLayout') {
return (
<div className="therapeutic-print">
<Typography
Expand Down Expand Up @@ -234,7 +234,7 @@ const Therapeutic = ({
);
}

if (isPrint && printVersion === 'beta') {
if (isPrint && printVersion === 'condensedLayout') {
return (
<div className="therapeutic-print">
<Typography
Expand Down