Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore]: Technical: add types for editor component #1797

Merged
merged 5 commits into from May 19, 2022

Conversation

dariaterekhova-actionengine
Copy link
Collaborator

Signed-off-by: Daria Terekhova daria.terekhova@actionengine.com

layersToRender: Record<string, Layer>;
index: number;
className: string; // ??
classnames: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need classnames

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced


export default function EditorFactory(
FeatureActionPanel: ComponentType<FeatureActionPanelProps>
): ComponentType<EditorProps> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be Reac.Component<EditorProps>?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced by React.ComponentClass


export default function EditorFactory(
FeatureActionPanel: ComponentType<FeatureActionPanelProps>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be React.FC<FeatureActionPanelProps>?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

onClose: () => void;
}

export function PureFeatureActionPanelFactory(): ComponentType<FeatureActionPanelProps> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const FeatureActionPanel: React.FC<FeatureActionPanelProps>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

export interface FeatureActionPanelProps {
className?: string;
datasets: Datasets;
selectedFeature: Feature;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedFeature can be null

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -124,9 +132,9 @@ FeatureActionPanelFactory.deps = PureFeatureActionPanelFactory.deps;
export default function FeatureActionPanelFactory() {
const PureFeatureActionPanel = PureFeatureActionPanelFactory();

const ClickOutsideFeatureActionPanel = props => {
const ClickOutsideFeatureActionPanel = (props: FeatureActionPanelProps) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const ClickOutsideFeatureActionPanel: React.FC<FeatureActionPanelProps>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
@jagerts jagerts force-pushed the dt/add-types-components-editor branch from ed3134f to 50265d0 Compare May 4, 2022 09:34
@btford
Copy link
Collaborator

btford commented May 5, 2022

LGTM

state = {
showActions: false,
lastPosition: null
lastPosition: {x: 0, y: 0}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this as null
in feature-action-panel add

if (!position) {
  return null
}

 return (
      <StyledActionsLayer
        className={classnames('feature-action-panel', className)}
        style={{
          top: `${position.y + LAYOVER_OFFSET}px`,
          left: `${position.x + LAYOVER_OFFSET}px`
        }}
      >
...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

FeatureActionPanel.defaultProps = {
position: {}
position: {x: 0, y: 0}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make default position to be null. and return null in render if position is null

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed
also fixed a test for FeatureActionPanel, plz check it out

Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
Signed-off-by: Evgeny Zhgulev <evgeny.zhgulev@actionengine.com>
@jagerts jagerts requested a review from heshan0131 May 17, 2022 10:47
@jagerts jagerts merged commit f0671f0 into master May 19, 2022
@delete-merged-branch delete-merged-branch bot deleted the dt/add-types-components-editor branch May 19, 2022 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants