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

Dataset title, better filter display & download modal #462

Merged
merged 25 commits into from
Sep 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
05b55c3
remove filters from sidebar
jameshadfield Sep 26, 2017
45afde8
filters in footer and taken from metadata->filters
jameshadfield Sep 26, 2017
872acc6
improve code
jameshadfield Sep 27, 2017
dcd5d83
filter button styling (CSS)
jameshadfield Sep 27, 2017
22a8295
First pass at dataset title card
trvrb Sep 5, 2017
dacfc20
uses filters
jameshadfield Sep 8, 2017
03741a5
fix react warning
jameshadfield Sep 27, 2017
48f64dc
author filter tweaks
jameshadfield Sep 27, 2017
6c4afd3
Paragraph style filters in header
jameshadfield Sep 27, 2017
8a0b1cb
stylistic improvements
jameshadfield Sep 27, 2017
cf914db
info (header) collapsable via toggle
jameshadfield Sep 27, 2017
e7d2c95
remove author links from download modal
jameshadfield Sep 27, 2017
dd7015b
Separate preamble from authors filter
trvrb Sep 28, 2017
09f6f24
title doesn't overlap toggle
jameshadfield Sep 28, 2017
71ba5d8
info starts collapsed, expands when filters selected
jameshadfield Sep 28, 2017
70f8ca5
show number of genomes in collapsed header title
jameshadfield Sep 28, 2017
9e5640a
branch selected message in info card
jameshadfield Sep 28, 2017
e8b0b99
bug fix
jameshadfield Sep 28, 2017
415e08c
date filter included in info card
jameshadfield Sep 28, 2017
b958d2f
reset date filter button
jameshadfield Sep 28, 2017
5f37a7a
info shows map animation status
jameshadfield Sep 29, 2017
b332cbe
single "reset all filters" button
jameshadfield Sep 29, 2017
a42eeb8
no toggle. info expands iff filters active.
jameshadfield Sep 29, 2017
3420964
Don't show date filter in info
trvrb Sep 30, 2017
90e1999
Add toggle to enable data download
trvrb Sep 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ rules:
no-console: [1, { "allow": ["warn", "error"] }]
no-param-reassign: [1, { "props": false }]
no-unused-expressions: ['error', {"allowTernary": true }]
no-restricted-syntax: ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'] # allow ForOfStatement
no-restricted-syntax: ['error', 'ForInStatement', 'WithStatement'] # allow ForOfStatement & LabeledStatement
react/jsx-tag-spacing: ["error", { "closingSlash": "never", "beforeSelfClosing": "allow", "afterOpening": "never" }]
react/forbid-prop-types: off
react/jsx-filename-extension: [1, { "extensions": [".js", ".jsx"] }]
react/jsx-first-prop-new-line: off
react/prop-types: off # possibly reinstate
react/sort-comp: off # possibly reinstate
jsx-a11y/no-static-element-interactions: off
no-labels: off
no-continue: off
parserOptions:
ecmaVersion: 6
sourceType: module
Expand Down
11 changes: 7 additions & 4 deletions src/actions/treeProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ const calculateVisiblityAndBranchThickness = (tree, controls, dates, {idxOfInVie
* @return {null} side effects: a single action
*/
export const updateVisibleTipsAndBranchThicknesses = function (
{idxOfInViewRootNode = 0, tipSelectedIdx = 0} = {}) {
{idxOfInViewRootNode = undefined, tipSelectedIdx = 0} = {}) {
return (dispatch, getState) => {
const { tree, controls } = getState();
if (!tree.nodes) {return;}
const data = calculateVisiblityAndBranchThickness(tree, controls, {dateMin: controls.dateMin, dateMax: controls.dateMax}, {tipSelectedIdx, idxOfInViewRootNode});
const validIdxRoot = idxOfInViewRootNode !== undefined ? idxOfInViewRootNode : tree.idxOfInViewRootNode;
const data = calculateVisiblityAndBranchThickness(tree, controls, {dateMin: controls.dateMin, dateMax: controls.dateMax}, {tipSelectedIdx, validIdxRoot});
dispatch({
type: types.UPDATE_VISIBILITY_AND_BRANCH_THICKNESS,
visibility: data.visibility,
visibilityVersion: data.visibilityVersion,
branchThickness: data.branchThickness,
branchThicknessVersion: data.branchThicknessVersion
branchThicknessVersion: data.branchThicknessVersion,
idxOfInViewRootNode: validIdxRoot
});
};
};
Expand Down Expand Up @@ -70,7 +72,8 @@ export const changeDateFilter = function ({newMin = false, newMax = false, quick
visibility: data.visibility,
visibilityVersion: data.visibilityVersion,
branchThickness: data.branchThickness,
branchThicknessVersion: data.branchThicknessVersion
branchThicknessVersion: data.branchThicknessVersion,
idxOfInViewRootNode: tree.idxOfInViewRootNode
});
};
};
Expand Down
1 change: 1 addition & 0 deletions src/actions/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ export const TRIGGER_DOWNLOAD_MODAL = "TRIGGER_DOWNLOAD_MODAL";
export const DISMISS_DOWNLOAD_MODAL = "DISMISS_DOWNLOAD_MODAL";
export const ADD_COLOR_BYS = "ADD_COLOR_BYS";
export const MANIFEST_RECEIVED = "MANIFEST_RECEIVED";
export const CHANGE_TREE_ROOT_IDX = "CHANGE_TREE_ROOT_IDX";
4 changes: 4 additions & 0 deletions src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Controls from "./controls/controls";
// import Frequencies from "./charts/frequencies";
import Entropy from "./charts/entropy";
import Map from "./map/map";
import Info from "./info/info";
import TreeView from "./tree/treeView";
import { controlsHiddenWidth } from "../util/globals";
import TitleBar from "./framework/title-bar";
Expand Down Expand Up @@ -102,6 +103,9 @@ class App extends React.Component {
sidebarClassName={"sidebar"}
>
<Background>
<Info
sidebar={this.state.sidebarOpen || this.state.sidebarDocked}
/>
<TreeView
query={queryString.parse(this.context.router.history.location.search)}
sidebar={this.state.sidebarOpen || this.state.sidebarDocked}
Expand Down
4 changes: 0 additions & 4 deletions src/components/controls/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import ChooseMetric from "./choose-metric";
import PanelLayout from "./panel-layout";
import GeoResolution from "./geo-resolution";
import MapAnimationControls from "./map-animation";
import AllFilters from "./all-filter";
import { controlsWidth, enableAnimationDisplay } from "../../util/globals";
import { titleStyles } from "../../globalStyles";

Expand Down Expand Up @@ -87,9 +86,6 @@ class Controls extends React.Component {
<SelectLabel text="Panel layout"/>
<PanelLayout/>

{header("Filters")}
<AllFilters/>

</Flex>
);
}
Expand Down
26 changes: 18 additions & 8 deletions src/components/controls/toggle.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
import React from "react";
import SelectLabel from "../framework/select-label";

const Toggle = ({display, on, callback, label}) => {
const Toggle = ({
display,
on,
callback,
label,
style = {},
sliderStyle = {marginLeft: "40px"},
labelStyle = {marginLeft: "40px", marginTop: "4px", width: "200px"}
}) => {
if (!display) {
return null;
}
return (
<div>
<div style={style}>
<label className="switch">
<input
className="switch"
type="checkbox"
style={{marginLeft: "40px"}}
style={sliderStyle}
checked={on}
onChange={callback}
/>
<div className={"slider round"}></div>
<SelectLabel
text={label}
extraStyles={{marginLeft: "40px", marginTop: "4px", width: "200px"}}
/>
<div className={"slider round"}/>
{label === "" ? null : (
<SelectLabel
text={label}
extraStyles={labelStyle}
/>
)}
</label>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/download/downloadModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class DownloadModal extends React.Component {
}).map((k) => (
<span key={k}>
{helpers.getAuthor(meta.author_info, k)}
{" (n = " + meta.author_info[k].n + "), "}
{" (n=" + meta.author_info[k].n + "), "}
</span>
))}

Expand Down
15 changes: 8 additions & 7 deletions src/components/download/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ export const getAuthor = (info, k) => {
<span>Not Available</span>
);
}
if (isPaperURLValid(info[k])) {
return (
<a href={formatURLString(info[k].paper_url)} target="_blank">
{authorString(k)}
</a>
);
}
// TODO: improve this block
// if (isPaperURLValid(info[k])) {
// return (
// <a href={formatURLString(info[k].paper_url)} target="_blank">
// {authorString(k)}
// </a>
// );
// }
return authorString(k);
};

Expand Down
Loading