-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2703 from DenverCoder544/publisher_tools_reactifi…
…cation Publisher tools reactification
- Loading branch information
Showing
18 changed files
with
211 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
bundles/mapping/mapmodule/plugin/mylocation/publisher/MyLocationComponent.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Radio, Message, Checkbox } from 'oskari-ui'; | ||
import styled from 'styled-components'; | ||
|
||
const Column = styled('div')` | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
export const MyLocationComponent = ({ state, controller }) => { | ||
const onSelectionChange = (property, value) => { | ||
controller.updateOptions(property, value); | ||
}; | ||
|
||
const { mode, centerMapAutomatically, mobileOnly } = state; | ||
return <> | ||
<Column> | ||
<Message bundleKey={'MapModule'} messageKey={'publisherTools.MyLocationPlugin.titles.mode'}/> | ||
<Radio.Group | ||
value={mode} | ||
onChange={(evt) => onSelectionChange('mode', evt.target.value)} | ||
> | ||
<Radio.Choice value={'continuous'}> | ||
<Message bundleKey={'MapModule'} messageKey={'publisherTools.MyLocationPlugin.modes.continuous'}/> | ||
</Radio.Choice> | ||
<Radio.Choice value={'single'}> | ||
<Message bundleKey={'MapModule'} messageKey={'publisherTools.MyLocationPlugin.modes.single'}/> | ||
</Radio.Choice> | ||
</Radio.Group> | ||
</Column> | ||
<Column> | ||
<Checkbox checked={centerMapAutomatically} onChange={evt => onSelectionChange('centerMapAutomatically', evt.target.checked)}> | ||
<Message bundleKey={'MapModule'} messageKey={'publisherTools.MyLocationPlugin.titles.centerMapAutomatically'}/> | ||
</Checkbox> | ||
<Checkbox checked={mobileOnly} onChange={evt => onSelectionChange('mobileOnly', evt.target.checked)}> | ||
<Message bundleKey={'MapModule'} messageKey={'publisherTools.MyLocationPlugin.titles.mobileOnly'}/> | ||
</Checkbox> | ||
</Column> | ||
</>; | ||
}; | ||
|
||
MyLocationComponent.propTypes = { | ||
state: PropTypes.object, | ||
controller: PropTypes.object | ||
}; |
32 changes: 32 additions & 0 deletions
32
bundles/mapping/mapmodule/plugin/mylocation/publisher/MyLocationHandler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { StateHandler, controllerMixin } from 'oskari-ui/util'; | ||
|
||
class UIHandler extends StateHandler { | ||
constructor (tool) { | ||
super(); | ||
this.tool = tool; | ||
this.sandbox = tool.getSandbox(); | ||
this.setState({ | ||
mode: 'single', | ||
centerMapAutomatically: false, | ||
mobileOnly: false | ||
}); | ||
}; | ||
|
||
init (pluginConfig) { | ||
this.updateState({ | ||
...pluginConfig | ||
}); | ||
} | ||
|
||
updateOptions (key, value) { | ||
const newState = this.getState(); | ||
newState[key] = value; | ||
this.updateState(newState); | ||
} | ||
} | ||
|
||
const wrapped = controllerMixin(UIHandler, [ | ||
'updateOptions' | ||
]); | ||
|
||
export { wrapped as MyLocationToolHandler }; |
Oops, something went wrong.