mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
refactored rerendering speed
This commit is contained in:
parent
b6bf317649
commit
69d1d749cf
32 changed files with 144 additions and 2045 deletions
|
@ -32,7 +32,7 @@ type Props = {
|
|||
editorSetDialogActive: typeof editorSetDialogActive;
|
||||
};
|
||||
|
||||
const Component = (props: Props) => (
|
||||
const AppUnconnected = (props: Props) => (
|
||||
<div>
|
||||
<Fills />
|
||||
<UserPanel />
|
||||
|
@ -72,6 +72,8 @@ const mapStateToProps = ({
|
|||
set,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch =>
|
||||
bindActionCreators({ editorHideRenderer, editorSetDialogActive }, dispatch);
|
||||
export const App = connect(mapStateToProps, mapDispatchToProps)(hot(module)(Component));
|
||||
const mapDispatchToProps = { editorHideRenderer, editorSetDialogActive };
|
||||
|
||||
const App = connect(mapStateToProps, mapDispatchToProps)(hot(module)(AppUnconnected));
|
||||
|
||||
export { App };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { createElement } from 'react';
|
||||
import React, { createElement, FC, memo } from 'react';
|
||||
import { DIALOGS, IDialogs } from '~/constants/dialogs';
|
||||
import classnames from 'classnames';
|
||||
import { AppInfoDialog } from '~/components/dialogs/AppInfoDialog';
|
||||
|
@ -17,7 +17,7 @@ const LEFT_DIALOGS = {
|
|||
[DIALOGS.APP_INFO]: AppInfoDialog,
|
||||
};
|
||||
|
||||
const LeftDialog = ({ dialog, dialog_active, editorSetDialogActive }: Props) => (
|
||||
const LeftDialog: FC<Props> = memo(({ dialog, dialog_active, editorSetDialogActive }) => (
|
||||
<React.Fragment>
|
||||
{Object.keys(LEFT_DIALOGS).map(item => (
|
||||
<div
|
||||
|
@ -26,16 +26,22 @@ const LeftDialog = ({ dialog, dialog_active, editorSetDialogActive }: Props) =>
|
|||
>
|
||||
{dialog && LEFT_DIALOGS[item] && createElement(LEFT_DIALOGS[item], {})}
|
||||
|
||||
<div className="dialog-close-button desktop-only" onClick={() => editorSetDialogActive(false)}>
|
||||
<div
|
||||
className="dialog-close-button desktop-only"
|
||||
onClick={() => editorSetDialogActive(false)}
|
||||
>
|
||||
<Icon icon="icon-cancel-1" />
|
||||
</div>
|
||||
|
||||
<div className="dialog-close-button mobile-only" onClick={() => editorSetDialogActive(false)}>
|
||||
<div
|
||||
className="dialog-close-button mobile-only"
|
||||
onClick={() => editorSetDialogActive(false)}
|
||||
>
|
||||
<Icon icon="icon-chevron-down" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</React.Fragment>
|
||||
);
|
||||
));
|
||||
|
||||
export { LeftDialog };
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FC, useEffect, memo, useState, useCallback } from 'react';
|
||||
import { IMapRoute } from '../../../redux/map/types';
|
||||
import { InteractivePoly } from '~/utils/polyline';
|
||||
import { InteractivePoly } from '~/utils/map/InteractivePoly';
|
||||
import { isMobile } from '~/utils/window';
|
||||
import { LatLng, Map, LeafletEvent } from 'leaflet';
|
||||
import { selectEditor } from '~/redux/editor/selectors';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { FC, useEffect, useMemo, useCallback, memo } from 'react';
|
||||
import { FC, useEffect, useCallback, memo } from 'react';
|
||||
import pick from 'ramda/es/pick';
|
||||
import { OsrmRouter } from '~/utils/osrm';
|
||||
import { OsrmRouter } from '~/utils/map/OsrmRouter';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectMap } from '~/redux/map/selectors';
|
||||
import { selectEditorRouter, selectEditorMode } from '~/redux/editor/selectors';
|
||||
|
|
|
@ -4,7 +4,7 @@ import { IStickerDump } from '~/redux/map/types';
|
|||
import { STICKERS } from '~/constants/stickers';
|
||||
import { StickerDesc } from '~/components/StickerDesc';
|
||||
import classNames from 'classnames';
|
||||
import { DomMarker } from '~/utils/DomMarker';
|
||||
import { DomMarker } from '~/utils/map/DomMarker';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { MapContainer, MainMap } from '~/constants/map';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue