diff --git a/.gitignore b/.gitignore index e1e09d8..382b80e 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,10 @@ yarn-error.log /config/backend.js /config/pwa.js +/src/config/frontend.js +/src/config/backend.js +/src/config/pwa.js + # Bundle *.js.map stats.json diff --git a/src/_modules/Arrows.ts b/src/_modules/Arrows.ts index 107fc35..5e89229 100644 --- a/src/_modules/Arrows.ts +++ b/src/_modules/Arrows.ts @@ -1,7 +1,7 @@ import { LatLngLiteral, LayerGroup, Map } from "leaflet"; -import { arrowClusterIcon, createArrow } from "$utils/arrow"; +import { arrowClusterIcon, createArrow } from "~/utils/arrow"; import { MarkerClusterGroup } from 'leaflet.markercluster/dist/leaflet.markercluster-src.js'; -import { angleBetweenPoints, dist2, middleCoord } from "$utils/geom"; +import { angleBetweenPoints, dist2, middleCoord } from "~/utils/geom"; class Component extends LayerGroup { constructor(props){ diff --git a/src/_modules/Editor.ts b/src/_modules/Editor.ts index c207ad3..79bd824 100644 --- a/src/_modules/Editor.ts +++ b/src/_modules/Editor.ts @@ -1,12 +1,12 @@ -import { Map } from '$modules/Map'; -import { Poly } from '$modules/Poly'; -import { MODES } from '$constants/modes'; -import { ILatLng, Stickers } from '$modules/Stickers'; -import { Router } from '$modules/Router'; -import { DEFAULT_LOGO, ILogos, LOGOS } from '$constants/logos'; +import { Map } from '~/modules/Map'; +import { Poly } from '~/modules/Poly'; +import { MODES } from '~/constants/modes'; +import { ILatLng, Stickers } from '~/modules/Stickers'; +import { Router } from '~/modules/Router'; +import { DEFAULT_LOGO, ILogos, LOGOS } from '~/constants/logos'; -import { getUrlData } from '$utils/history'; -import { store } from '$redux/store'; +import { getUrlData } from '~/utils/history'; +import { store } from '~/redux/store'; import { resetSaveDialog, setActiveSticker, @@ -16,7 +16,7 @@ import { setMarkersShown, setMode, setRouterPoints, setStarred, -} from '$redux/user/actions'; +} from '~/redux/user/actions'; import { mapSetAddress, mapSetDescription, @@ -24,11 +24,11 @@ import { mapSetPublic, mapSetTitle, mapSetProvider, -} from '$redux/map/actions'; -import { DEFAULT_PROVIDER, IProvider, PROVIDERS } from '$constants/providers'; -import { STICKERS } from '$constants/stickers'; -import { IRootState } from "$redux/user"; -import { DEFAULT_USER, IUser } from "$constants/auth"; +} from '~/redux/map/actions'; +import { DEFAULT_PROVIDER, IProvider, PROVIDERS } from '~/constants/providers'; +import { STICKERS } from '~/constants/stickers'; +import { IRootState } from "~/redux/user"; +import { DEFAULT_USER, IUser } from "~/constants/auth"; interface IEditor { map: Map; diff --git a/src/_modules/InteractivePoly.ts b/src/_modules/InteractivePoly.ts index 33822a9..982cbb7 100644 --- a/src/_modules/InteractivePoly.ts +++ b/src/_modules/InteractivePoly.ts @@ -18,7 +18,7 @@ import { LatLngLiteral } from "leaflet"; -import { distKm, distToSegment, getPolyLength, pointInArea } from "$utils/geom"; +import { distKm, distToSegment, getPolyLength, pointInArea } from "~/utils/geom"; interface InteractivePolylineOptions extends PolylineOptions { maxMarkers?: number; diff --git a/src/_modules/KmMarks.ts b/src/_modules/KmMarks.ts index 0fee9ca..7e25910 100644 --- a/src/_modules/KmMarks.ts +++ b/src/_modules/KmMarks.ts @@ -1,7 +1,7 @@ import { divIcon, LatLngLiteral, Layer, LayerGroup, Map, marker, Marker } from "leaflet"; -import { arrowClusterIcon, createArrow } from "$utils/arrow"; +import { arrowClusterIcon, createArrow } from "~/utils/arrow"; import { MarkerClusterGroup } from 'leaflet.markercluster/dist/leaflet.markercluster-src.js'; -import { allwaysPositiveAngleDeg, angleBetweenPoints, distKm } from "$utils/geom"; +import { allwaysPositiveAngleDeg, angleBetweenPoints, distKm } from "~/utils/geom"; import classNames from 'classnames'; interface KmMarksOptions { diff --git a/src/_modules/Map.ts b/src/_modules/Map.ts index 95059cc..25ceece 100644 --- a/src/_modules/Map.ts +++ b/src/_modules/Map.ts @@ -6,8 +6,8 @@ import { } from 'leaflet'; import 'leaflet/dist/leaflet.css'; -import { PROVIDER } from '$config/frontend'; -import { DEFAULT_PROVIDER, PROVIDERS } from '$constants/providers'; +import { PROVIDER } from '~/config/frontend'; +import { DEFAULT_PROVIDER, PROVIDERS } from '~/constants/providers'; interface Props { container: string diff --git a/src/_modules/Poly.ts b/src/_modules/Poly.ts index ada6e1c..fa10316 100644 --- a/src/_modules/Poly.ts +++ b/src/_modules/Poly.ts @@ -1,11 +1,11 @@ import { Map, LatLng } from 'leaflet'; -import { simplify } from '$utils/simplify'; -import { editor, Editor } from "$modules/Editor"; -import { ILatLng } from "$modules/Stickers"; -import { InteractivePoly } from "$modules/InteractivePoly"; -import { Arrows } from "$modules/Arrows"; -import { KmMarks } from "$modules/KmMarks"; -import { isMobile } from "$utils/window"; +import { simplify } from '~/utils/simplify'; +import { editor, Editor } from "~/modules/Editor"; +import { ILatLng } from "~/modules/Stickers"; +import { InteractivePoly } from "~/modules/InteractivePoly"; +import { Arrows } from "~/modules/Arrows"; +import { KmMarks } from "~/modules/KmMarks"; +import { isMobile } from "~/utils/window"; interface Props { map: Map; diff --git a/src/_modules/Router.ts b/src/_modules/Router.ts index 2148db8..a8cf47a 100644 --- a/src/_modules/Router.ts +++ b/src/_modules/Router.ts @@ -1,8 +1,8 @@ import { Map, Marker } from 'leaflet'; import * as Routing from 'leaflet-routing-machine/src/index'; -import { CLIENT } from '$config/frontend'; -import { DomMarker } from '$utils/DomMarker'; -import { editor } from "$modules/Editor"; +import { CLIENT } from '~/config/frontend'; +import { DomMarker } from '~/utils/DomMarker'; +import { editor } from "~/modules/Editor"; interface ILatLng { lat: number, lng: number diff --git a/src/_modules/Sticker.tsx b/src/_modules/Sticker.tsx index 07133dd..ceec2c1 100644 --- a/src/_modules/Sticker.tsx +++ b/src/_modules/Sticker.tsx @@ -1,15 +1,15 @@ import { Map, Marker, marker } from 'leaflet'; import React from 'react'; -import { DomMarker } from '$utils/DomMarker'; +import { DomMarker } from '~/utils/DomMarker'; -import { STICKERS } from '$constants/stickers'; +import { STICKERS } from '~/constants/stickers'; import ReactDOM from 'react-dom'; -import { StickerDesc } from '$components/StickerDesc'; +import { StickerDesc } from '~/components/StickerDesc'; import classnames from 'classnames'; -import { getLabelDirection } from '$utils/geom'; -import { ILatLng } from "$modules/Stickers"; -import { IRootState } from "$redux/user"; -import { Editor, editor } from "$modules/Editor"; +import { getLabelDirection } from '~/utils/geom'; +import { ILatLng } from "~/modules/Stickers"; +import { IRootState } from "~/redux/user"; +import { Editor, editor } from "~/modules/Editor"; const getX = e => ( e.touches && e.touches.length > 0 diff --git a/src/_modules/Stickers.ts b/src/_modules/Stickers.ts index 595332e..4b42d74 100644 --- a/src/_modules/Stickers.ts +++ b/src/_modules/Stickers.ts @@ -1,9 +1,9 @@ import {FeatureGroup, LayerGroup, layerGroup, Map} from 'leaflet'; -import { IStickerDump, Sticker } from '$modules/Sticker'; +import { IStickerDump, Sticker } from '~/modules/Sticker'; import { MarkerClusterGroup } from 'leaflet.markercluster/dist/leaflet.markercluster-src.js'; -import { clusterIcon } from '$utils/clusterIcon'; -import { editor, Editor } from "$modules/Editor"; -import { STICKERS } from "$constants/stickers"; +import { clusterIcon } from '~/utils/clusterIcon'; +import { editor, Editor } from "~/modules/Editor"; +import { STICKERS } from "~/constants/stickers"; export interface ILatLng { lat: number, diff --git a/src/components/Cursor.tsx b/src/components/Cursor.tsx index 4d1c3e8..1cf5707 100644 --- a/src/components/Cursor.tsx +++ b/src/components/Cursor.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { Icon } from '$components/panels/Icon'; -import { MODES } from '$constants/modes'; -import { IStickerPack, STICKERS } from '$constants/stickers'; -import { StickerIcon } from '$components/StickerIcon'; -import { IRootReducer } from '$redux/user'; +import { Icon } from '~/components/panels/Icon'; +import { MODES } from '~/constants/modes'; +import { IStickerPack, STICKERS } from '~/constants/stickers'; +import { StickerIcon } from '~/components/StickerIcon'; +import { IRootReducer } from '~/redux/user'; interface Props { mode: IRootReducer['mode'], diff --git a/src/components/Fills.tsx b/src/components/Fills.tsx index b68d6cd..52e0d6f 100644 --- a/src/components/Fills.tsx +++ b/src/components/Fills.tsx @@ -43,6 +43,6 @@ export const Fills = () => ( - + ); diff --git a/src/components/StickerIcon.tsx b/src/components/StickerIcon.tsx index a2c7c2f..f46d915 100644 --- a/src/components/StickerIcon.tsx +++ b/src/components/StickerIcon.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { STICKERS } from '$constants/stickers'; +import { STICKERS } from '~/constants/stickers'; type Props = { set: string, diff --git a/src/components/UserLocation.tsx b/src/components/UserLocation.tsx index 73f96db..ecb501c 100644 --- a/src/components/UserLocation.tsx +++ b/src/components/UserLocation.tsx @@ -1,8 +1,8 @@ import React from 'react'; // import { marker } from 'leaflet'; -// import { DomMarker } from '$utils/DomMarker'; -// import { Icon } from '$components/panels/Icon'; -// import { editor } from '$modules/Editor'; +// import { DomMarker } from '~/utils/DomMarker'; +// import { Icon } from '~/components/panels/Icon'; +// import { editor } from '~/modules/Editor'; interface Props { diff --git a/src/components/dialogs/AppInfoDialog.tsx b/src/components/dialogs/AppInfoDialog.tsx index 65b897b..9441f68 100644 --- a/src/components/dialogs/AppInfoDialog.tsx +++ b/src/components/dialogs/AppInfoDialog.tsx @@ -1,7 +1,7 @@ // @flow import React from 'react'; -import { Scroll } from '$components/Scroll'; -import { APP_INFO } from '$constants/app_info'; +import { Scroll } from '~/components/Scroll'; +import { APP_INFO } from '~/constants/app_info'; export const AppInfoDialog = () => (
diff --git a/src/components/dialogs/CancelDialog.tsx b/src/components/dialogs/CancelDialog.tsx index 393deb6..d2aa630 100644 --- a/src/components/dialogs/CancelDialog.tsx +++ b/src/components/dialogs/CancelDialog.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { MODES } from '$constants/modes'; -import { Icon } from '$components/panels/Icon'; -import { setMode, stopEditing } from "$redux/user/actions"; +import { MODES } from '~/constants/modes'; +import { Icon } from '~/components/panels/Icon'; +import { setMode, stopEditing } from "~/redux/user/actions"; type Props = { stopEditing: typeof stopEditing, diff --git a/src/components/dialogs/LogoDialog.tsx b/src/components/dialogs/LogoDialog.tsx index b7b5514..0cd37d3 100644 --- a/src/components/dialogs/LogoDialog.tsx +++ b/src/components/dialogs/LogoDialog.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { LOGOS } from '$constants/logos'; -import { Icon } from '$components/panels/Icon'; +import { LOGOS } from '~/constants/logos'; +import { Icon } from '~/components/panels/Icon'; import classnames from 'classnames'; -import * as MAP_ACTIONS from "$redux/map/actions" -import { selectMapLogo } from '$redux/map/selectors'; +import * as MAP_ACTIONS from "~/redux/map/actions" +import { selectMapLogo } from '~/redux/map/selectors'; import { connect } from 'react-redux'; const mapStateToProps = state => ({ diff --git a/src/components/dialogs/MapListDialog.tsx b/src/components/dialogs/MapListDialog.tsx index ce2ea6f..fb35991 100644 --- a/src/components/dialogs/MapListDialog.tsx +++ b/src/components/dialogs/MapListDialog.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { connect } from 'react-redux'; -import { RouteRowWrapper } from '$components/maps/RouteRowWrapper'; -import { Scroll } from '$components/Scroll'; +import { RouteRowWrapper } from '~/components/maps/RouteRowWrapper'; +import { Scroll } from '~/components/Scroll'; import { searchSetDistance, searchSetTitle, @@ -11,17 +11,17 @@ import { dropRoute, modifyRoute, toggleRouteStarred, -} from '$redux/user/actions'; -import { isMobile } from '$utils/window'; +} from '~/redux/user/actions'; +import { isMobile } from '~/utils/window'; import classnames from 'classnames'; import Range from 'rc-slider/lib/Range'; -import { TABS, TABS_TITLES } from '$constants/dialogs'; -import { Icon } from '$components/panels/Icon'; -import { pushPath } from '$utils/history'; -import { IRootState, IRouteListItem } from '$redux/user'; -import { ROLES } from '$constants/auth'; -import { IState } from '$redux/store'; +import { TABS, TABS_TITLES } from '~/constants/dialogs'; +import { Icon } from '~/components/panels/Icon'; +import { pushPath } from '~/utils/history'; +import { IRootState, IRouteListItem } from '~/redux/user'; +import { ROLES } from '~/constants/auth'; +import { IState } from '~/redux/store'; export interface IMapListDialogProps extends IRootState { marks: { [x: number]: string }; diff --git a/src/components/dialogs/ProviderDialog.tsx b/src/components/dialogs/ProviderDialog.tsx index b6237c1..29ac463 100644 --- a/src/components/dialogs/ProviderDialog.tsx +++ b/src/components/dialogs/ProviderDialog.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { PROVIDERS, replaceProviderUrl } from '$constants/providers'; -import { Icon } from '$components/panels/Icon'; +import { PROVIDERS, replaceProviderUrl } from '~/constants/providers'; +import { Icon } from '~/components/panels/Icon'; import classnames from 'classnames'; -import * as MAP_ACTIONS from "$redux/map/actions"; -import { selectMapProvider } from '$redux/map/selectors'; +import * as MAP_ACTIONS from "~/redux/map/actions"; +import { selectMapProvider } from '~/redux/map/selectors'; import { connect } from 'react-redux'; const mapStateToProps = state => ({ diff --git a/src/components/dialogs/RouterDialog.tsx b/src/components/dialogs/RouterDialog.tsx index 6d2bcd9..adaa3bc 100644 --- a/src/components/dialogs/RouterDialog.tsx +++ b/src/components/dialogs/RouterDialog.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { Icon } from '$components/panels/Icon'; +import { Icon } from '~/components/panels/Icon'; import { routerCancel as routerCancelAction, routerSubmit as routerSubmitAction, -} from "$redux/user/actions"; +} from "~/redux/user/actions"; import classnames from "classnames"; type Props = { diff --git a/src/components/dialogs/SaveDialog.tsx b/src/components/dialogs/SaveDialog.tsx index 4fbd879..67fb1ec 100644 --- a/src/components/dialogs/SaveDialog.tsx +++ b/src/components/dialogs/SaveDialog.tsx @@ -1,17 +1,17 @@ import React from 'react'; -import { copyToClipboard, getUrlData } from '$utils/history'; -import { toTranslit, parseDesc } from '$utils/format'; -import { TIPS } from '$constants/tips'; -import { MODES } from '$constants/modes'; -import { Icon } from '$components/panels/Icon'; -import { Switch } from '$components/Switch'; +import { copyToClipboard, getUrlData } from '~/utils/history'; +import { toTranslit, parseDesc } from '~/utils/format'; +import { TIPS } from '~/constants/tips'; +import { MODES } from '~/constants/modes'; +import { Icon } from '~/components/panels/Icon'; +import { Switch } from '~/components/Switch'; import classnames from 'classnames'; import ExpandableTextarea from 'react-expandable-textarea'; import { connect } from 'react-redux'; -import { selectMap } from '$redux/map/selectors'; -import { selectUser } from '$redux/user/selectors'; -import * as USER_ACTIONS from '$redux/user/actions'; +import { selectMap } from '~/redux/map/selectors'; +import { selectUser } from '~/redux/user/selectors'; +import * as USER_ACTIONS from '~/redux/user/actions'; const mapStateToProps = state => ({ map: selectMap(state), diff --git a/src/components/dialogs/ShotPrefetchDialog.tsx b/src/components/dialogs/ShotPrefetchDialog.tsx index 487b378..a03eb5e 100644 --- a/src/components/dialogs/ShotPrefetchDialog.tsx +++ b/src/components/dialogs/ShotPrefetchDialog.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; -import { selectUserRenderer } from '$redux/user/selectors'; +import { selectUserRenderer } from '~/redux/user/selectors'; const mapStateToProps = state => ({ renderer: selectUserRenderer(state), diff --git a/src/components/dialogs/StickersDialog.tsx b/src/components/dialogs/StickersDialog.tsx index db31f3c..97d27c8 100644 --- a/src/components/dialogs/StickersDialog.tsx +++ b/src/components/dialogs/StickersDialog.tsx @@ -1,8 +1,8 @@ // @flow import React from 'react'; -import { STICKERS } from '$constants/stickers'; -import { setActiveSticker as setActiveStickerAction } from "$redux/user/actions"; +import { STICKERS } from '~/constants/stickers'; +import { setActiveSticker as setActiveStickerAction } from "~/redux/user/actions"; interface Props { setActiveSticker: typeof setActiveStickerAction, diff --git a/src/components/dialogs/TitleDialog.tsx b/src/components/dialogs/TitleDialog.tsx index e1fe86c..50c3464 100644 --- a/src/components/dialogs/TitleDialog.tsx +++ b/src/components/dialogs/TitleDialog.tsx @@ -2,11 +2,11 @@ import React from 'react'; import { connect } from 'react-redux'; import classnames from 'classnames'; -import { getStyle } from '$utils/dom'; -import { nearestInt } from '$utils/geom'; -import { parseDesc } from '$utils/format'; -import { selectUser } from '$redux/user/selectors'; -import { selectMap } from '$redux/map/selectors'; +import { getStyle } from '~/utils/dom'; +import { nearestInt } from '~/utils/geom'; +import { parseDesc } from '~/utils/format'; +import { selectUser } from '~/redux/user/selectors'; +import { selectMap } from '~/redux/map/selectors'; const mapStateToProps = state => ({ user: selectUser(state), diff --git a/src/components/dialogs/TrashDialog.tsx b/src/components/dialogs/TrashDialog.tsx index 09f0e96..fcb19c9 100644 --- a/src/components/dialogs/TrashDialog.tsx +++ b/src/components/dialogs/TrashDialog.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Icon } from '$components/panels/Icon'; +import { Icon } from '~/components/panels/Icon'; type Props = { clearPoly: () => void, diff --git a/src/components/logo/LogoPreview.tsx b/src/components/logo/LogoPreview.tsx index 7950c2f..4d96127 100644 --- a/src/components/logo/LogoPreview.tsx +++ b/src/components/logo/LogoPreview.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { LOGOS } from '$constants/logos'; +import { LOGOS } from '~/constants/logos'; import { connect } from 'react-redux'; -import { IRootState } from '$redux/user'; -import { selectMapLogo } from '$redux/map/selectors'; +import { IRootState } from '~/redux/user'; +import { selectMapLogo } from '~/redux/map/selectors'; const mapStateToProps = state => ({ logo: selectMapLogo(state) }); type Props = ReturnType; diff --git a/src/components/maps/RouteRowDrop.tsx b/src/components/maps/RouteRowDrop.tsx index 1f7c097..e85d756 100644 --- a/src/components/maps/RouteRowDrop.tsx +++ b/src/components/maps/RouteRowDrop.tsx @@ -1,8 +1,8 @@ // @flow import React from 'react'; -import { Icon } from '$components/panels/Icon'; -import { MapListDialog } from "$components/dialogs/MapListDialog"; -import { Tooltip } from "$components/panels/Tooltip"; +import { Icon } from '~/components/panels/Icon'; +import { MapListDialog } from "~/components/dialogs/MapListDialog"; +import { Tooltip } from "~/components/panels/Tooltip"; import { ReactElement } from "react"; interface Props { diff --git a/src/components/maps/RouteRowEditor.tsx b/src/components/maps/RouteRowEditor.tsx index 00466ee..6e70593 100644 --- a/src/components/maps/RouteRowEditor.tsx +++ b/src/components/maps/RouteRowEditor.tsx @@ -1,8 +1,8 @@ // @flow import React from 'react'; -import { Icon } from '$components/panels/Icon'; -import { Switch } from '$components/Switch'; -import { MapListDialog } from "$components/dialogs/MapListDialog"; +import { Icon } from '~/components/panels/Icon'; +import { Switch } from '~/components/Switch'; +import { MapListDialog } from "~/components/dialogs/MapListDialog"; interface Props { title: string; diff --git a/src/components/maps/RouteRowView.tsx b/src/components/maps/RouteRowView.tsx index 8a113be..072c80a 100644 --- a/src/components/maps/RouteRowView.tsx +++ b/src/components/maps/RouteRowView.tsx @@ -1,12 +1,12 @@ // @flow import React from "react"; -import { Icon } from "$components/panels/Icon"; -import { MapListDialog } from "$components/dialogs/MapListDialog"; -import { Tooltip } from "$components/panels/Tooltip"; +import { Icon } from "~/components/panels/Icon"; +import { MapListDialog } from "~/components/dialogs/MapListDialog"; +import { Tooltip } from "~/components/panels/Tooltip"; import { ReactElement } from "react"; import classnames from "classnames"; -import { toggleRouteStarred } from "$redux/user/actions"; -import { TABS } from "$constants/dialogs"; +import { toggleRouteStarred } from "~/redux/user/actions"; +import { TABS } from "~/constants/dialogs"; interface Props { tab: string; diff --git a/src/components/maps/RouteRowWrapper.tsx b/src/components/maps/RouteRowWrapper.tsx index 24e44cc..0bd8c06 100644 --- a/src/components/maps/RouteRowWrapper.tsx +++ b/src/components/maps/RouteRowWrapper.tsx @@ -1,9 +1,9 @@ import React from "react"; import classnames from "classnames"; -import { MapListDialog } from "$components/dialogs/MapListDialog"; -import { RouteRowView } from "$components/maps/RouteRowView"; -import { RouteRowEditor } from "$components/maps/RouteRowEditor"; -import { RouteRowDrop } from "$components/maps/RouteRowDrop"; +import { MapListDialog } from "~/components/dialogs/MapListDialog"; +import { RouteRowView } from "~/components/maps/RouteRowView"; +import { RouteRowEditor } from "~/components/maps/RouteRowEditor"; +import { RouteRowDrop } from "~/components/maps/RouteRowDrop"; import { ReactElement } from "react"; interface Props { diff --git a/src/components/panels/DistanceBar.tsx b/src/components/panels/DistanceBar.tsx index 5531835..edcf43c 100644 --- a/src/components/panels/DistanceBar.tsx +++ b/src/components/panels/DistanceBar.tsx @@ -1,15 +1,15 @@ // flow import React from 'react'; -import { toHours } from '$utils/format'; -import { Icon } from '$components/panels/Icon'; +import { toHours } from '~/utils/format'; +import { Icon } from '~/components/panels/Icon'; import { connect } from 'react-redux'; // import Slider from 'rc-slider'; import Slider from 'rc-slider/lib/Slider'; import { bindActionCreators } from 'redux'; -import { setSpeed } from '$redux/user/actions'; -import { IRootState } from "$redux/user"; -import { Tooltip } from "$components/panels/Tooltip"; -import { isMobile } from "$utils/window"; +import { setSpeed } from '~/redux/user/actions'; +import { IRootState } from "~/redux/user"; +import { Tooltip } from "~/components/panels/Tooltip"; +import { isMobile } from "~/utils/window"; interface Props extends IRootState { setSpeed: typeof setSpeed, diff --git a/src/components/panels/EditorDialog.tsx b/src/components/panels/EditorDialog.tsx index d3f50a5..0ade17d 100644 --- a/src/components/panels/EditorDialog.tsx +++ b/src/components/panels/EditorDialog.tsx @@ -1,18 +1,18 @@ import React, { createElement } from 'react'; -import { MODES } from '$constants/modes'; +import { MODES } from '~/constants/modes'; -import { RouterDialog } from '$components/dialogs/RouterDialog'; -import { StickersDialog } from '$components/dialogs/StickersDialog'; -import { TrashDialog } from '$components/dialogs/TrashDialog'; -import { LogoDialog } from '$components/dialogs/LogoDialog'; -import { SaveDialog } from '$components/dialogs/SaveDialog'; -import { CancelDialog } from '$components/dialogs/CancelDialog'; +import { RouterDialog } from '~/components/dialogs/RouterDialog'; +import { StickersDialog } from '~/components/dialogs/StickersDialog'; +import { TrashDialog } from '~/components/dialogs/TrashDialog'; +import { LogoDialog } from '~/components/dialogs/LogoDialog'; +import { SaveDialog } from '~/components/dialogs/SaveDialog'; +import { CancelDialog } from '~/components/dialogs/CancelDialog'; import { connect } from 'react-redux'; -import { ProviderDialog } from '$components/dialogs/ProviderDialog'; -import { ShotPrefetchDialog } from '$components/dialogs/ShotPrefetchDialog'; -import { selectUserMode } from '$redux/user/selectors'; +import { ProviderDialog } from '~/components/dialogs/ProviderDialog'; +import { ShotPrefetchDialog } from '~/components/dialogs/ShotPrefetchDialog'; +import { selectUserMode } from '~/redux/user/selectors'; const mapStateToProps = state => ({ mode: selectUserMode(state) }); diff --git a/src/components/panels/EditorPanel.tsx b/src/components/panels/EditorPanel.tsx index decdc94..add6782 100644 --- a/src/components/panels/EditorPanel.tsx +++ b/src/components/panels/EditorPanel.tsx @@ -1,14 +1,14 @@ import React from 'react'; -import { MODES } from '$constants/modes'; +import { MODES } from '~/constants/modes'; import classnames from 'classnames'; -import { Icon } from '$components/panels/Icon'; -import { EditorDialog } from '$components/panels/EditorDialog'; +import { Icon } from '~/components/panels/Icon'; +import { EditorDialog } from '~/components/panels/EditorDialog'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; -import { setMode, startEditing, stopEditing, takeAShot, keyPressed } from '$redux/user/actions'; -import { IRootState } from "$redux/user"; -import { Tooltip } from "$components/panels/Tooltip"; +import { setMode, startEditing, stopEditing, takeAShot, keyPressed } from '~/redux/user/actions'; +import { IRootState } from "~/redux/user"; +import { Tooltip } from "~/components/panels/Tooltip"; interface Props extends IRootState { routing: IRootState['features']['routing'], diff --git a/src/components/panels/Icon.tsx b/src/components/panels/Icon.tsx index 5cad4a3..62354f1 100644 --- a/src/components/panels/Icon.tsx +++ b/src/components/panels/Icon.tsx @@ -4,7 +4,7 @@ export const Icon = ({ icon, size = 32 }: { icon: string, size?: number }) => ( - + diff --git a/src/components/panels/RendererPanel.tsx b/src/components/panels/RendererPanel.tsx index dc9ff90..eba3404 100644 --- a/src/components/panels/RendererPanel.tsx +++ b/src/components/panels/RendererPanel.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Icon } from '$components/panels/Icon'; +import { Icon } from '~/components/panels/Icon'; type Props = { onCancel: () => void, diff --git a/src/components/panels/TopLeftPanel.tsx b/src/components/panels/TopLeftPanel.tsx index ee8a829..44acce7 100644 --- a/src/components/panels/TopLeftPanel.tsx +++ b/src/components/panels/TopLeftPanel.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { UserLocation } from '$components/UserLocation'; -import { DistanceBar } from '$components/panels/DistanceBar'; +import { UserLocation } from '~/components/UserLocation'; +import { DistanceBar } from '~/components/panels/DistanceBar'; export const TopLeftPanel = () => (
diff --git a/src/components/panels/TopRightPanel.tsx b/src/components/panels/TopRightPanel.tsx index c06c7e8..63a7346 100644 --- a/src/components/panels/TopRightPanel.tsx +++ b/src/components/panels/TopRightPanel.tsx @@ -1,16 +1,16 @@ // flow import React, { useCallback } from 'react'; -import { Icon } from '$components/panels/Icon'; -import { PROVIDERS } from '$constants/providers'; -import { LOGOS } from '$constants/logos'; -import * as USER_ACTIONS from '$redux/user/actions'; +import { Icon } from '~/components/panels/Icon'; +import { PROVIDERS } from '~/constants/providers'; +import { LOGOS } from '~/constants/logos'; +import * as USER_ACTIONS from '~/redux/user/actions'; import { connect } from 'react-redux'; -import { MODES } from '$constants/modes'; -import { IRootState } from '$redux/user'; +import { MODES } from '~/constants/modes'; +import { IRootState } from '~/redux/user'; -import { Tooltip } from '$components/panels/Tooltip'; -import { selectMap } from '$redux/map/selectors'; -import { selectUser } from '$redux/user/selectors'; +import { Tooltip } from '~/components/panels/Tooltip'; +import { selectMap } from '~/redux/map/selectors'; +import { selectUser } from '~/redux/user/selectors'; const mapStateToProps = state => ({ map: selectMap(state), diff --git a/src/components/panels/UserPanel.tsx b/src/components/panels/UserPanel.tsx index 2bca218..a138747 100644 --- a/src/components/panels/UserPanel.tsx +++ b/src/components/panels/UserPanel.tsx @@ -1,9 +1,9 @@ import React, { PureComponent } from 'react'; -import { GuestButton } from '$components/user/GuestButton'; -import { DEFAULT_USER, IUser, ROLES } from '$constants/auth'; -import { UserButton } from '$components/user/UserButton'; -import { UserMenu } from '$components/user/UserMenu'; +import { GuestButton } from '~/components/user/GuestButton'; +import { DEFAULT_USER, ROLES } from '~/constants/auth'; +import { UserButton } from '~/components/user/UserButton'; +import { UserMenu } from '~/components/user/UserMenu'; import { setUser, userLogout, @@ -13,16 +13,16 @@ import { setDialogActive, openMapDialog, getGPXTrack, -} from '$redux/user/actions'; +} from '~/redux/user/actions'; import { connect } from 'react-redux'; -import { Icon } from '$components/panels/Icon'; +import { Icon } from '~/components/panels/Icon'; import classnames from 'classnames'; -import { CLIENT } from '$config/frontend'; -import { DIALOGS, TABS } from '$constants/dialogs'; -import { IRootState } from '$redux/user'; -import { Tooltip } from '$components/panels/Tooltip'; -import { TitleDialog } from '$components/dialogs/TitleDialog'; +import { CLIENT } from '~/config/frontend'; +import { DIALOGS, TABS } from '~/constants/dialogs'; +import { IRootState } from '~/redux/user'; +import { Tooltip } from '~/components/panels/Tooltip'; +import { TitleDialog } from '~/components/dialogs/TitleDialog'; interface Props extends IRootState { userLogout: typeof userLogout; diff --git a/src/components/renderer/Renderer.tsx b/src/components/renderer/Renderer.tsx index 60166c8..b1af77b 100644 --- a/src/components/renderer/Renderer.tsx +++ b/src/components/renderer/Renderer.tsx @@ -1,14 +1,14 @@ import React from 'react'; -import { hideRenderer, cropAShot } from '$redux/user/actions'; +import { hideRenderer, cropAShot } from '~/redux/user/actions'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import Croppr from 'croppr'; import 'croppr/dist/croppr.css'; -import { LOGOS } from '$constants/logos'; -import { RendererPanel } from '$components/panels/RendererPanel'; -import { IRootState } from "$redux/user"; -import { IRoute } from '$redux/map/types'; +import { LOGOS } from '~/constants/logos'; +import { RendererPanel } from '~/components/panels/RendererPanel'; +import { IRootState } from "~/redux/user"; +import { IRoute } from '~/redux/map/types'; type Props = { data: IRootState['renderer']['data'], diff --git a/src/components/user/GuestButton.tsx b/src/components/user/GuestButton.tsx index 65e920e..dbc019f 100644 --- a/src/components/user/GuestButton.tsx +++ b/src/components/user/GuestButton.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Icon } from '$components/panels/Icon'; +import { Icon } from '~/components/panels/Icon'; type Props = { onClick: () => void, diff --git a/src/components/user/UserButton.tsx b/src/components/user/UserButton.tsx index e09c13d..2ab1bf2 100644 --- a/src/components/user/UserButton.tsx +++ b/src/components/user/UserButton.tsx @@ -1,7 +1,7 @@ // @flow import React from "react"; -import { UserPicture } from "$components/user/UserPicture"; -import { IUser } from "$constants/auth"; +import { UserPicture } from "~/components/user/UserPicture"; +import { IUser } from "~/constants/auth"; interface Props { user: IUser; diff --git a/src/components/user/UserMenu.tsx b/src/components/user/UserMenu.tsx index 1be22dc..c4730bf 100644 --- a/src/components/user/UserMenu.tsx +++ b/src/components/user/UserMenu.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { APP_INFO } from '$constants/app_info'; -import { userLogout } from "$redux/user/actions"; +import { APP_INFO } from '~/constants/app_info'; +import { userLogout } from "~/redux/user/actions"; interface Props { userLogout: typeof userLogout, diff --git a/config/frontend.example.js b/src/config/frontend.example.js similarity index 90% rename from config/frontend.example.js rename to src/config/frontend.example.js index 4661dd9..ba792af 100644 --- a/config/frontend.example.js +++ b/src/config/frontend.example.js @@ -1,4 +1,4 @@ -import { DEFAULT_PROVIDER, PROVIDERS } from '$constants/providers'; +import { DEFAULT_PROVIDER, PROVIDERS } from '~/constants/providers'; import { LatLngLiteral } from 'leaflet'; const PUBLIC_PATH = ''; diff --git a/config/pwa.example.js b/src/config/pwa.example.js similarity index 100% rename from config/pwa.example.js rename to src/config/pwa.example.js diff --git a/src/constants/api.ts b/src/constants/api.ts index 6e0a243..5febdcf 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -1,4 +1,4 @@ -import { CLIENT } from '$config/frontend'; +import { CLIENT } from '~/config/frontend'; export const API = { GET_GUEST: `${CLIENT.API_ADDR}/api/auth/`, diff --git a/src/constants/stickers.ts b/src/constants/stickers.ts index 0652928..03d89a4 100644 --- a/src/constants/stickers.ts +++ b/src/constants/stickers.ts @@ -37,7 +37,7 @@ export interface IStickers { export const STICKERS: IStickers = { base: { title: 'Простые', - url: require('$sprites/stickers/stickers-base.svg'), + url: require('~/sprites/stickers/stickers-base.svg'), size: 72, layers: { men: { off: 5, title: 'Александр 3', title_long: 'Парк Городское Начало' }, @@ -66,7 +66,7 @@ export const STICKERS: IStickers = { }, real: { title: 'Реалистичные', - url: require('$sprites/stickers/stickers-base.svg'), + url: require('~/sprites/stickers/stickers-base.svg'), size: 72, layers: { chicken: { off: 31, title: 'Курочка', title_long: 'Курочка' }, @@ -80,7 +80,7 @@ export const STICKERS: IStickers = { }, pin: { title: 'ПИН-микс', - url: require('$sprites/stickers/stickers-base.svg'), + url: require('~/sprites/stickers/stickers-base.svg'), size: 72, layers: { start: { off: 21, title: '1', title_long: 'Первая точка' }, @@ -97,7 +97,7 @@ export const STICKERS: IStickers = { }, points: { title: 'Точки', - url: require('$sprites/stickers/stickers-base.svg'), + url: require('~/sprites/stickers/stickers-base.svg'), size: 72, layers: { pt1: { off: 40, title: '1', title_long: 'Первая точка' }, diff --git a/src/containers/App.tsx b/src/containers/App.tsx index b23975a..cc7c326 100644 --- a/src/containers/App.tsx +++ b/src/containers/App.tsx @@ -1,25 +1,25 @@ // @flow import React from 'react'; -import { EditorPanel } from '$components/panels/EditorPanel'; -import { Fills } from '$components/Fills'; -import { UserPanel } from '$components/panels/UserPanel'; +import { EditorPanel } from '~/components/panels/EditorPanel'; +import { Fills } from '~/components/Fills'; +import { UserPanel } from '~/components/panels/UserPanel'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { hot } from 'react-hot-loader'; -import { Renderer } from '$components/renderer/Renderer'; -import { hideRenderer, setDialogActive } from '$redux/user/actions'; -import { Cursor } from '$components/Cursor'; -import { LeftDialog } from '$containers/LeftDialog'; -import { TopLeftPanel } from '$components/panels/TopLeftPanel'; -import { TopRightPanel } from '$components/panels/TopRightPanel'; -import { LogoPreview } from '$components/logo/LogoPreview'; -import { IStickerPack } from '$constants/stickers'; -import { IDialogs } from '$constants/dialogs'; +import { Renderer } from '~/components/renderer/Renderer'; +import { hideRenderer, setDialogActive } from '~/redux/user/actions'; +import { Cursor } from '~/components/Cursor'; +import { LeftDialog } from '~/containers/LeftDialog'; +import { TopLeftPanel } from '~/components/panels/TopLeftPanel'; +import { TopRightPanel } from '~/components/panels/TopRightPanel'; +import { LogoPreview } from '~/components/logo/LogoPreview'; +import { IStickerPack } from '~/constants/stickers'; +import { IDialogs } from '~/constants/dialogs'; -import { Map } from '$containers/map/Map'; -import { IRootReducer } from '$redux/user'; +import { Map } from '~/containers/map/Map'; +import { IRootReducer } from '~/redux/user'; type Props = { sticker: string; diff --git a/src/containers/LeftDialog.tsx b/src/containers/LeftDialog.tsx index 16fb58a..06a84a8 100644 --- a/src/containers/LeftDialog.tsx +++ b/src/containers/LeftDialog.tsx @@ -1,10 +1,10 @@ import React, { createElement } from 'react'; -import { DIALOGS, IDialogs } from '$constants/dialogs'; +import { DIALOGS, IDialogs } from '~/constants/dialogs'; import classnames from 'classnames'; -import { AppInfoDialog } from '$components/dialogs/AppInfoDialog'; -import { Icon } from '$components/panels/Icon'; -import { MapListDialog } from '$components/dialogs/MapListDialog'; -import * as USER_ACTIONS from '$redux/user/actions'; +import { AppInfoDialog } from '~/components/dialogs/AppInfoDialog'; +import { Icon } from '~/components/panels/Icon'; +import { MapListDialog } from '~/components/dialogs/MapListDialog'; +import * as USER_ACTIONS from '~/redux/user/actions'; interface Props { dialog: keyof IDialogs; diff --git a/src/containers/map/Map/index.tsx b/src/containers/map/Map/index.tsx index a99f856..7ea4489 100644 --- a/src/containers/map/Map/index.tsx +++ b/src/containers/map/Map/index.tsx @@ -5,14 +5,14 @@ import { selectMapProvider, selectMapRoute, selectMapStickers -} from "$redux/map/selectors"; +} from "~/redux/map/selectors"; import { connect } from "react-redux"; -import * as MAP_ACTIONS from "$redux/map/actions"; +import * as MAP_ACTIONS from "~/redux/map/actions"; -import { Route } from "$containers/map/Route"; -import { TileLayer } from "$containers/map/TileLayer"; -import { Stickers } from "$containers/map/Stickers"; -import { selectUserEditing } from '$redux/user/selectors' +import { Route } from "~/containers/map/Route"; +import { TileLayer } from "~/containers/map/TileLayer"; +import { Stickers } from "~/containers/map/Stickers"; +import { selectUserEditing } from '~/redux/user/selectors' import 'leaflet/dist/leaflet.css'; diff --git a/src/containers/map/Route/index.tsx b/src/containers/map/Route/index.tsx index 2660916..6a0ca07 100644 --- a/src/containers/map/Route/index.tsx +++ b/src/containers/map/Route/index.tsx @@ -6,8 +6,8 @@ import React, { useCallback } from "react"; import { IMapRoute, ILatLng } from "../../../redux/map/types"; -import { InteractivePoly } from "$modules/InteractivePoly"; -import { isMobile } from "$utils/window"; +import { InteractivePoly } from "~/modules/InteractivePoly"; +import { isMobile } from "~/utils/window"; import { LatLng, Map } from "leaflet"; interface IProps { diff --git a/src/containers/map/Sticker/index.tsx b/src/containers/map/Sticker/index.tsx index c37d505..f9964bf 100644 --- a/src/containers/map/Sticker/index.tsx +++ b/src/containers/map/Sticker/index.tsx @@ -1,10 +1,10 @@ import React from "react"; import { Map, marker, Marker } from "leaflet"; -import { IStickerDump } from "$redux/map/types"; -import { STICKERS } from "$constants/stickers"; -import { StickerDesc } from "$components/StickerDesc"; +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/DomMarker"; import { createPortal } from "react-dom"; interface IProps { diff --git a/src/containers/map/Stickers/index.tsx b/src/containers/map/Stickers/index.tsx index 20d5b3d..57984d7 100644 --- a/src/containers/map/Stickers/index.tsx +++ b/src/containers/map/Stickers/index.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { IStickerDump } from '$redux/map/types'; +import { IStickerDump } from '~/redux/map/types'; import { FeatureGroup, Map } from 'leaflet'; -import { Sticker } from '$containers/map/Sticker'; -import { mapSetSticker, mapDropSticker } from '$redux/map/actions'; +import { Sticker } from '~/containers/map/Sticker'; +import { mapSetSticker, mapDropSticker } from '~/redux/map/actions'; interface IProps { stickers: IStickerDump[]; diff --git a/src/containers/map/TileLayer/index.tsx b/src/containers/map/TileLayer/index.tsx index ff430fe..15296f1 100644 --- a/src/containers/map/TileLayer/index.tsx +++ b/src/containers/map/TileLayer/index.tsx @@ -1,8 +1,8 @@ import React from "react"; import { TileContext } from "../../../utils/context"; import { TileLayer as TileLayerInterface, tileLayer, Map } from "leaflet"; -import { DEFAULT_PROVIDER, PROVIDERS } from "$constants/providers"; -import { IMapReducer } from "$redux/map"; +import { DEFAULT_PROVIDER, PROVIDERS } from "~/constants/providers"; +import { IMapReducer } from "~/redux/map"; type IProps = React.HTMLAttributes & { provider: IMapReducer['provider'], diff --git a/src/index.tsx b/src/index.tsx index c695bbe..30e849b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,88 +1,13 @@ -/* - ## FEATURES - todo screenshots with dot losing .png extension - todo refactor reducer to use is_ prefix for editing and etc (mb move them to status object) - todo tower sticker - done route description - done setup deploy - - skip polyline editing only in manual mode (or by click) - todo selecting logo on crop - - todo network operations notify - done delayed notify (delay(2000).then(showLoadingMsg)) - todo network error notifications - todo check canvas support at startup - done check osrm is up - - ## DONE - - done arrows on screenshot - done public maps - done editing map on map list - done setting map public on map list - - done routing spinner - done maybe: stickers clusterization? - done moving out the screen makes stickers editable again - - done check if osrm available - done selecting map on dialog in edit mode opens it at view mode - done make arrows and distance points - - done fix arrows (can't reproduce now :-( ) - done adding route, applying it and adding again and deleting it makes ghost points on the map - - done adding/removing points doesn't change distance - done cancelling editing someone's else map return back to it's original address /razminochnyj/ - done change title on route opening - done delete sticker icon - - done tooltips for panel items - done map catalogue - done public maps - done map search - done map list lazy loading - - done save spinner - done better poly editor https://github.com/SupriyaSudhindra/leaflet-editable-polyline - done update after point delete - done hidden markers tooltip - - done clear routing on editing cancellation - done riding speed slider - done dont close map list on click - done fix loaded stickers has wrong text placement for right-sided captions - done fix save button should not react to clicks - done stickers with empty text should not have blackbox at view mode - done add ability to copy-paste address after saving - - done hide sticker dialog on sticker selection - done separate mode for sticker selection - done TEST: set initialData after saving map, clear is-modified - done TEST: provider / logo triggers setChanged - done shot mechanism (100%) - done client-side shot mechanism - done croppr.js - done shot stickers - done progress - done hotkeys via sagas - done better loader screen - done network errors handling on startup - - done stickers drag on rotate bug - */ - import React from 'react'; import ReactDOM from 'react-dom'; -import { App } from '$containers/App'; -import '$styles/main.less'; +import { App } from '~/containers/App'; +import '~/styles/main.less'; import { Provider } from 'react-redux'; import { PersistGate } from 'redux-persist/integration/react'; -import { configureStore } from '$redux/store'; -import { pushLoaderState } from '$utils/history'; +import { configureStore } from '~/redux/store'; +import { pushLoaderState } from '~/utils/history'; const { store, persistor } = configureStore(); diff --git a/src/modules/InteractivePoly.ts b/src/modules/InteractivePoly.ts index c0e15a9..c67c9e3 100644 --- a/src/modules/InteractivePoly.ts +++ b/src/modules/InteractivePoly.ts @@ -18,7 +18,7 @@ import { LatLngLiteral } from "leaflet"; -import { distKm, distToSegment, getPolyLength, pointInArea } from "$utils/geom"; +import { distKm, distToSegment, getPolyLength, pointInArea } from "~/utils/geom"; interface InteractivePolylineOptions extends PolylineOptions { maxMarkers?: number; diff --git a/src/redux/map/actions.ts b/src/redux/map/actions.ts index e091219..537caee 100644 --- a/src/redux/map/actions.ts +++ b/src/redux/map/actions.ts @@ -1,6 +1,6 @@ import { MAP_ACTIONS } from './constants'; import { IMapReducer } from './'; -import { IStickerDump } from '$redux/map/types'; +import { IStickerDump } from '~/redux/map/types'; import { ILatLng } from './types'; export const mapSet = (map: Partial) => ({ diff --git a/src/redux/map/index.ts b/src/redux/map/index.ts index 47a64f8..a72482d 100644 --- a/src/redux/map/index.ts +++ b/src/redux/map/index.ts @@ -1,9 +1,9 @@ import { createReducer } from 'reduxsauce'; import { MAP_HANDLERS } from './handlers'; -import { DEFAULT_PROVIDER } from '$constants/providers'; +import { DEFAULT_PROVIDER } from '~/constants/providers'; import { IMapRoute } from './types'; -import { IStickerDump } from '$redux/map/types'; -import { DEFAULT_LOGO } from '$constants/logos'; +import { IStickerDump } from '~/redux/map/types'; +import { DEFAULT_LOGO } from '~/constants/logos'; export interface IMapReducer { provider: string; diff --git a/src/redux/map/sagas.ts b/src/redux/map/sagas.ts index 51f52a8..c400922 100644 --- a/src/redux/map/sagas.ts +++ b/src/redux/map/sagas.ts @@ -1,8 +1,8 @@ import { takeEvery, select, put, call, TakeEffect, race, take, takeLatest } from 'redux-saga/effects'; import { MAP_ACTIONS } from './constants'; import { mapClicked, mapAddSticker, mapSetProvider, mapSet, mapSetTitle, mapSetAddress, mapSetDescription, mapSetOwner, mapSetPublic } from './actions'; -import { selectUserMode, selectUserActiveSticker, selectUser, selectUserUser } from '$redux/user/selectors'; -import { MODES } from '$constants/modes'; +import { selectUserMode, selectUserActiveSticker, selectUser, selectUserUser } from '~/redux/user/selectors'; +import { MODES } from '~/constants/modes'; import { setMode, setChanged, @@ -15,15 +15,15 @@ import { sendSaveRequest, setSaveSuccess, setSaveOverwrite, -} from '$redux/user/actions'; -import { pushLoaderState, getUrlData, pushPath, replacePath } from '$utils/history'; -import { setReadySaga, searchSetSagaWorker } from '$redux/user/sagas'; -import { getStoredMap, postMap } from '$utils/api'; -import { Unwrap } from '$utils/middleware'; -import { DEFAULT_PROVIDER } from '$constants/providers'; -import { USER_ACTIONS } from '$redux/user/constants'; +} from '~/redux/user/actions'; +import { pushLoaderState, getUrlData, pushPath, replacePath } from '~/utils/history'; +import { setReadySaga, searchSetSagaWorker } from '~/redux/user/sagas'; +import { getStoredMap, postMap } from '~/utils/api'; +import { Unwrap } from '~/utils/middleware'; +import { DEFAULT_PROVIDER } from '~/constants/providers'; +import { USER_ACTIONS } from '~/redux/user/constants'; import { selectMap } from './selectors'; -import { TIPS } from '$constants/tips'; +import { TIPS } from '~/constants/tips'; import { delay } from 'redux-saga'; function* onMapClick({ latlng }: ReturnType) { diff --git a/src/redux/map/selectors.ts b/src/redux/map/selectors.ts index 222d8aa..445d95a 100644 --- a/src/redux/map/selectors.ts +++ b/src/redux/map/selectors.ts @@ -1,4 +1,4 @@ -import { IState } from "$redux/store"; +import { IState } from "~/redux/store"; export const selectMap = (state: IState) => state.map; export const selectMapProvider = (state: IState) => state.map.provider; diff --git a/src/redux/map/types.ts b/src/redux/map/types.ts index e36f37b..1d15bd3 100644 --- a/src/redux/map/types.ts +++ b/src/redux/map/types.ts @@ -1,5 +1,5 @@ import { LatLng } from 'leaflet'; -import { IRoutePoint } from '$utils/gpx'; +import { IRoutePoint } from '~/utils/gpx'; export type ILatLng = { lat: number; diff --git a/src/redux/store.ts b/src/redux/store.ts index 377c853..6da5577 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -4,13 +4,13 @@ import { persistStore, persistReducer } from 'redux-persist'; import storage from 'redux-persist/lib/storage'; import createSagaMiddleware from 'redux-saga'; -import { userReducer, IRootReducer } from '$redux/user'; -import { userSaga } from '$redux/user/sagas'; -import { mapSaga } from '$redux/map/sagas'; +import { userReducer, IRootReducer } from '~/redux/user'; +import { userSaga } from '~/redux/user/sagas'; +import { mapSaga } from '~/redux/map/sagas'; import { createBrowserHistory } from 'history'; -import { locationChanged } from '$redux/user/actions'; +import { locationChanged } from '~/redux/user/actions'; import { PersistConfig, Persistor } from "redux-persist/es/types"; -import { map, IMapReducer } from '$redux/map'; +import { map, IMapReducer } from '~/redux/map'; const userPersistConfig: PersistConfig = { key: 'user', diff --git a/src/redux/user/actions.ts b/src/redux/user/actions.ts index 14dc609..19d416f 100644 --- a/src/redux/user/actions.ts +++ b/src/redux/user/actions.ts @@ -1,7 +1,7 @@ -import { USER_ACTIONS } from '$redux/user/constants'; -import { IUser } from "$constants/auth"; -import { IRootState } from "$redux/user"; -import { IRoute } from '$redux/map/types'; +import { USER_ACTIONS } from '~/redux/user/constants'; +import { IUser } from "~/constants/auth"; +import { IRootState } from "~/redux/user"; +import { IRoute } from '~/redux/map/types'; export const setUser = (user: IUser) => ({ type: USER_ACTIONS.SET_USER, user }); export const userLogout = () => ({ type: USER_ACTIONS.USER_LOGOUT }); diff --git a/src/redux/user/handlers.ts b/src/redux/user/handlers.ts index 271687d..8d9cba9 100644 --- a/src/redux/user/handlers.ts +++ b/src/redux/user/handlers.ts @@ -1,7 +1,7 @@ import { IRootState } from "."; import * as ActionCreators from './actions' -import { TIPS } from "$constants/tips"; -import { TABS } from "$constants/dialogs"; +import { TIPS } from "~/constants/tips"; +import { TABS } from "~/constants/dialogs"; import { USER_ACTIONS } from "./constants"; type UnsafeReturnType = T extends (...args: any[]) => infer R ? R : any; diff --git a/src/redux/user/index.ts b/src/redux/user/index.ts index 15d1e12..56e177e 100644 --- a/src/redux/user/index.ts +++ b/src/redux/user/index.ts @@ -1,8 +1,8 @@ import { createReducer } from 'reduxsauce'; -import { DEFAULT_USER, IUser } from '$constants/auth'; -import { MODES } from '$constants/modes'; -import { DIALOGS, IDialogs } from '$constants/dialogs'; -import { IStickers } from "$constants/stickers"; +import { DEFAULT_USER, IUser } from '~/constants/auth'; +import { MODES } from '~/constants/modes'; +import { DIALOGS, IDialogs } from '~/constants/dialogs'; +import { IStickers } from "~/constants/stickers"; import { USER_HANDLERS } from './handlers'; export interface IRouteListItem { diff --git a/src/redux/user/sagas.ts b/src/redux/user/sagas.ts index ce04081..241db78 100644 --- a/src/redux/user/sagas.ts +++ b/src/redux/user/sagas.ts @@ -17,7 +17,7 @@ import { getRouteList, modifyRoute, sendRouteStarred, -} from '$utils/api'; +} from '~/utils/api'; import { hideRenderer, searchPutRoutes, @@ -38,7 +38,7 @@ import { setFeature, searchSetTitle, setRouteStarred, -} from '$redux/user/actions'; +} from '~/redux/user/actions'; import { getUrlData, @@ -46,10 +46,10 @@ import { pushLoaderState, pushNetworkInitError, pushPath, -} from '$utils/history'; -import { USER_ACTIONS } from '$redux/user/constants'; -import { MODES } from '$constants/modes'; -import { DEFAULT_USER } from '$constants/auth'; +} from '~/utils/history'; +import { USER_ACTIONS } from '~/redux/user/constants'; +import { MODES } from '~/constants/modes'; +import { DEFAULT_USER } from '~/constants/auth'; import { composeArrows, composeDistMark, @@ -62,18 +62,18 @@ import { getStickersPlacement, getTilePlacement, imageFetcher, -} from '$utils/renderer'; -import { LOGOS } from '$constants/logos'; -import { DIALOGS, TABS } from '$constants/dialogs'; +} from '~/utils/renderer'; +import { LOGOS } from '~/constants/logos'; +import { DIALOGS, TABS } from '~/constants/dialogs'; -import * as ActionCreators from '$redux/user/actions'; -import { downloadGPXTrack, getGPXString } from '$utils/gpx'; -import { Unwrap } from '$utils/middleware'; -import { IState } from '$redux/store'; +import * as ActionCreators from '~/redux/user/actions'; +import { downloadGPXTrack, getGPXString } from '~/utils/gpx'; +import { Unwrap } from '~/utils/middleware'; +import { IState } from '~/redux/store'; import { selectUser, selectUserUser } from './selectors'; -import { mapInitSaga, loadMapSaga, replaceAddressIfItsBusy } from '$redux/map/sagas'; +import { mapInitSaga, loadMapSaga, replaceAddressIfItsBusy } from '~/redux/map/sagas'; import { LatLng } from 'leaflet'; -import { selectMap } from '$redux/map/selectors'; +import { selectMap } from '~/redux/map/selectors'; // const getUser = (state: IState) => state.user.user; // const selectUser = (state: IState) => state.user; diff --git a/src/redux/user/selectors.ts b/src/redux/user/selectors.ts index 7c157c9..4d9e268 100644 --- a/src/redux/user/selectors.ts +++ b/src/redux/user/selectors.ts @@ -1,4 +1,4 @@ -import { IState } from '$redux/store' +import { IState } from '~/redux/store' export const selectUser = (state: IState) => state.user; export const selectUserUser = (state: IState) => state.user.user; diff --git a/src/utils/api.ts b/src/utils/api.ts index 47a3f8b..fdad497 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -1,8 +1,8 @@ import axios from 'axios/index'; -import { API } from '$constants/api'; -import { IRootState, IRouteListItem } from '$redux/user'; -import { IUser } from '$constants/auth'; -import { CLIENT } from '$config/frontend'; +import { API } from '~/constants/api'; +import { IRootState, IRouteListItem } from '~/redux/user'; +import { IUser } from '~/constants/auth'; +import { CLIENT } from '~/config/frontend'; import { LatLngLiteral } from 'leaflet'; import { resultMiddleware, @@ -10,7 +10,7 @@ import { IResultWithStatus, configWithToken, } from './middleware'; -import { IRoute } from '$redux/map/types'; +import { IRoute } from '~/redux/map/types'; const arrayToObject = (array: any[], key: string): {} => array.reduce((obj, el) => ({ ...obj, [el[key]]: el }), {}); diff --git a/src/utils/arrow.ts b/src/utils/arrow.ts index e5439d8..ae52e2a 100644 --- a/src/utils/arrow.ts +++ b/src/utils/arrow.ts @@ -1,6 +1,6 @@ import { divIcon, LatLngLiteral, Marker, marker, DivIcon } from "leaflet"; -const arrow_image = require('$sprites/arrow.svg'); +const arrow_image = require('~/sprites/arrow.svg'); // export const createArrow = (latlng: LatLngLiteral, angle: number): Marker => marker(latlng, { diff --git a/src/utils/history.ts b/src/utils/history.ts index a1ce63f..c23be92 100644 --- a/src/utils/history.ts +++ b/src/utils/history.ts @@ -1,5 +1,5 @@ -import { history } from '$redux/store'; -import {API_RETRY_INTERVAL} from "$constants/api"; +import { history } from '~/redux/store'; +import {API_RETRY_INTERVAL} from "~/constants/api"; interface IUrlData { path: string, diff --git a/src/utils/renderer.ts b/src/utils/renderer.ts index e5fff74..650999e 100644 --- a/src/utils/renderer.ts +++ b/src/utils/renderer.ts @@ -1,19 +1,19 @@ -// import { editor } from '$modules/Editor'; -import { COLORS, CLIENT } from '$config/frontend'; +// import { editor } from '~/modules/Editor'; +import { COLORS, CLIENT } from '~/config/frontend'; import saveAs from 'file-saver'; -import { replaceProviderUrl } from '$constants/providers'; -import { STICKERS } from '$constants/stickers'; -import { ILatLng, IRoute } from '$redux/map/types'; -import { IStickerDump } from '$redux/map/types'; -import { IRootState } from '$redux/user'; +import { replaceProviderUrl } from '~/constants/providers'; +import { STICKERS } from '~/constants/stickers'; +import { ILatLng, IRoute } from '~/redux/map/types'; +import { IStickerDump } from '~/redux/map/types'; +import { IRootState } from '~/redux/user'; import { angleBetweenPoints, angleBetweenPointsRad, findDistancePx, middleCoordPx, -} from '$utils/geom'; +} from '~/utils/geom'; import { Point } from 'leaflet'; -import { MainMap } from '$containers/map/Map'; +import { MainMap } from '~/containers/map/Map'; export interface ITilePlacement { minX: number; @@ -215,7 +215,7 @@ export const composeArrows = async ({ points: Point[]; ctx: CanvasRenderingContext2D; }): Promise => { - const image = await imageFetcher(require('$sprites/arrow.svg')); + const image = await imageFetcher(require('~/sprites/arrow.svg')); const distances = points.map( (point, i) => (points[i + 1] && findDistancePx(points[i], points[i + 1])) || 0 diff --git a/src/utils/simplify.ts b/src/utils/simplify.ts index 19f60f0..9e65df1 100644 --- a/src/utils/simplify.ts +++ b/src/utils/simplify.ts @@ -1,5 +1,5 @@ import { Map, LineUtil } from 'leaflet'; -import { ILatLng } from "$redux/map/types"; +import { ILatLng } from "~/redux/map/types"; export const simplify = ({ map, latlngs }: { map: Map, latlngs: ILatLng[] }): ILatLng[] => { const points = []; diff --git a/src/utils/window.ts b/src/utils/window.ts index f5cc23e..8174964 100644 --- a/src/utils/window.ts +++ b/src/utils/window.ts @@ -1,3 +1,3 @@ -import { MOBILE_BREAKPOINT } from '$config/frontend'; +import { MOBILE_BREAKPOINT } from '~/config/frontend'; export const isMobile = (): boolean => (window.innerWidth <= MOBILE_BREAKPOINT); diff --git a/tsconfig.json b/tsconfig.json index d283ce8..48ad582 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,15 +13,7 @@ "isolatedModules": true, "baseUrl": ".", "paths": { - "$components/*": [ "src/components/*" ], - "$containers/*": [ "src/containers/*" ], - "$constants/*": [ "src/constants/*" ], - "$sprites/*": [ "src/sprites/*" ], - "$config/*": [ "./config/*" ], - "$styles/*": [ "src/styles/*" ], - "$redux/*": [ "src/redux/*" ], - "$utils/*": [ "src/utils/*" ], - "$modules/*": [ "src/modules/*" ], + "~/*": [ "src/*" ], "custom_modules/*": [ "src/custom_modules/*" ] diff --git a/webpack.config.js b/webpack.config.js index d05fc22..f91dd0d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,22 +1,15 @@ -// import { CLIENT } from './config/frontend'; const webpack = require('webpack'); const HtmlWebPackPlugin = require('html-webpack-plugin'); -// const FlowWebpackPlugin = require('flow-webpack-plugin'); -// const { version } = require('./package.json'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); -// const WebpackGitHash = require('webpack-git-hash'); const path = require('path'); const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const WebpackPwaManifest = require('webpack-pwa-manifest'); const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'); -// import webpack from 'webpack'; -const PWA_CONFIG = require('./config/pwa'); -// const ManifestPlugin = require('webpack-manifest-plugin'); -/* Plugins */ +const PWA_CONFIG = require('./src/config/pwa'); -// const concatPlugin = new webpack.optimize.ModuleConcatenationPlugin(); +/* Plugins */ const htmlPlugin = new HtmlWebPackPlugin({ template: './src/index.html', @@ -35,24 +28,20 @@ const miniCssExractPlugin = new MiniCssExtractPlugin({ const devtool = isDevelopment ? 'cheap-module-eval-source-map' : 'source-map'; -// const flowPlugin = new FlowWebpackPlugin(); - -// const gitPlugin = new WebpackGitHash(); - - /* Resolve */ const resolve = { alias: { - $components: path.join(__dirname, 'src/components'), - $containers: path.join(__dirname, 'src/containers'), - $constants: path.join(__dirname, 'src/constants'), - $sprites: path.join(__dirname, 'src/sprites'), - $config: path.join(__dirname, './config'), - $styles: path.join(__dirname, 'src/styles'), - $redux: path.join(__dirname, 'src/redux'), - $utils: path.join(__dirname, 'src/utils'), - $modules: path.join(__dirname, 'src/modules'), + // $components: path.join(__dirname, 'src/components'), + // $containers: path.join(__dirname, 'src/containers'), + // $constants: path.join(__dirname, 'src/constants'), + // $sprites: path.join(__dirname, 'src/sprites'), + // $config: path.join(__dirname, './config'), + // $styles: path.join(__dirname, 'src/styles'), + // $redux: path.join(__dirname, 'src/redux'), + // $utils: path.join(__dirname, 'src/utils'), + // $modules: path.join(__dirname, 'src/modules'), + '~': path.join(__dirname, 'src'), }, extensions: ['*', '.ts', '.tsx', '.js', '.jsx', '.json'] };