mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-25 16:58:12 +08:00
* type camera
* type reducer store
* type actionhelpers
* type catchErrorsWrap callsite
* missed camera member var
* type nameCreators
* type makeContinousDimensionName callsite
* type promise limit
* type quantile
* type range
* introduce TypedArray + NumericArray
* type range
* cleanup test
* fix call sites
* type plimit call site
* finish typing camera
* use our TypedArray
* type scientific and sigFig utils and callsites
* simple typings
* type catLabelSort
* type callsite
* type
* callsites
* type camera methods
* swap back to strings, set defaults accordingly
* partially type centroid
* explicit tuple and undefined check
* fix references to this
* call constructor with new and casting
* Revert "introduce TypedArray + NumericArray"
This reverts commit cf21538717.
* explicit tuple
* generics and import fixes
* add unsigned 8 clamped arrray
* back to literals
* use arraytypes
* fix return state
* type more actions
* Update client/src/util/actionHelpers.ts
Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
* properly type dispatch
* properly type thunk
* use new dispatch
* remove nullish coallescer
* use AppDispatch
* generic jsonrequest
* use dispatch again
* lint
Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import type { Action } from "redux";
|
|
|
|
import { makeContinuousDimensionName } from "../util/nameCreators";
|
|
|
|
import type { ContinuousNamespace } from "../util/nameCreators";
|
|
|
|
export interface ContinuousSelectionAction extends Action<string> {
|
|
continuousNamespace: ContinuousNamespace;
|
|
selection: string;
|
|
range: [number, number];
|
|
}
|
|
|
|
export interface ContinuousSelectionState {
|
|
[name: string]: [number, number];
|
|
}
|
|
|
|
const ContinuousSelection = (
|
|
state: ContinuousSelectionState = {},
|
|
action: ContinuousSelectionAction
|
|
): ContinuousSelectionState => {
|
|
switch (action.type) {
|
|
case "reset subset":
|
|
case "subset to selection":
|
|
case "set clip quantiles": {
|
|
return {};
|
|
}
|
|
case "continuous metadata histogram start":
|
|
case "continuous metadata histogram brush":
|
|
case "continuous metadata histogram end": {
|
|
const name = makeContinuousDimensionName(
|
|
action.continuousNamespace,
|
|
action.selection
|
|
);
|
|
return {
|
|
...state,
|
|
[name]: action.range,
|
|
};
|
|
}
|
|
case "continuous metadata histogram cancel": {
|
|
const name = makeContinuousDimensionName(
|
|
action.continuousNamespace,
|
|
action.selection
|
|
);
|
|
const { [name]: deletedField, ...newState } = state;
|
|
return newState;
|
|
}
|
|
default: {
|
|
return state;
|
|
}
|
|
}
|
|
};
|
|
|
|
export default ContinuousSelection;
|