Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #32 from KPMP/KPMP-659
Browse files Browse the repository at this point in the history
Kpmp 659
  • Loading branch information
zwright authored Apr 3, 2019
2 parents 773d826 + 4604a73 commit 219aa3a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 32 deletions.
28 changes: 7 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'babel-polyfill';
import React, { Component } from 'react';
import { Container } from 'reactstrap';
import { HashRouter, Switch, Route } from 'react-router-dom';
import { Router, Switch, Route } from 'react-router-dom';
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
Expand All @@ -12,6 +12,7 @@ import DataVizViewerContainer from './components/dataviz/DataVizViewerContainer'
import initialState from './initialState';
import rootReducer from './reducers';
import DemoNavBar from "./components/nav/DemoNavBar";
import createHistory from 'history/createBrowserHistory';

/* INITIALIZE REDUX **************************************************************/
const cacheStore = window.sessionStorage.getItem('atlas');
Expand All @@ -28,6 +29,8 @@ const saveState = () => {
window.sessionStorage.setItem('atlas', JSON.stringify(store.getState()));
};

const history = createHistory();

store.subscribe(saveState);

const GA_TRACKING_ID = 'UA-124331187-6';
Expand All @@ -38,15 +41,15 @@ class App extends Component {
render() {
return (
<Provider store={store}>
<HashRouter basename={`${process.env.PUBLIC_URL}`}>
<Router basename="/atlas" history={history}>
<Container fluid>
<DemoNavBar />
<Switch>
<Route exact path="/" component={SchematicViewerContainer} />
<Route path="/data/:cellName" component={DataVizViewerContainer} />
<Route exact path={process.env.PUBLIC_URL} component={SchematicViewerContainer} />
<Route path={process.env.PUBLIC_URL + "/data/:cellName"} component={DataVizViewerContainer} />
</Switch>
</Container>
</HashRouter>
</Router>
</Provider>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/dataviz/Instruction.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Instruction extends Component {
}

Instruction.propTypes = {
id: PropTypes.String.isRequired,
id: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
Expand Down
6 changes: 3 additions & 3 deletions src/components/nav/DemoNavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ class DemoNavBar extends Component {
render() {
return (
<Navbar expand="md" className="nav-container container-fluid row">
<NavbarBrand href={process.env.PUBLIC_URL + "/"}>
<img src="img/logo.png" alt="Kidney Tissue Atlas Concept" className="logo"/>
<NavbarBrand href={process.env.PUBLIC_URL}>
<img src="/img/logo.png" alt="Kidney Tissue Atlas Concept" className="logo"/>
</NavbarBrand>
<div id="demo-text">
Atlas Concept
</div>
<Nav navbar className="ml-auto">
<NavItem>
<NavLink>
<Link to="/">Cell Types</Link></NavLink>
<Link to={process.env.PUBLIC_URL}>Cell Types</Link></NavLink>
</NavItem>
<NavItem>
<NavLink disabled>Molecular</NavLink>
Expand Down
4 changes: 2 additions & 2 deletions src/components/schematic/SchematicViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class SchematicViewer extends Component {
<span className="cell-structure-name">{structure.structureName}</span>
) : (
<Link className="cell-structure-name"
to={`/data/${encodeURIComponent(structure.cellName)}`}
to={process.env.PUBLIC_URL + `/data/${encodeURIComponent(structure.cellName)}`}
onClick={() => { this.onCellClick(structure.cellName)}}
onMouseEnter={() => this.setState({ activeImages: structure.images })}
>{structure.structureName}
Expand All @@ -84,7 +84,7 @@ class SchematicViewer extends Component {
<ul className="cell-type-list">
{structure.cells.map((cell) => {
return <li>
<Link to={`/data/${encodeURIComponent(cell.cellName)}`}
<Link to={process.env.PUBLIC_URL + `/data/${encodeURIComponent(cell.cellName)}`}
onClick={() => { this.onCellClick(cell.cellName)}}
onMouseEnter={() => this.setState( { activeImages: cell.images })}
>{cell.cellName}
Expand Down

0 comments on commit 219aa3a

Please sign in to comment.