Skip to content

Commit

Permalink
Oncoprint Toolbar Improvements
Browse files Browse the repository at this point in the history
- added a count bubble for Clinical Tracks and Heatmaps
  • Loading branch information
Luke-Sikina committed Dec 6, 2019
1 parent 848ee7c commit f54219e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/pages/resultsView/oncoprint/AddClinicalTracks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as _ from "lodash";
import {MakeMobxView} from "../../../shared/components/MobxView";
import LoadingIndicator from "../../../shared/components/loadingIndicator/LoadingIndicator";
import {toggleIncluded} from "../../../shared/lib/ArrayUtils";
import OncoprintDropdownCount from "./OncoprintDropdownCount";

export interface IAddClinicalTrackProps {
store:ResultsViewPageStore;
Expand Down Expand Up @@ -222,7 +223,9 @@ export default class AddClinicalTracks extends React.Component<IAddClinicalTrack
data-event={serializeEvent({ category:"resultsView", action:"addClinicalTrackMenuOpen", label:this.props.store.studyIds.result!.join(",")})}
data-test="add-clinical-track-button"
>
Add Clinical Tracks <span className="caret"/>&nbsp;
Add Clinical Tracks{" "}
<OncoprintDropdownCount count={this.options.isComplete ? this.options.result!.clinical.length : undefined}/>
&nbsp;<span className="caret"/>&nbsp;
</button>
</DefaultTooltip>
);
Expand Down
12 changes: 12 additions & 0 deletions src/pages/resultsView/oncoprint/OncoprintDropdownCount.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from "react";
import {observer} from "mobx-react";

@observer
export default class OncoprintDropdownCount extends React.Component<{count: number | undefined}, {}> {
render() {
if (this.props.count === undefined) {
return null;
}
return <span className="oncoprintDropdownCount">{this.props.count}</span>;
}
}
7 changes: 7 additions & 0 deletions src/pages/resultsView/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
}
}

.oncoprintDropdownCount {
font-size: 11px;
background: #ddd;
border-radius: 40px;
padding: 2px 6px;
}

.oncoprintContainer {
border: none !important;
padding: 0 !important;
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/oncoprint/controls/CustomDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CustomButton extends React.Component<any,{}> { // cant type this more spec
const {bsRole, title, ...props} = this.props;
return (
<Button className="btn btn-default" {...props}>
{title} <span className="caret"/>
{title} {this.props.titleElement} <span className="caret"/>
</Button>
);
}
Expand All @@ -34,7 +34,7 @@ class CustomMenu extends React.Component<any,{}> {
}

@observer
export default class CustomDropdown extends React.Component<ButtonProps, {}> {
export default class CustomDropdown extends React.Component<ButtonProps & {titleElement?: JSX.Element}, {}> {
@observable private open:boolean = false;

private toggle:()=>void;
Expand Down
10 changes: 9 additions & 1 deletion src/shared/components/oncoprint/controls/OncoprintControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import TextIconArea, {ITextIconAreaItemProps,} from 'shared/components/textIconA
import {extractTreatmentSelections} from '../OncoprintUtils';
import CheckedSelect from 'public-lib/components/checkedSelect/CheckedSelect';
import DriverAnnotationControls, {IDriverAnnotationControlsHandlers} from "../../../../pages/resultsView/settings/DriverAnnotationControls";
import OncoprintDropdownCount from 'pages/resultsView/oncoprint/OncoprintDropdownCount';

export interface IOncoprintControlsHandlers {
onSelectColumnType?: (type: 'sample' | 'patient') => void;
Expand Down Expand Up @@ -703,9 +704,16 @@ export default class OncoprintControls extends React.Component<
return (
<CustomDropdown
bsStyle="default"
title="Heatmap"
title="Add Heatmap Tracks"
id="heatmapDropdown"
className="heatmap"
titleElement={<OncoprintDropdownCount
count={
this.props.state.heatmapProfilesPromise.isComplete && this.props.state.heatmapProfilesPromise!.result ?
this.props.state.heatmapProfilesPromise!.result!.length :
undefined
}
/>}
>
{menu}
</CustomDropdown>
Expand Down

0 comments on commit f54219e

Please sign in to comment.