mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-09 07:08:11 +08:00
Remove react router
This commit is contained in:
-29
@@ -1,29 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
|
|
||||||
node_js:
|
|
||||||
- 4
|
|
||||||
- 5
|
|
||||||
- 6
|
|
||||||
|
|
||||||
# Use container-based Travis infrastructure.
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- /^greenkeeper-.*$/
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
on_success: change
|
|
||||||
on_failure: always
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- npm install -g npm@3
|
|
||||||
- export DISPLAY=:99.0
|
|
||||||
- sh -e /etc/init.d/xvfb start
|
|
||||||
|
|
||||||
script:
|
|
||||||
- npm run lint
|
|
||||||
- npm run test
|
|
||||||
- cat coverage/lcov.info | node_modules/.bin/coveralls || echo "Coveralls upload failed"
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
.domain {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
<svg width="960" height="960"></svg>
|
|
||||||
<script src="https://d3js.org/d3.v4.min.js"></script>
|
|
||||||
<script src="https://d3js.org/d3-contour.v1.min.js"></script>
|
|
||||||
<script src="https://d3js.org/d3-scale-chromatic.v1.min.js"></script>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
var svg = d3.select("svg"),
|
|
||||||
width = +svg.attr("width"),
|
|
||||||
height = +svg.attr("height"),
|
|
||||||
margin = {top: 20, right: 30, bottom: 30, left: 40};
|
|
||||||
|
|
||||||
var x = d3.scaleLog()
|
|
||||||
.domain([2e-1, 5e0])
|
|
||||||
.rangeRound([margin.left, width - margin.right]);
|
|
||||||
|
|
||||||
var y = d3.scaleLog()
|
|
||||||
.domain([3e2, 2e4])
|
|
||||||
.rangeRound([height - margin.bottom, margin.top]);
|
|
||||||
|
|
||||||
var color = d3.scaleSequential(d3.interpolateYlGnBu)
|
|
||||||
.domain([0, 1.8]); // Points per square pixel.
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", "translate(0," + (height - margin.bottom) + ")")
|
|
||||||
.call(d3.axisBottom(x).ticks(null, ".1f"))
|
|
||||||
.select(".tick:last-of-type text")
|
|
||||||
.select(function() { return this.parentNode.appendChild(this.cloneNode()); })
|
|
||||||
.attr("y", -3)
|
|
||||||
.attr("dy", null)
|
|
||||||
.attr("font-weight", "bold")
|
|
||||||
.text("Carats");
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", "translate(" + margin.left + ",0)")
|
|
||||||
.call(d3.axisLeft(y).ticks(null, ".1s"))
|
|
||||||
.select(".tick:last-of-type text")
|
|
||||||
.select(function() { return this.parentNode.appendChild(this.cloneNode()); })
|
|
||||||
.attr("x", 3)
|
|
||||||
.attr("text-anchor", "start")
|
|
||||||
.attr("font-weight", "bold")
|
|
||||||
.text("Price (USD)");
|
|
||||||
|
|
||||||
d3.tsv("diamonds.tsv", function(d) {
|
|
||||||
d.carat = +d.carat;
|
|
||||||
d.price = +d.price;
|
|
||||||
return d;
|
|
||||||
}, function(error, diamonds) {
|
|
||||||
if (error) throw error;
|
|
||||||
|
|
||||||
svg.insert("g", "g")
|
|
||||||
.attr("fill", "none")
|
|
||||||
.attr("stroke", "#000")
|
|
||||||
.attr("stroke-width", 0.5)
|
|
||||||
.attr("stroke-linejoin", "round")
|
|
||||||
.selectAll("path")
|
|
||||||
.data(d3.contourDensity()
|
|
||||||
.x(function(d) { return x(d.carat); })
|
|
||||||
.y(function(d) { return y(d.price); })
|
|
||||||
.size([width, height])
|
|
||||||
.bandwidth(10)
|
|
||||||
(diamonds))
|
|
||||||
.enter().append("path")
|
|
||||||
.attr("fill", function(d) { return color(d.value); })
|
|
||||||
.attr("d", d3.geoPath());
|
|
||||||
});
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
.heroContainer {
|
|
||||||
width: 100%;
|
|
||||||
height: 95vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero {
|
|
||||||
font-size: 48px;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.subHero {
|
|
||||||
font-size: 18px;
|
|
||||||
max-width: 600px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.or {
|
|
||||||
margin: 20px;
|
|
||||||
font-family: Georgia;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
import Helmet from 'react-helmet';
|
|
||||||
import styles from './page2.css';
|
|
||||||
import buttonStyles from './buttons.css';
|
|
||||||
|
|
||||||
|
|
||||||
import Container from './container';
|
|
||||||
|
|
||||||
const Page2 = () => (
|
|
||||||
<Container>
|
|
||||||
<Helmet title="cellxgene" />
|
|
||||||
<div className={styles.heroContainer}>
|
|
||||||
<h1 className={styles.hero}>cellxgene</h1>
|
|
||||||
<p className={styles.subHero}>
|
|
||||||
A data exploration interface for single cell genetic expression matrices. Subset, filter, cluster & validate, all in one place.
|
|
||||||
</p>
|
|
||||||
<div>
|
|
||||||
<Link to="/"><button className={buttonStyles.primaryButton}>explore a sample dataset</button></Link>
|
|
||||||
<span className={styles.or}>or</span>
|
|
||||||
<button className={buttonStyles.primaryButton}>get started with your own data</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
|
|
||||||
export default Page2;
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
.root {
|
|
||||||
background: #fff;
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
font-family: Georgia,serif;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
a {
|
|
||||||
color: #ad1b11;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
import styles from './root.css';
|
|
||||||
|
|
||||||
const Root = props => (
|
|
||||||
<div className={styles.root}>
|
|
||||||
{props.children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
export default Root;
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
export default getComponent => {
|
|
||||||
return class AsyncComponent extends React.Component {
|
|
||||||
static Component = null;
|
|
||||||
mounted = false;
|
|
||||||
|
|
||||||
state = { Component: AsyncComponent.Component };
|
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
if (this.state.Component === null) {
|
|
||||||
getComponent()
|
|
||||||
.then(m => m.default)
|
|
||||||
.then(Component => {
|
|
||||||
AsyncComponent.Component = Component;
|
|
||||||
if (this.mounted) {
|
|
||||||
this.setState({ Component });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.mounted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
this.mounted = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { Component } = this.state;
|
|
||||||
|
|
||||||
if (Component !== null) {
|
|
||||||
return <Component {...this.props} />;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/* eslint-disable no-console */
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import { BrowserRouter as Router, Route } from 'react-router-dom';
|
|
||||||
|
|
||||||
import asyncRoute from './async-route';
|
|
||||||
import Root from '../containers/root';
|
|
||||||
import Header from '../components/header';
|
|
||||||
|
|
||||||
const Routes = () => (
|
|
||||||
<Router>
|
|
||||||
<Root>
|
|
||||||
<Header />
|
|
||||||
<Route
|
|
||||||
exact
|
|
||||||
path="/"
|
|
||||||
component={asyncRoute(() => System.import('../components/home'))}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/page2"
|
|
||||||
component={asyncRoute(() => System.import('../components/page2'))}
|
|
||||||
/>
|
|
||||||
</Root>
|
|
||||||
</Router>
|
|
||||||
);
|
|
||||||
|
|
||||||
export default Routes;
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
var babelConfig = require('../configuration/babel/babel.test.js');
|
|
||||||
require('babel-register')(babelConfig);
|
|
||||||
|
|
||||||
// Deobfuscate CSS modules classes for testing
|
|
||||||
require('css-modules-require-hook')({ generateScopedName: '[local]' });
|
|
||||||
|
|
||||||
require.extensions['.svg'] = () => null;
|
|
||||||
|
|
||||||
var jsdom = require('jsdom').jsdom;
|
|
||||||
|
|
||||||
var chai = require('chai');
|
|
||||||
var sinonChai = require('sinon-chai');
|
|
||||||
|
|
||||||
var exposedProperties = [ 'window', 'navigator', 'document' ];
|
|
||||||
|
|
||||||
global.document = jsdom('');
|
|
||||||
global.window = document.defaultView;
|
|
||||||
|
|
||||||
global.expect = chai.expect;
|
|
||||||
|
|
||||||
chai.use(sinonChai);
|
|
||||||
|
|
||||||
Object.keys(document.defaultView).forEach(property => {
|
|
||||||
if (typeof global[property] === 'undefined') {
|
|
||||||
exposedProperties.push(property);
|
|
||||||
global[property] = document.defaultView[property];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
global.navigator = { userAgent: 'node.js' };
|
|
||||||
|
|
||||||
documentRef = document;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { shallow } from 'enzyme';
|
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
|
||||||
|
|
||||||
import Routes from '../../src/routes';
|
|
||||||
|
|
||||||
describe('Routes', () => {
|
|
||||||
it('contains spec with an expectation', () => {
|
|
||||||
expect(shallow(<Routes />).find(Router)).to.have.length(1);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user