-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgraded react-mutation-mapper version to 0.3.0
Signed-off-by: Onur Sumer <s.onur.sumer@gmail.com> replaced ProteinImpactTypePanel with ProteinImpactTypeBadgeSelector Signed-off-by: Onur Sumer <s.onur.sumer@gmail.com> enabled filtering for MutationRateSummary Signed-off-by: Onur Sumer <s.onur.sumer@gmail.com> fixed mutation type filter counts Signed-off-by: Onur Sumer <s.onur.sumer@gmail.com>
- Loading branch information
Showing
14 changed files
with
366 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/pages/resultsView/mutation/MutationStatusSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import {computed} from "mobx"; | ||
import {observer} from "mobx-react"; | ||
import * as React from 'react'; | ||
import { | ||
BadgeLabel, | ||
formatPercentValue, | ||
MUTATION_STATUS_BADGE_STYLE_OVERRIDE, | ||
MutationStatusBadgeSelector, | ||
MutationStatusBadgeSelectorProps | ||
} from "react-mutation-mapper"; | ||
|
||
import DefaultTooltip from "public-lib/components/defaultTooltip/DefaultTooltip"; | ||
|
||
|
||
export function getFilterOptionLabel(content: {title: string, description?: string}): JSX.Element | string | ||
{ | ||
if (content.description) { | ||
return ( | ||
<span> | ||
{content.title} | ||
<DefaultTooltip | ||
placement="right" | ||
overlay={ | ||
<span>{content.description}</span> | ||
} | ||
> | ||
<i className="fa fa-info-circle" style={{marginLeft: "0.2rem"}} /> | ||
</DefaultTooltip> | ||
</span> | ||
); | ||
} | ||
else { | ||
return content.title; | ||
} | ||
} | ||
|
||
type MutationStatusSelectorProps = MutationStatusBadgeSelectorProps & { | ||
somaticContent: {title: string, description?: string}; | ||
germlineContent?: {title: string, description?: string}; | ||
}; | ||
|
||
@observer | ||
export default class MutationStatusSelector extends React.Component<MutationStatusSelectorProps, {}> | ||
{ | ||
@computed | ||
private get mutationStatusFilterOptions() | ||
{ | ||
const options = [ | ||
{ | ||
value: "Somatic", | ||
label: getFilterOptionLabel(this.props.somaticContent), | ||
badgeStyleOverride: MUTATION_STATUS_BADGE_STYLE_OVERRIDE, | ||
badgeStyleSelectedOverride: MUTATION_STATUS_BADGE_STYLE_OVERRIDE | ||
} | ||
]; | ||
|
||
if (this.props.germlineContent) | ||
{ | ||
options.push({ | ||
value: "Germline", | ||
label: getFilterOptionLabel(this.props.germlineContent), | ||
badgeStyleOverride: MUTATION_STATUS_BADGE_STYLE_OVERRIDE, | ||
badgeStyleSelectedOverride: MUTATION_STATUS_BADGE_STYLE_OVERRIDE | ||
}); | ||
} | ||
|
||
return options; | ||
} | ||
|
||
private get somaticInfo() | ||
{ | ||
return this.props.rates ? ( | ||
<BadgeLabel | ||
label={getFilterOptionLabel(this.props.somaticContent)} | ||
badgeContent={`${formatPercentValue(this.props.rates["Somatic"])}%`} | ||
badgeStyleOverride={this.mutationStatusFilterOptions[0].badgeStyleOverride} | ||
/> | ||
): null; | ||
} | ||
|
||
private get germlinePlaceholder() { | ||
return <div data-test='germlineMutationRate' className="invisible">%</div> | ||
} | ||
|
||
public render() | ||
{ | ||
// Render the actual selector only if germline content exists. | ||
// Otherwise just display the somatic info without a filter option. | ||
return this.props.germlineContent === undefined ? ( | ||
<React.Fragment> | ||
{this.somaticInfo} | ||
{this.germlinePlaceholder} | ||
</React.Fragment> | ||
): ( | ||
<MutationStatusBadgeSelector | ||
badgeSelectorOptions={this.mutationStatusFilterOptions} | ||
{...this.props} | ||
/> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.