From d8286004a4c40edf63069678280be4cc43b62e5f Mon Sep 17 00:00:00 2001 From: sipp11 Date: Fri, 3 Aug 2018 19:10:54 +0900 Subject: [PATCH] Stop Aura WIP --- src/actions/index.js | 6 ++++++ src/constants/ActionTypes.js | 1 + src/container/Geo.js | 28 ++++++++++++++++++++++++++-- src/reducers/geo.js | 13 ++++++++++--- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 7f2e8f6..47a5ace 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -71,6 +71,12 @@ export const geoStopToggler = () => { } } +export const geoStopAuraToggler = () => { + return { + type: types.GEO_STOP_AURA_TOGGLE, + } +} + export const geoLocationFailed = (positionErr) => { // PositionErrorĀ {code: 3, message: "Timeout expired"} return { diff --git a/src/constants/ActionTypes.js b/src/constants/ActionTypes.js index daa9403..9bb1607 100644 --- a/src/constants/ActionTypes.js +++ b/src/constants/ActionTypes.js @@ -15,6 +15,7 @@ export const GEO_DRAGMARKER_CHANGE = 'GEO_DRAGMARKER_CHANGE' export const GEO_MAPCENTER_UPDATE = 'GEO_MAPCENTER_UPDATE' export const GEO_LASTCENTER_UPDATE = 'GEO_LASTCENTER_UPDATE' export const GEO_STOPMARKER_TOGGLE = 'GEO_STOPMARKER_TOGGLE' +export const GEO_STOP_AURA_TOGGLE = 'GEO_STOP_AURA_TOGGLE' export const REQUEST_LOGIN = 'REQUEST_LOGIN' export const SUCCESS_LOGIN = 'SUCCESS_LOGIN' diff --git a/src/container/Geo.js b/src/container/Geo.js index ee3a31f..b415b0e 100644 --- a/src/container/Geo.js +++ b/src/container/Geo.js @@ -12,6 +12,7 @@ import { loggedIn } from '../reducers/auth' import { geoLocationFailed, geoLocationUpdate, getAgency, draggableMarkerUpdate, lastCenterUpdate, geoStopToggler, + geoStopAuraToggler, } from '../actions' import FloatPane from '../components/FloatPane' import store from '../store' @@ -36,7 +37,7 @@ position: fixed; text-align: center; padding-top: 10px; right: 0; -bottom: 100px; +bottom: 150px; z-index: 30; ` @@ -50,10 +51,23 @@ position: fixed; text-align: center; padding-top: 10px; right: 0; -bottom: 50px; +bottom: 110px; z-index: 30; ` +const StopAuraToggler = styled.div` +width: 80px +height: 40px; +background: #fefefebb; +border-radius: 10px; +color: #209cee; +position: fixed; +text-align: center; +padding-top: 10px; +right: 0; +bottom: 70px; +z-index: 30; +` // TODO: filter for existing polygons @@ -214,6 +228,10 @@ class Geo extends Component { }} /> } + renderStopAura() { + + } + forceSetMapCenterToCurrent() { const { geo } = this.props const { leafletElement } = this.refs.map @@ -275,6 +293,9 @@ class Geo extends Component { store.dispatch(geoStopToggler())}> {geo.showStopMarker ?

show

:

hide

}
+ store.dispatch(geoStopAuraToggler())}> + {geo.showStopAura ?

A ON

:

A OFF

} +
+ ) diff --git a/src/reducers/geo.js b/src/reducers/geo.js index 9448d04..8ef4dd3 100644 --- a/src/reducers/geo.js +++ b/src/reducers/geo.js @@ -2,8 +2,9 @@ import { GEO_LOCATION_SUCCESS, GEO_LOCATION_FAILURE, GEO_MARKER_ADD, GEO_MARKER_RESET, GEO_MARKER_UPDATE, GEO_POLYGON_ADD, GEO_POLYGON_RESET, GEO_POLYGON_UPDATE, - GEO_MAPCENTER_UPDATE, GEO_LASTCENTER_UPDATE, GEO_STOPMARKER_TOGGLE, + GEO_MAPCENTER_UPDATE, GEO_LASTCENTER_UPDATE, GEO_DRAGMARKER_CHANGE, GEO_DRAGMARKER_DISABLE, GEO_DRAGMARKER_ENABLE, + GEO_STOPMARKER_TOGGLE, GEO_STOP_AURA_TOGGLE, } from '../constants/ActionTypes' const initialState = { @@ -16,17 +17,23 @@ const initialState = { mapCenter: [13.84626739, 100.538], zoom: 13, showStopMarker: false, + showStopAura: false, draggableMarker: false, draggableMarkerLatlon: [13.8462745, 100.5382592], } const geo = (state = initialState, action) => { switch (action.type) { - case GEO_STOPMARKER_TOGGLE: + case GEO_STOP_AURA_TOGGLE: return { ...state, - showStopMarker: !state.showStopMarker, + showStopAura: !state.showStopAura, } + case GEO_STOPMARKER_TOGGLE: + return { + ...state, + showStopMarker: !state.showStopMarker, + } case GEO_DRAGMARKER_ENABLE: return { ...state,