Skip to content

Commit

Permalink
appease tsc / eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshadfield committed Nov 14, 2024
1 parent 42c111e commit acbc70c
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/actions/recomputeReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,8 @@ export const createStateFromQueryOrJSONs = ({
'none';
}
tree.streams = partitionIntoStreams(controls.showStreamTrees, controls.streamTreeBranchLabel, tree.nodes, tree.visibility, controls.colorScale, controls.absoluteDateMinNumeric, controls.absoluteDateMaxNumeric, controls.distanceMeasure)
console.log("tree.streams", tree.streams)
// eslint-disable-next-line
console.log("tree.streams", tree.streams); // TODO - remove console log

/* calculate entropy in view */
if (entropy.loaded) {
Expand Down
1 change: 0 additions & 1 deletion src/components/controls/choose-metric.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { connect } from "react-redux";
import { withTranslation } from "react-i18next";
import { CHANGE_DISTANCE_MEASURE } from "../../actions/types";
import { analyticsControlsEvent } from "../../util/googleAnalytics";
import { toggleTemporalConfidence } from "../../actions/tree";
import { toggleStreamTree, changeDistanceMeasure } from "../../actions/streamTrees";
Expand Down
2 changes: 0 additions & 2 deletions src/components/tree/phyloTree/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ export const change = function change(
this.streamLayout(); // recompute displayOrder values across pivots
mapStreamsToScreen(this.streams, this.phyloStreams, this.xScale, this.yScale); // recompute pixels (unneeded for branches/tips)
this.drawStreams(); // remove & redraw
this.drawStreamConnectors(); // remove & redraw
}
// don't have good methods to remove tips etc (yet)
for (const name of ['branchLabels', 'branchTee', 'branchStem', 'tips', 'tipLabels', 'vaccines']) {
Expand Down Expand Up @@ -453,7 +452,6 @@ export const change = function change(
this.streamLayout(); // recompute displayOrder values across pivots
mapStreamsToScreen(this.streams, this.phyloStreams, this.xScale, this.yScale); // recompute pixels (unneeded for branches/tips)
this.drawStreams(); // remove & redraw
this.drawStreamConnectors(); // remove & redraw
}
// recalculate existing regression if needed
if (changeVisibility && this.regression) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/tree/phyloTree/layouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,9 @@ export function mapStreamsToScreen(streams, phyloStreams, xScale, yScale) {
/* it's important we only set this up once, as DOM elements will bind to data within, so we need to mutate it */
if (!phyloStream.ripples) {
const _area = area()
.x((d) => d.x)
.y0((d) => d.y0)
.y1((d) => d.y1)
.x((d: any) => d.x) // TODO XXX fix types
.y0((d: any) => d.y0) // TODO XXX fix types
.y1((d: any) => d.y1) // TODO XXX fix types
.curve(curveCatmullRom.alpha(0.5))

phyloStream.ripples = phyloStream.displayOrderByCategory.map((displayOrderByPivot) => {
Expand Down
1 change: 0 additions & 1 deletion src/components/tree/phyloTree/phyloTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ PhyloTree.prototype.drawRegression = renderers.drawRegression;
PhyloTree.prototype.removeRegression = renderers.removeRegression;
PhyloTree.prototype.updateColorBy = renderers.updateColorBy;
PhyloTree.prototype.drawStreams = renderers.drawStreams;
PhyloTree.prototype.drawStreamConnectors = renderers.drawStreamConnectors;

/* C A L C U L A T E G E O M E T R I E S E T C ( M O D I F I E S N O D E S , N O T S V G ) */
PhyloTree.prototype.setDistance = layouts.setDistance;
Expand Down
8 changes: 1 addition & 7 deletions src/components/tree/phyloTree/renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export const render = function render(
this.updateTipLabels();
this.drawTips();
this.drawStreams();
this.drawStreamConnectors();
if (this.params.branchLabelKey) this.drawBranchLabels(this.params.branchLabelKey);
if (this.vaccines) this.drawVaccines();
if (this.regression) this.drawRegression();
Expand Down Expand Up @@ -357,15 +356,10 @@ export function drawStreams(this: PhyloTreeType): void {
.style("fill", "none")
.style('visibility', 'visible')
.style('cursor', 'pointer') // using a dashed line doesn't play nicely with onhover/onclick behaviour :(
.on("click", this.callbacks.onStreamConnectorClick);
.on("click", this.callbacks.onStreamConnectorClick as any); // TODO - fix type
}
}

export function drawStreamConnectors() {
console.log("drawStreamConnectors is currently a no-op")
}


/**
* draws the regression line in the svg and adds a text with the rate estimate
*/
Expand Down
2 changes: 2 additions & 0 deletions src/components/tree/phyloTree/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Selection } from "d3";
import { Layout, PerformanceFlags, ScatterVariables } from "../../../reducers/controls";
import { ReduxNode, Visibility } from "../../../reducers/tree/types";
import { change, modifySVG, modifySVGInStages } from "./change";
import { TreeComponent } from "../tree";

import * as confidence from "./confidence";
import * as grid from "./grid";
Expand Down Expand Up @@ -47,6 +48,7 @@ export interface Callbacks {
onTipHover: NodeCallback
onTipLeave: NodeCallback
tipLabel: NodeCallback
onStreamConnectorClick: (this: TreeComponent, phyloStream: any) => void
}

// ---------- PhyloNode ---------- //
Expand Down
5 changes: 2 additions & 3 deletions src/components/tree/reactD3Interface/callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ export const onBranchClick = function onBranchClick(this: TreeComponent, d: Phyl
this.props.dispatch(updateVisibleTipsAndBranchThicknesses({root, cladeSelected}));
};

export function onStreamConnectorClick(phyloStream) {
console.log("CLICK", phyloStream, this)
const root = [this.state.tree.streams.streams[phyloStream.streamIdx].founderIdx, undefined];
export function onStreamConnectorClick(this: TreeComponent, phyloStream: any) {
const root = [this.state.tree.streams.streams[phyloStream.streamIdx].founderIdx, undefined] as [number, undefined]; // TODO fix type
this.props.dispatch(updateVisibleTipsAndBranchThicknesses({root, cladeSelected: undefined}));

// TODO - this zoom is wrong because underneath it all we're zooming to the display Order values of the subtree
Expand Down
2 changes: 0 additions & 2 deletions src/reducers/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,8 @@ const Controls = (state: ControlsState = getDefaultControlsState(), action): Con
case types.TOGGLE_LEGEND:
return Object.assign({}, state, { legendOpen: action.value });
case types.TOGGLE_STREAM_TREE:
console.log("Controls reducer. Show?", action.showStreamTrees, "Label (unchanged):", state.streamTreeBranchLabel);
return {...state, showStreamTrees: action.showStreamTrees};
case types.CHANGE_STREAM_TREE_BRANCH_LABEL:
console.log("Controls reducer. Show?", action.showStreamTrees, "Label", action.streamTreeBranchLabel);
return {...state, showStreamTrees: action.showStreamTrees, streamTreeBranchLabel: action.streamTreeBranchLabel};
case types.ADD_EXTRA_METADATA: {
for (const colorBy of Object.keys(action.newColorings)) {
Expand Down
2 changes: 1 addition & 1 deletion src/util/partitionIntoStreams.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,6 @@ function getFounderTree(treeNodes, branchLabel) {
})


console.log({founderTree, founderIndiciesToDescendantFounderIndicies, foundersPostorder, streamGroups})
// console.log({founderTree, founderIndiciesToDescendantFounderIndicies, foundersPostorder, streamGroups})
return {founderTree, founderIndiciesToDescendantFounderIndicies, foundersPostorder, streamGroups};
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Visit https://aka.ms/tsconfig.json for a detailed list of options.
/* Language and Environment */
"jsx": "react", /* Specify what JSX code is generated. */
"target": "es2015",
"lib": ["esnext", "dom"],

/* Modules */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
Expand Down

0 comments on commit acbc70c

Please sign in to comment.