mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-29 08:48:11 +08:00
expression reducer and stubbed out component
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import React from "react";
|
||||
import _ from "lodash";
|
||||
import { connect } from "react-redux";
|
||||
import * as globals from "../../globals";
|
||||
import styles from "./expression.css";
|
||||
import SectionHeader from "../framework/sectionHeader"
|
||||
|
||||
@connect((state) => {
|
||||
|
||||
return {
|
||||
expression: state.expression.data
|
||||
}
|
||||
})
|
||||
class Expression extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
|
||||
};
|
||||
}
|
||||
handleClick() {
|
||||
|
||||
}
|
||||
render () {
|
||||
if (!this.props.expression) return null
|
||||
return (
|
||||
<div style={{marginTop: 50}}>
|
||||
<SectionHeader text="Expression"/>
|
||||
{
|
||||
_.map(this.props.expression.genes, (gene) => {
|
||||
return (
|
||||
<button
|
||||
key={gene}
|
||||
onClick={this.handleClick.bind(this)}
|
||||
style={{marginRight: 10}}>
|
||||
{gene}
|
||||
</button>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
export default Expression;
|
||||
@@ -0,0 +1,29 @@
|
||||
const Expression = (state = {
|
||||
data: null,
|
||||
loading: null,
|
||||
error: null,
|
||||
}, action) => {
|
||||
switch (action.type) {
|
||||
case "get expression started":
|
||||
return Object.assign({}, state, {
|
||||
loading: true,
|
||||
error: null
|
||||
});
|
||||
case "get expression success":
|
||||
return Object.assign({}, state, {
|
||||
error: null,
|
||||
loading: false,
|
||||
data: action.data.data,
|
||||
});
|
||||
case "get expression error":
|
||||
return Object.assign({}, state, {
|
||||
data: null,
|
||||
loading: false,
|
||||
error: action.data
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default Expression;
|
||||
Reference in New Issue
Block a user