Skip to content

Commit

Permalink
add fixes after code review
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
  • Loading branch information
jagerts committed May 4, 2022
1 parent 69972e9 commit 50265d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
10 changes: 4 additions & 6 deletions src/components/editor/editor.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, {Component, ComponentType, CSSProperties, KeyboardEvent} from 'react';
import React, {Component, CSSProperties, KeyboardEvent} from 'react';
import styled from 'styled-components';
import {Editor as Draw} from 'react-map-gl-draw';
import window from 'global/window';
Expand All @@ -43,7 +43,6 @@ const StyledWrapper = styled.div`
position: relative;
`;

// @ts-ignore
const editorLayerFilter = (layer: Layer) => EDITOR_AVAILABLE_LAYERS.includes(layer.type);

EditorFactory.deps = [FeatureActionPanelFactory];
Expand All @@ -55,8 +54,7 @@ interface EditorProps {
editor: {selectedFeature: Feature; mode: string};
layersToRender: Record<string, Layer>;
index: number;
className: string; // ??
classnames: string;
className: string;
clickRadius: number;
style: CSSProperties;
isEnabled: boolean;
Expand All @@ -67,8 +65,8 @@ interface EditorProps {
}

export default function EditorFactory(
FeatureActionPanel: ComponentType<FeatureActionPanelProps>
): ComponentType<EditorProps> {
FeatureActionPanel: React.FC<FeatureActionPanelProps>
): React.ComponentClass<EditorProps> {
class Editor extends Component<EditorProps> {
static defaultProps = {
clickRadius: DEFAULT_RADIUS
Expand Down
8 changes: 4 additions & 4 deletions src/components/editor/feature-action-panel.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, {useCallback, useState, ComponentType} from 'react';
import React, {useCallback, useState} from 'react';
import {useIntl} from 'react-intl';

import ActionPanel, {ActionPanelItem} from 'components/common/action-panel';
Expand All @@ -42,7 +42,7 @@ PureFeatureActionPanelFactory.deps = [];
export interface FeatureActionPanelProps {
className?: string;
datasets: Datasets;
selectedFeature: Feature;
selectedFeature: Feature | null;
position: {
x: number;
y: number;
Expand All @@ -54,7 +54,7 @@ export interface FeatureActionPanelProps {
onClose: () => void;
}

export function PureFeatureActionPanelFactory(): ComponentType<FeatureActionPanelProps> {
export function PureFeatureActionPanelFactory(): React.FC<FeatureActionPanelProps> {
const FeatureActionPanel = ({
className,
datasets,
Expand Down Expand Up @@ -132,7 +132,7 @@ FeatureActionPanelFactory.deps = PureFeatureActionPanelFactory.deps;
export default function FeatureActionPanelFactory() {
const PureFeatureActionPanel = PureFeatureActionPanelFactory();

const ClickOutsideFeatureActionPanel = (props: FeatureActionPanelProps) => {
const ClickOutsideFeatureActionPanel: React.FC<FeatureActionPanelProps> = props => {
// @ts-ignore
ClickOutsideFeatureActionPanel.handleClickOutside = (e: Event) => {
e.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion src/constants/default-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ export const EDITOR_MODES = {
EDIT: EditorModes.EDIT_VERTEX
};

export const EDITOR_AVAILABLE_LAYERS = [
export const EDITOR_AVAILABLE_LAYERS: string[] = [
LAYER_TYPES.point,
LAYER_TYPES.hexagon,
LAYER_TYPES.arc,
Expand Down

0 comments on commit 50265d0

Please sign in to comment.