Skip to content

Commit

Permalink
Correction via prettier
Browse files Browse the repository at this point in the history
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
  • Loading branch information
dariaterekhova-actionengine committed Apr 15, 2022
1 parent b4684f1 commit 00c5553
Show file tree
Hide file tree
Showing 31 changed files with 320 additions and 289 deletions.
31 changes: 22 additions & 9 deletions src/components/bottom-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import AnimationControllerFactory from './common/animation-control/animation-con
import {ANIMATION_WINDOW, DIMENSIONS, FILTER_TYPES} from 'constants/default-settings';
import {getIntervalBins} from 'utils/filter-utils';
import {media} from 'styles/media-breakpoints';
import { AnimationConfig, TimeRangeFilter } from 'reducers';
import { bottomWidgetSelector } from './kepler-gl';
import {AnimationConfig, TimeRangeFilter} from 'reducers';
import {bottomWidgetSelector} from './kepler-gl';

const maxWidth = 1080;

Expand Down Expand Up @@ -61,8 +61,15 @@ interface FilterAnimationControllerProps {
}

FilterAnimationControllerFactory.deps = [AnimationControllerFactory];
export function FilterAnimationControllerFactory(AnimationController: ReturnType<typeof AnimationControllerFactory>) {
const FilterAnimationController = ({filter, filterIdx, setFilterAnimationTime, children}: FilterAnimationControllerProps) => {
export function FilterAnimationControllerFactory(
AnimationController: ReturnType<typeof AnimationControllerFactory>
) {
const FilterAnimationController = ({
filter,
filterIdx,
setFilterAnimationTime,
children
}: FilterAnimationControllerProps) => {
const intervalBins = useMemo(() => getIntervalBins(filter), [filter]);

const steps = useMemo(() => (intervalBins ? intervalBins.map(x => x.x0) : null), [
Expand Down Expand Up @@ -106,13 +113,19 @@ export function FilterAnimationControllerFactory(AnimationController: ReturnType

interface LayerAnimationControllerProps {
children?: ReactNode;
animationConfig: AnimationConfig & {timeSteps?: number[] | null}
animationConfig: AnimationConfig & {timeSteps?: number[] | null};
setLayerAnimationTime: (x: number) => void;
}

LayerAnimationControllerFactory.deps = [AnimationControllerFactory];
export function LayerAnimationControllerFactory(AnimationController: ReturnType<typeof AnimationControllerFactory>) {
const LayerAnimationController = ({animationConfig, setLayerAnimationTime, children}: LayerAnimationControllerProps) => (
export function LayerAnimationControllerFactory(
AnimationController: ReturnType<typeof AnimationControllerFactory>
) {
const LayerAnimationController = ({
animationConfig,
setLayerAnimationTime,
children
}: LayerAnimationControllerProps) => (
<AnimationController<number>
key="layer-control"
value={Number(animationConfig.currentTime)}
Expand All @@ -132,7 +145,7 @@ export function LayerAnimationControllerFactory(AnimationController: ReturnType<

type BottomWidgetProps = {
containerW: number;
} & ReturnType<typeof bottomWidgetSelector>
} & ReturnType<typeof bottomWidgetSelector>;

BottomWidgetFactory.deps = [
TimeWidgetFactory,
Expand Down Expand Up @@ -196,7 +209,7 @@ export default function BottomWidgetFactory(

// if filter is not animating, pass in enlarged filter here because
// animation controller needs to call reset on it
const filter = animatedFilter as TimeRangeFilter || filters[enlargedFilterIdx];
const filter = (animatedFilter as TimeRangeFilter) || filters[enlargedFilterIdx];

return (
<BottomWidgetContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ const StyledDomain = styled.div.attrs({

AnimationControlFactory.deps = [PlaybackControlsFactory, FloatingTimeDisplayFactory];

function AnimationControlFactory(PlaybackControls: ReturnType<typeof PlaybackControlsFactory>, FloatingTimeDisplay: ReturnType<typeof FloatingTimeDisplayFactory>) {
function AnimationControlFactory(
PlaybackControls: ReturnType<typeof PlaybackControlsFactory>,
FloatingTimeDisplay: ReturnType<typeof FloatingTimeDisplayFactory>
) {
const AnimationControl = ({
isAnimatable,
isAnimating,
Expand Down
13 changes: 8 additions & 5 deletions src/components/common/animation-control/animation-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ interface AnimationControllerProps<T extends number | number[]> {
baseSpeed?: number;
}

class AnimationControllerType<T extends number | number[]> extends Component<AnimationControllerProps<T>>{}
class AnimationControllerType<T extends number | number[]> extends Component<
AnimationControllerProps<T>
> {}

function AnimationControllerFactory(): typeof AnimationControllerType {
/**
Expand All @@ -60,15 +62,16 @@ function AnimationControllerFactory(): typeof AnimationControllerType {
* Current time is a point. An array of sorted time steps are provided,
* animate a moving point jumps to the next step
*/
class AnimationController<T extends number | number[]> extends Component<AnimationControllerProps<T>> {

class AnimationController<T extends number | number[]> extends Component<
AnimationControllerProps<T>
> {
static defaultProps = {
baseSpeed: BASE_SPEED,
speed: 1,
steps: null,
animationWindow: ANIMATION_WINDOW.free
};

state = {
isAnimating: false
};
Expand Down Expand Up @@ -134,7 +137,7 @@ function AnimationControllerFactory(): typeof AnimationControllerType {
};

_resetAnimtionByTimeStep = () => {
const {steps = null} = this.props
const {steps = null} = this.props;
if (!steps) return;
// go to the first steps
this.props.updateAnimation([steps[0], 0] as T);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ AnimationSpeedSliderFactory.deps = [RangeSliderFactory];
interface AnimationSpeedSliderProps {
onHide: () => void;
speed: number;
updateAnimationSpeed: (val: number) => void
updateAnimationSpeed: (val: number) => void;
}

export default function AnimationSpeedSliderFactory(RangeSlider: ReturnType<typeof RangeSliderFactory>): ComponentType<AnimationSpeedSliderProps> {
export default function AnimationSpeedSliderFactory(
RangeSlider: ReturnType<typeof RangeSliderFactory>
): ComponentType<AnimationSpeedSliderProps> {
class AnimationSpeedSlider extends Component<AnimationSpeedSliderProps> {
handleClickOutside = e => {
this.props.onHide();
Expand Down
21 changes: 13 additions & 8 deletions src/components/common/animation-control/floating-time-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ const TimeDivider = () => (
</StyledHorizontalBar>
);

interface TimeDisplayRowProps{
timeValues?: string[]
interface TimeDisplayRowProps {
timeValues?: string[];
}

const TimeDisplayRow = ({timeValues = []}: TimeDisplayRowProps) => (
Expand All @@ -119,14 +119,19 @@ const TimeDisplayRow = ({timeValues = []}: TimeDisplayRowProps) => (
);

interface FloatingTimeDisplayProps {
currentTime: number | number[],
defaultTimeFormat?: string,
timeFormat?: string,
timezone?: string
currentTime: number | number[];
defaultTimeFormat?: string;
timeFormat?: string;
timezone?: string;
}

export default function FloatingTimeDisplayFactory() {
const FloatingTimeDisplay = ({currentTime, defaultTimeFormat, timeFormat, timezone}: FloatingTimeDisplayProps) => {
const FloatingTimeDisplay = ({
currentTime,
defaultTimeFormat,
timeFormat,
timezone
}: FloatingTimeDisplayProps) => {
const {displayDate, displayTime} = useMemo(() => {
const groupTime = Array.isArray(currentTime) ? currentTime : [currentTime];
const hasUserFormat = typeof timeFormat === 'string';
Expand All @@ -140,7 +145,7 @@ export default function FloatingTimeDisplayFactory() {
displayTime: []
};
}
return groupTime.reduce<{displayDate: string[], displayTime: string[]}>(
return groupTime.reduce<{displayDate: string[]; displayTime: string[]}>(
(accu, curr) => {
const [dateFormat, datetimeFormat] = currentFormat.split(' ');
const dateString = dateFunc(dateFormat)(curr);
Expand Down
36 changes: 19 additions & 17 deletions src/components/common/animation-control/playback-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import AnimationSpeedSliderFactory from './animation-speed-slider';
import {Reset, Play, Pause, Rocket, AnchorWindow, FreeWindow} from 'components/common/icons';
import {ANIMATION_WINDOW} from 'constants/default-settings';
import {preciseRound} from 'utils/data-utils';
import { ReactComponentLike } from 'prop-types';
import {ReactComponentLike} from 'prop-types';

const DELAY_SHOW = 500;
const DEFAULT_BUTTON_HEIGHT = '20px';
Expand Down Expand Up @@ -102,18 +102,18 @@ const DEFAULT_ANIMATE_ITEMS = {
};

interface AnimationItem {
id: string,
icon: ReactComponentLike,
tooltip: string
id: string;
icon: ReactComponentLike;
tooltip: string;
}

interface AnimationWindowControlProps {
onClick?: (id: string) => void,
selected?: string,
onHide: ()=>void,
height?: string,
onClick?: (id: string) => void;
selected?: string;
onHide: () => void;
height?: string;
animationItems: {[key: string]: AnimationItem};
btnStyle
btnStyle;
}

export const AnimationWindowControl = ({
Expand All @@ -134,7 +134,7 @@ export const AnimationWindowControl = ({
data-for={`${item.id}-tooltip`}
className="playback-control-button"
onClick={() => {
onClick&&onClick(item.id);
onClick && onClick(item.id);
onHide();
}}
{...btnStyle}
Expand All @@ -152,12 +152,12 @@ export const AnimationWindowControl = ({

interface PlaybackControls {
isAnimatable?: boolean;
isAnimating?: boolean,
width?: number | string,
speed: number,
animationWindow?: string
setFilterAnimationWindow?: (id: string) => void,
updateAnimationSpeed,
isAnimating?: boolean;
width?: number | string;
speed: number;
animationWindow?: string;
setFilterAnimationWindow?: (id: string) => void;
updateAnimationSpeed;
pauseAnimation?: () => void;
resetAnimation: () => void;
startAnimation: () => void;
Expand All @@ -168,7 +168,9 @@ interface PlaybackControls {
}

PlaybackControlsFactory.deps = [AnimationSpeedSliderFactory];
function PlaybackControlsFactory(AnimationSpeedSlider: ReturnType<typeof AnimationSpeedSliderFactory>) {
function PlaybackControlsFactory(
AnimationSpeedSlider: ReturnType<typeof AnimationSpeedSliderFactory>
) {
// eslint-disable-next-line complexity
const PlaybackControls = ({
isAnimatable = true,
Expand Down
12 changes: 6 additions & 6 deletions src/components/common/data-table/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

import React, { MouseEventHandler, ReactNode } from 'react';
import React, {MouseEventHandler, ReactNode} from 'react';
import styled from 'styled-components';

const StyledButton = styled.button`
Expand All @@ -39,11 +39,11 @@ const StyledButton = styled.button`
`;

type ButtonProps = {
onClick?: MouseEventHandler<HTMLButtonElement>,
disabled?: boolean,
text?: string,
children?: ReactNode
} & React.ButtonHTMLAttributes<HTMLButtonElement>
onClick?: MouseEventHandler<HTMLButtonElement>;
disabled?: boolean;
text?: string;
children?: ReactNode;
} & React.ButtonHTMLAttributes<HTMLButtonElement>;

const noop = () => {};
const Button = ({onClick = noop, disabled = false, text = '', children, ...props}: ButtonProps) => (
Expand Down
7 changes: 6 additions & 1 deletion src/components/common/data-table/cell-size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ function getSizeSum(sizeCache, key) {
* @param {number} containerWidth
* @param {number} roomToFill
*/
function expandCellSize(cellSizeCache: object, columnOrder: string[], containerWidth: number, roomToFill: number) {
function expandCellSize(
cellSizeCache: object,
columnOrder: string[],
containerWidth: number,
roomToFill: number
) {
let remaining = roomToFill;

const expandedCellSize = columnOrder.reduce((accu, col) => {
Expand Down
3 changes: 1 addition & 2 deletions src/components/common/data-table/grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import {Grid, GridProps} from 'react-virtualized';
import isEqual from 'lodash.isequal';

export default class GridHack extends PureComponent<GridProps> {

grid: Grid | null = null
grid: Grid | null = null;

componentDidUpdate(preProps) {
/*
Expand Down
20 changes: 7 additions & 13 deletions src/components/common/data-table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export const TableSection = ({
{...gridDimension}
className={isPinned ? 'pinned-grid' : 'body-grid'}
height={dataGridHeight - headerGridProps.height}
onScroll={onScroll}
onScroll={onScroll}
scrollTop={scrollTop}
setGridRef={setGridRef}
/>
Expand All @@ -298,7 +298,7 @@ export const TableSection = ({
</AutoSizer>
);

type CellSizeCache = {[id: string]: number}
type CellSizeCache = {[id: string]: number};

interface DataTableProps {
cellSizeCache?: CellSizeCache;
Expand All @@ -310,9 +310,9 @@ interface DataTableProps {
}

interface DataTableState {
cellSizeCache?: CellSizeCache,
moreOptionsColumn?,
ghost?
cellSizeCache?: CellSizeCache;
moreOptionsColumn?;
ghost?;
}

DataTableFactory.deps = [FieldTokenFactory];
Expand Down Expand Up @@ -382,7 +382,7 @@ function DataTableFactory(FieldToken: ReturnType<typeof FieldTokenFactory>) {
propsCache,
pinnedColumns,
unpinnedColumns
) as {cellSizeCache: {}, ghost: number | null | undefined};
) as {cellSizeCache: {}; ghost: number | null | undefined};

return {
cellSizeCache,
Expand All @@ -396,13 +396,7 @@ function DataTableFactory(FieldToken: ReturnType<typeof FieldTokenFactory>) {

scaleCellsToWidth = debounce(this.doScaleCellsToWidth, 300);

renderHeaderCell = (
columns,
isPinned,
props,
toggleMoreOptions,
moreOptionsColumn
) => {
renderHeaderCell = (columns, isPinned, props, toggleMoreOptions, moreOptionsColumn) => {
// eslint-disable-next-line react/display-name
return cellInfo => {
const {columnIndex, key, style} = cellInfo;
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/data-table/option-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const StyledOptionsDropdown = styled.div`
interface OptionDropdownProps {
isOpened?: boolean;
column: string;
toggleMoreOptions: (order: string)=>void;
sortTableColumn: (order: string)=>void;
toggleMoreOptions: (order: string) => void;
sortTableColumn: (order: string) => void;
pinTableColumn: () => void;
copyTableColumn: () => void;
sortMode?: string;
Expand Down
1 change: 0 additions & 1 deletion src/components/common/file-uploader/file-drop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class FileDrop extends React.PureComponent<FileDropProps> {
draggingOverTargetClassName: 'file-drop-dragging-over-target'
};


frameDragCounter = 0;
state = {draggingOverFrame: false, draggingOverTarget: false};

Expand Down

0 comments on commit 00c5553

Please sign in to comment.