Skip to content

Commit

Permalink
Added new variant page
Browse files Browse the repository at this point in the history
  • Loading branch information
jfkonecn committed Dec 4, 2024
1 parent 05cfa25 commit 37b88bf
Show file tree
Hide file tree
Showing 12 changed files with 1,042 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/webapp/app/components/LevelWithDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ReactHtmlParser from 'react-html-parser';
import { LEVELS } from 'app/config/constants';

export const LevelWithDescription: React.FunctionComponent<{
level: LEVELS;
level: LEVELS | undefined;
appStore?: AppStore;
description?: string;
}> = inject('appStore')(props => {
Expand Down
14 changes: 11 additions & 3 deletions src/main/webapp/app/components/PageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import WindowStore from 'app/store/WindowStore';
import { RouterStore } from 'mobx-react-router';
import { PAGE_ROUTE } from 'app/config/constants';
import { GENETIC_TYPE } from 'app/components/geneticTypeTabs/GeneticTypeTabs';
import { parseGenePagePath } from 'app/shared/utils/UrlUtils';
import {
parseGenePagePath,
parseAlterationPagePath,
} from 'app/shared/utils/UrlUtils';

const Container: FunctionComponent<{
inGenePage: boolean;
Expand All @@ -25,18 +28,23 @@ const PageContainer: React.FunctionComponent<{
}> = props => {
const genePagePath = parseGenePagePath(props.routing.location.pathname);
const inGenePage = genePagePath.geneticType !== undefined;
const inAlterationPage =
parseAlterationPagePath(props.routing.location.pathname).geneticType !==
undefined;
return (
<div className={'view-wrapper'}>
<div
className={
inGenePage
inGenePage || inAlterationPage
? ''
: props.windowStore.isXLscreen
? 'container'
: 'container-fluid'
}
>
<Container inGenePage={inGenePage}>{props.children}</Container>
<Container inGenePage={inGenePage || inAlterationPage}>
{props.children}
</Container>
</div>
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/app/config/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@ export enum PAGE_ROUTE {
SOMATIC_GENE = '/gene/:hugoSymbol/somatic',
GERMLINE_GENE = '/gene/:hugoSymbol/germline',
ALTERATION = '/gene/:hugoSymbol/:alteration',
SOMATIC_ALTERATION = '/gene/:hugoSymbol/somatic/:alteration',
GERMLINE_ALTERATION = '/gene/:hugoSymbol/germline/:alteration',
HGVSG = '/hgvsg',
HGVSG_WITH_QUERY = '/hgvsg/:query',
GENOMIC_CHANGE = '/genomic-change',
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/pages/genePage/GeneInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ enum GENE_TYPE_DESC {
TUMOR_SUPPRESSOR = 'Tumor Suppressor',
}

const HighestLevelItem: React.FunctionComponent<{
export const HighestLevelItem: React.FunctionComponent<{
level: LEVELS;
key?: string;
}> = props => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.itemLink a {
justify-content: initial;
}

.itemHeader {
font-size: 1rem;
color: #878d96;
}

.alterationTile {
padding: 16px;
padding-bottom: 24px;
min-width: 347px;
max-width: 392px;
gap: 8px;
box-shadow: $default-box-shadow;
border-radius: 8px;
}

.alterationTileGrid {
display: grid;
grid-template-columns: repeat(2, 1fr);
}

.alterationTileItems {
gap: 16px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import React from 'react';
import styles from './AlterationTile.module.scss';
import classNames from 'classnames';
import ExternalLinkIcon from 'app/shared/icons/ExternalLinkIcon';

type AlterationItemProps =
| {
title: string;
value: JSX.Element | string;
link?: undefined;
}
| {
title: string;
value: string;
link: string;
};

function AlterationItem({
title: itemTitle,
value,
link,
}: AlterationItemProps) {
return (
<div>
<h4 className={classNames(styles.itemHeader)}>{itemTitle}</h4>
<div>
{typeof value === 'string' ? (
<div className={classNames('h5')}>
{link ? (
<div className={classNames(styles.itemLink)}>
<ExternalLinkIcon link={link}>{value}</ExternalLinkIcon>
</div>
) : (
value
)}
</div>
) : (
value
)}
</div>
</div>
);
}

type AlterationTileProps = {
title: string;
items: (AlterationItemProps | [AlterationItemProps, AlterationItemProps])[];
};

export default function AlterationTile({
title,
items,
}: AlterationTileProps): JSX.Element {
return (
<div className={classNames('d-flex', 'flex-column', styles.alterationTile)}>
<h3 className="h6">{title}</h3>
<div
className={classNames(
'd-flex',
'flex-column',
styles.alterationTileItems
)}
>
{items.map((parent, i) => {
if (Array.isArray(parent)) {
return (
<div className={classNames(styles.alterationTileGrid)}>
{parent.map((child, j) => {
return <AlterationItem key={`${i}:${j}`} {...child} />;
})}
</div>
);
} else {
return <AlterationItem key={i} {...parent} />;
}
})}
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import {
levelOfEvidence2Level,
OncoKBLevelIcon,
FdaLevelIcon,
} from 'app/shared/utils/Utils';

type HighestLevelEvidenceProp = {
type:
| 'Sensitive'
| 'Resistance'
| 'DiagnosticImplication'
| 'PrognosticImplication'
| 'Fda';
level: string | undefined;
};

export default function HighestLevelEvidence({
type,
level: rawLevel = '',
}: HighestLevelEvidenceProp): JSX.Element {
if (type === 'Sensitive') {
const level = levelOfEvidence2Level(rawLevel, false);
return (
<OncoKBLevelIcon size="s2" level={level} key="highestSensitiveLevel" />
);
}
if (type === 'Resistance') {
const level = levelOfEvidence2Level(rawLevel, false);
return (
<OncoKBLevelIcon size="s2" level={level} key="highestResistanceLevel" />
);
}
if (type === 'DiagnosticImplication') {
const level = levelOfEvidence2Level(rawLevel, false);
return (
<OncoKBLevelIcon
size="s2"
level={level}
key={'highestDiagnosticImplicationLevel'}
/>
);
}
if (type === 'PrognosticImplication') {
const level = levelOfEvidence2Level(rawLevel, false);
return (
<OncoKBLevelIcon
size="s2"
level={level}
key={'highestPrognosticImplicationLevel'}
/>
);
}
if (type === 'Fda') {
const level = levelOfEvidence2Level(rawLevel, false);
return <FdaLevelIcon size="s2" level={level} key={'highestFdaLevel'} />;
}
return <></>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.backLink {
gap: 0.5rem;
}

.header {
margin-bottom: 0.5rem;
}

.headerContent {
gap: 0.5rem;
}

.navBarTitle {
.pill {
font-size: 0.85rem;
}
}

.pill {
font-size: 1rem;
border: #0968c3;
color: #0968c3;
border-style: solid;
border-width: 2px;
border-radius: 56px;
padding: 0px 8px;
background: #f0f5ff;
}

.alterationTiles {
gap: 8px;
padding: 32px 0px;
}

.descriptionContainer {
margin-bottom: 1rem;
}
Loading

0 comments on commit 37b88bf

Please sign in to comment.