mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-19 19:08:11 +08:00
* embedding * menu bottom left * button * change gutters to support lower toolbar * fix scatterplot layout * fix tests to match new layout * fix smoke tests to match new layout * better sentence, dataset.nObs to top * scatterplot position Co-authored-by: bkmartinjr <bruce@chanzuckerberg.com>
93 lines
2.4 KiB
JavaScript
93 lines
2.4 KiB
JavaScript
// jshint esversion: 6
|
|
import React from "react";
|
|
import Helmet from "react-helmet";
|
|
import { connect } from "react-redux";
|
|
|
|
import Container from "./framework/container";
|
|
import Layout from "./framework/layout";
|
|
import LeftSideBar from "./leftSidebar";
|
|
import RightSideBar from "./rightSidebar";
|
|
import Legend from "./continuousLegend";
|
|
import Graph from "./graph/graph";
|
|
import MenuBar from "./menubar";
|
|
import Autosave from "./autosave";
|
|
import Embedding from "./embedding";
|
|
import TermsOfServicePrompt from "./termsPrompt";
|
|
|
|
import actions from "../actions";
|
|
|
|
@connect((state) => ({
|
|
loading: state.controls.loading,
|
|
error: state.controls.error,
|
|
graphRenderCounter: state.controls.graphRenderCounter,
|
|
}))
|
|
class App extends React.Component {
|
|
componentDidMount() {
|
|
const { dispatch } = this.props;
|
|
|
|
/* listen for url changes, fire one when we start the app up */
|
|
window.addEventListener("popstate", this._onURLChanged);
|
|
this._onURLChanged();
|
|
|
|
dispatch(actions.doInitialDataLoad(window.location.search));
|
|
this.forceUpdate();
|
|
}
|
|
|
|
_onURLChanged() {
|
|
const { dispatch } = this.props;
|
|
|
|
dispatch({ type: "url changed", url: document.location.href });
|
|
}
|
|
|
|
render() {
|
|
const { loading, error, graphRenderCounter } = this.props;
|
|
return (
|
|
<Container>
|
|
<Helmet title="cellxgene" />
|
|
{loading ? (
|
|
<div
|
|
style={{
|
|
position: "fixed",
|
|
fontWeight: 500,
|
|
top: window.innerHeight / 2,
|
|
left: window.innerWidth / 2 - 50,
|
|
}}
|
|
>
|
|
loading cellxgene
|
|
</div>
|
|
) : null}
|
|
{error ? (
|
|
<div
|
|
style={{
|
|
position: "fixed",
|
|
fontWeight: 500,
|
|
top: window.innerHeight / 2,
|
|
left: window.innerWidth / 2 - 50,
|
|
}}
|
|
>
|
|
error loading cellxgene
|
|
</div>
|
|
) : null}
|
|
{loading || error ? null : (
|
|
<Layout>
|
|
<LeftSideBar />
|
|
{(viewportRef) => (
|
|
<>
|
|
<MenuBar />
|
|
<Embedding />
|
|
<Autosave />
|
|
<TermsOfServicePrompt />
|
|
<Legend viewportRef={viewportRef} />
|
|
<Graph key={graphRenderCounter} viewportRef={viewportRef} />
|
|
</>
|
|
)}
|
|
<RightSideBar />
|
|
</Layout>
|
|
)}
|
|
</Container>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default App;
|