Skip to content

Commit

Permalink
reorganise files
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshadfield committed Sep 14, 2017
1 parent 0539c28 commit 4d26728
Show file tree
Hide file tree
Showing 31 changed files with 76 additions and 329 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Expand Up @@ -16,6 +16,7 @@ rules:
dot-notation: off # allows someObject["a"] as well as someObject.a
comma-dangle: ["error", "never"]
padded-blocks: off
no-plusplus: off # we are old enought to use i++
arrow-body-style: off
arrow-parens: ["error", "always"] # use brackets always, (a) => body // () => body // (a, b) => body
no-case-declarations: off # we don't surround case blocks with { } in our switch statements as we use fallthroughs deliberately
Expand Down
3 changes: 0 additions & 3 deletions .jshintrc

This file was deleted.

39 changes: 0 additions & 39 deletions src/actions/ACTION_TEMPLATE.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/actions/colors.js
@@ -1,6 +1,6 @@
import { parseGenotype } from "../util/getGenotype";
import getColorScale from "../util/getColorScale";
import { calcNodeColor } from "../util/treeHelpers";
import { calcNodeColor } from "../components/tree/treeHelpers";
import * as types from "./types";

export const updateColors = function (providedColorBy = undefined) {
Expand Down
5 changes: 2 additions & 3 deletions src/actions/filesDropped.js
@@ -1,8 +1,7 @@
/*eslint max-len: 0*/
import { infoNotification, errorNotification, successNotification, warningNotification } from "./notifications";
import Papa from "papaparse";
import { errorNotification, successNotification, warningNotification } from "./notifications";
import { ADD_COLOR_BYS } from "./types";
import { turnAttrsIntoHeaderArray } from "../util/downloadDataFunctions";
import { turnAttrsIntoHeaderArray } from "../components/download/helperFunctions";

const csvCompleteCallback = (dispatch, getState, results, file) => {
const { tree } = getState();
Expand Down
2 changes: 1 addition & 1 deletion src/actions/treeProperties.js
Expand Up @@ -2,7 +2,7 @@ import { calcVisibility,
calcTipRadii,
calcTipCounts,
identifyPathToTip,
calcBranchThickness } from "../util/treeHelpers";
calcBranchThickness } from "../components/tree/treeHelpers";
import * as types from "./types";

const calculateVisiblityAndBranchThickness = (tree, controls, dates, {idxOfInViewRootNode = 0, tipSelectedIdx = 0} = {}) => {
Expand Down
105 changes: 0 additions & 105 deletions src/components/COMPONENT_TEMPLATE.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/components/STATELESS_TEMPLATE.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/app.js
Expand Up @@ -15,7 +15,7 @@ import TreeView from "./tree/treeView";
import { controlsHiddenWidth } from "../util/globals";
import TitleBar from "./framework/title-bar";
import Footer from "./framework/footer";
import DownloadModal from "./controls/downloadModal";
import DownloadModal from "./download/downloadModal";
import { analyticsNewPage } from "../util/googleAnalytics";
import filesDropped from "../actions/filesDropped";

Expand Down
Expand Up @@ -5,32 +5,9 @@ import { DISMISS_DOWNLOAD_MODAL } from "../../actions/types";
import { materialButton, medGrey, infoPanelStyles } from "../../globalStyles";
import { stopProp } from "../tree/tipSelectedPanel";
import { authorString, formatURLString } from "../../util/stringHelpers";
import * as download from "../../util/downloadDataFunctions";
import * as helpers from "./helperFunctions";
import * as icons from "../framework/svg-icons";

export const isPaperURLValid = (d) => {
return (
Object.prototype.hasOwnProperty.call(d, "paper_url") &&
!d.paper_url.endsWith('/') &&
d.paper_url !== "?"
);
};

export const getAuthor = (info, k) => {
if (info === undefined || k === undefined) {
return (
<span>Not Available</span>
);
}
if (isPaperURLValid(info[k])) {
return (
<a href={formatURLString(info[k].paper_url)} target="_blank">
{authorString(k)}
</a>
);
}
return authorString(k);
};

@connect((state) => ({
browserDimensions: state.browserDimensions.browserDimensions,
Expand Down Expand Up @@ -99,11 +76,11 @@ class DownloadModal extends React.Component {
const iconWidth = 25;
const iconStroke = medGrey;
const buttons = [
["Tree (newick)", (<icons.RectangularTree width={iconWidth} stroke={iconStroke} />), () => download.newick(this.props.dispatch, dataset, this.props.tree.nodes[0], false)],
["TimeTree (newick)", (<icons.RectangularTree width={iconWidth} stroke={iconStroke} />), () => download.newick(this.props.dispatch, dataset, this.props.tree.nodes[0], true)],
["Strain Metadata (CSV)", (<icons.Meta width={iconWidth} stroke={iconStroke} />), () => download.strainCSV(this.props.dispatch, dataset, this.props.tree.nodes, this.props.tree.attrs)],
["Author Metadata (CSV)", (<icons.Meta width={iconWidth} stroke={iconStroke} />), () => download.authorCSV(this.props.dispatch, dataset, this.props.metadata.metadata)],
["Screenshot (SGV)", (<icons.Panels width={iconWidth} stroke={iconStroke} />), () => download.SVG(this.props.dispatch, dataset)]
["Tree (newick)", (<icons.RectangularTree width={iconWidth} stroke={iconStroke} />), () => helpers.newick(this.props.dispatch, dataset, this.props.tree.nodes[0], false)],
["TimeTree (newick)", (<icons.RectangularTree width={iconWidth} stroke={iconStroke} />), () => helpers.newick(this.props.dispatch, dataset, this.props.tree.nodes[0], true)],
["Strain Metadata (CSV)", (<icons.Meta width={iconWidth} stroke={iconStroke} />), () => helpers.strainCSV(this.props.dispatch, dataset, this.props.tree.nodes, this.props.tree.attrs)],
["Author Metadata (CSV)", (<icons.Meta width={iconWidth} stroke={iconStroke} />), () => helpers.authorCSV(this.props.dispatch, dataset, this.props.metadata.metadata)],
["Screenshot (SGV)", (<icons.Panels width={iconWidth} stroke={iconStroke} />), () => helpers.SVG(this.props.dispatch, dataset)]
];
return (
<div className="row">
Expand Down Expand Up @@ -151,7 +128,7 @@ class DownloadModal extends React.Component {
return meta.author_info[a].n > meta.author_info[b].n ? -1 : 1;
}).map((k) => (
<span key={k}>
{getAuthor(meta.author_info, k)}
{helpers.getAuthor(meta.author_info, k)}
{" (n = " + meta.author_info[k].n + "), "}
</span>
))}
Expand Down
@@ -1,7 +1,31 @@
/* eslint no-restricted-syntax: 0 */
import { infoNotification, errorNotification, successNotification, warningNotification } from "../actions/notifications";
import { prettyString, formatURLString } from "./stringHelpers";
import { isPaperURLValid } from "../components/controls/downloadModal";
import React from "react";
import { infoNotification, errorNotification, successNotification, warningNotification } from "../../actions/notifications";
import { prettyString, formatURLString, authorString } from "../../util/stringHelpers";

export const isPaperURLValid = (d) => {
return (
Object.prototype.hasOwnProperty.call(d, "paper_url") &&
!d.paper_url.endsWith('/') &&
d.paper_url !== "?"
);
};

export const getAuthor = (info, k) => {
if (info === undefined || k === undefined) {
return (
<span>Not Available</span>
);
}
if (isPaperURLValid(info[k])) {
return (
<a href={formatURLString(info[k].paper_url)} target="_blank">
{authorString(k)}
</a>
);
}
return authorString(k);
};

/* this function based on https://github.com/daviddao/biojs-io-newick/blob/master/src/newick.js */
const treeToNewick = (root, temporal) => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/map/map.js
Expand Up @@ -8,18 +8,18 @@ import { select } from "d3-selection";
import leafletImage from "leaflet-image";
import Card from "../framework/card";
import { numericToCalendar, calendarToNumeric } from "../../util/dateHelpers";
import { drawDemesAndTransmissions, updateOnMoveEnd, updateVisibility } from "../../util/mapHelpers";
import { drawDemesAndTransmissions, updateOnMoveEnd, updateVisibility } from "./mapHelpers";
import { enableAnimationDisplay, animationWindowWidth, animationTick, twoColumnBreakpoint, enableAnimationPerfTesting } from "../../util/globals";
import computeResponsive from "../../util/computeResponsive";
import { modifyURLquery } from "../../util/urlHelpers";
import {
createDemeAndTransmissionData,
updateDemeAndTransmissionDataColAndVis,
updateDemeAndTransmissionDataLatLong
} from "../../util/mapHelpersLatLong";
} from "./mapHelpersLatLong";
import { changeDateFilter } from "../../actions/treeProperties";
import { MAP_ANIMATION_PLAY_PAUSE_BUTTON } from "../../actions/types";
import { incommingMapPNG } from "../../util/downloadDataFunctions";
import { incommingMapPNG } from "../download/helperFunctions";

/* global L */
// L is global in scope and placed by leaflet()
Expand Down
File renamed without changes.
Expand Up @@ -2,7 +2,7 @@ import _forOwn from "lodash/forOwn";
import _map from "lodash/map";
import _minBy from "lodash/minBy";
import { interpolateNumber } from "d3-interpolate";
import { averageColors } from "./colorHelpers";
import { averageColors } from "../../util/colorHelpers";
import { computeMidpoint, Bezier } from "./transmissionBezier";

/* global L */
Expand Down
File renamed without changes.
64 changes: 0 additions & 64 deletions src/components/tree/deadCode.js

This file was deleted.

0 comments on commit 4d26728

Please sign in to comment.