Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

Moving bottom-widget to ts (#1710)

dariaterekhovaae8a06f7115bdf
diff --git a/src/components/bottom-widget.d.ts b/src/components/bottom-widget.d.ts
deleted file mode 100644
index c936aff70..000000000
--- a/src/components/bottom-widget.d.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from 'react';
-import {Datasets, Filter, AnimationConfig} from 'reducers/vis-state-updaters';
-import {UiState} from 'reducers/ui-state-updaters';
-import * as UIStateActions from 'actions/ui-state-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
-import {Layer} from 'layers';
-
-export type BottomWidgetProps = {
- datasets: Datasets;
- filters: Filter[];
- layers: Layer[];
- animationConfig: AnimationConfig;
- uiStateActions: typeof UIStateActions;
- visStateActions: typeof VisStateActions;
- rootRef: React.ForwardedRef<HTMLDivElement>;
- containerW: number;
- uiState: UiState;
- sidePanelWidth: number;
- legendWidth: number;
- toggleModal: typeof UIStateActions.toggleModal;
- children?: React.ReactNode;
-};
-
-export function BottomWidgetFactory(
- TimeWidget: typeof React.Component,
- AnimationControl: typeof React.Component,
- FilterAnimationController: typeof React.Component,
- LayerAnimationController: typeof React.Component
-): any;
-
-export default BottomWidgetFactory;
-
-export function LayerAnimationControllerFactory(): React.Component;
-export function FilterAnimationControllerFactory(): React.Component;
diff --git a/src/components/bottom-widget.js b/src/components/bottom-widget.tsx
similarity index 96%
rename from src/components/bottom-widget.js
rename to src/components/bottom-widget.tsx
index 0591d34f4..7c795f16b 100644
--- a/src/components/bottom-widget.js
+++ b/src/components/bottom-widget.tsx
@@ -47,7 +47,7 @@ const BottomWidgetContainer = styled.div`
`;
FilterAnimationControllerFactory.deps = [AnimationControllerFactory];
-export function FilterAnimationControllerFactory(AnimationController) {
+export function FilterAnimationControllerFactory(AnimationController: ReturnType<typeof AnimationControllerFactory>) {
const FilterAnimationController = ({filter, filterIdx, setFilterAnimationTime, children}) => {
const intervalBins = useMemo(() => getIntervalBins(filter), [filter]);
@@ -91,7 +91,7 @@ export function FilterAnimationControllerFactory(AnimationController) {
}
LayerAnimationControllerFactory.deps = [AnimationControllerFactory];
-export function LayerAnimationControllerFactory(AnimationController) {
+export function LayerAnimationControllerFactory(AnimationController: ReturnType<typeof AnimationControllerFactory>) {
const LayerAnimationController = ({animationConfig, setLayerAnimationTime, children}) => (
<AnimationController
key="layer-control"
@@ -119,10 +119,10 @@ BottomWidgetFactory.deps = [
/* eslint-disable complexity */
export default function BottomWidgetFactory(
- TimeWidget,
- AnimationControl,
- FilterAnimationController,
- LayerAnimationController
+ TimeWidget: ReturnType<typeof TimeWidgetFactory>,
+ AnimationControl: ReturnType<typeof AnimationControlFactory>,
+ FilterAnimationController: ReturnType<typeof FilterAnimationControllerFactory>,
+ LayerAnimationController: ReturnType<typeof LayerAnimationControllerFactory>
) {
const BottomWidget = props => {
const {
@@ -210,15 +210,12 @@ export default function BottomWidgetFactory(
<TimeWidget
// TimeWidget uses React.memo, here we pass width
// even though it doesnt use it, to force rerender
- width={enlargedFilterWidth}
filter={filters[enlargedFilterIdx]}
index={enlargedFilterIdx}
- isAnyFilterAnimating={Boolean(animatedFilter)}
datasets={datasets}
readOnly={readOnly}
showTimeDisplay={showFloatingTimeDisplay}
setFilterPlot={visStateActions.setFilterPlot}
- setFilter={visStateActions.setFilter}
setFilterAnimationTime={visStateActions.setFilterAnimationTime}
setFilterAnimationWindow={visStateActions.setFilterAnimationWindow}
toggleAnimation={visStateActions.toggleFilterAnimation}