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

Kpmp 5217 add cell x gene dropdown #498

Merged
merged 12 commits into from
Mar 18, 2024
34 changes: 34 additions & 0 deletions src/components/DataViz/CellXGeneDropdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, {Component} from 'react';
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';

class CellXGeneDropdown extends Component {

constructor(props) {
super(props);
this.state = {
dropdownOpen: false
}
}

toggle =() => {
this.setState({dropdownOpen: !this.state.dropdownOpen});
}

render() {
return (
<Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle} direction="down" className="cellxgene-dropdown">
<DropdownToggle caret className='float-end' color='primary'>View DiffEx in CellXGene</DropdownToggle>
<DropdownMenu>
<DropdownItem tag="a" target="_blank" rel="noopener noreferrer" href={this.props.v1}>
Version 1.0 (Nature 2023)
</DropdownItem>
<DropdownItem disabled>
Version 1.5 (Coming Soon)
</DropdownItem>
</DropdownMenu>
</Dropdown>
)
}
}

export default CellXGeneDropdown;
15 changes: 7 additions & 8 deletions src/components/DataViz/DataTypeSelector.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { Component } from "react";
import Select from "react-select";
import { Row, Col, Container } from 'reactstrap';
import { Row, Col, Container} from 'reactstrap';
import ConceptSelectContainer from '../ConceptSelect/ConceptSelectContainer';
import { getTissueTypeOptions, getAllDataTypeOptions, getDataTypeOptionsWithTissueType } from "../../helpers/Utils";
import { fetchDataTypeSummaryInformation } from '../../helpers/ApolloClient';
import { handleGoogleAnalyticsEvent } from '../../helpers/googleAnalyticsHelper';
import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import CellXGeneDropdown from './CellXGeneDropdown';

class DataTypeSelector extends Component {
constructor(props) {
Expand All @@ -23,13 +24,12 @@ class DataTypeSelector extends Component {
akiCount: '-',
ckdCount: '-',
dmrCount: '-',
participantsCount: '-',
participantsCount: '-'
},
datasetToggle: 'collapsed'
datasetToggle: 'collapsed',
}
}


componentDidUpdate(prevProps) {
if ((this.props.gene.symbol !== prevProps.gene.symbol
|| this.props.dataType !== prevProps.dataType
Expand Down Expand Up @@ -263,11 +263,10 @@ class DataTypeSelector extends Component {
: <span className="a-button" onClick={this.toggleDataset}>Hide dataset details <FontAwesomeIcon icon={faChevronUp} /></span>
}
{(this.props.dataType === 'sc' ) &&
<span><a class='btn btn-primary float-end btn-sm' rel='noreferrer'target='_blank' href='https://cellxgene.cziscience.com/e/32b9bdce-2481-4c85-ba1b-6ad5fcea844c.cxg/'>Disease-specific DiffEx in cellxgene</a> </span>
<CellXGeneDropdown v1="https://cellxgene.cziscience.com/e/32b9bdce-2481-4c85-ba1b-6ad5fcea844c.cxg/"/>
}
{
(this.props.dataType === 'sn') &&
<span><a class='btn btn-primary float-end btn-sm' rel='noreferrer' target='_blank' href='https://cellxgene.cziscience.com/e/07854d9c-5375-4a9b-ac34-fa919d3c3686.cxg/'>Disease-specific DiffEx in cellxgene</a> </span>
{ (this.props.dataType === 'sn') &&
<CellXGeneDropdown v1="https://cellxgene.cziscience.com/e/07854d9c-5375-4a9b-ac34-fa919d3c3686.cxg/"/>
}
</div>
}
Expand Down
4 changes: 4 additions & 0 deletions src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -954,4 +954,8 @@ tr.MuiTableRow-root:nth-child(even) {

.nav-link{
color: rgba(0,0,0,.55)
}

.cellxgene-dropdown {
margin-top: -21px;
}
Loading