Skip to content

Commit

Permalink
Merge pull request #2703 from DenverCoder544/publisher_tools_reactifi…
Browse files Browse the repository at this point in the history
…cation

Publisher tools reactification
  • Loading branch information
ZakarFin authored Oct 22, 2024
2 parents fc80f16 + d12fb60 commit f11051e
Show file tree
Hide file tree
Showing 18 changed files with 211 additions and 210 deletions.
1 change: 0 additions & 1 deletion bundles/framework/publisher2/resources/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Oskari.registerLocalization(
"IndexMapPlugin": "Index map",
"PanButtons": "Move to the original map view",
"Portti2Zoombar": "Zoom bar",
"MyLocationPlugin": "Center to location",
"ControlsPlugin": "Pan by mouse",
"SearchPlugin": "Place search",
"FeaturedataPlugin": "Feature data",
Expand Down
1 change: 0 additions & 1 deletion bundles/framework/publisher2/resources/locale/fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Oskari.registerLocalization(
"IndexMapPlugin": "Indeksikartta",
"PanButtons": "Palaa alkutilaan",
"Portti2Zoombar": "Mittakaavasäädin",
"MyLocationPlugin": "Käyttäjän sijaintiin keskittäminen",
"ControlsPlugin": "Kartan liikuttaminen hiirellä raahaamalla",
"SearchPlugin": "Osoite- ja paikannimihaku",
"FeaturedataPlugin": "Kohdetietotaulukko",
Expand Down
2 changes: 0 additions & 2 deletions bundles/framework/publisher2/resources/locale/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ Oskari.registerLocalization(
"maptools": {
"label": "Outils",
"tooltip": "Sélectionner les outils de carte accessibles. Consulter une mise en place dans la prévisualisation de carte.",
"ScaleBarPlugin": "Barre d'échelle",
"TimeseriesControlPlugin": "Lecteur chronologique",
"IndexMapPlugin": "Carte-index",
"PanButtons": "Outil pour panoramiser",
"Portti2Zoombar": "Barre de zoom",
"MyLocationPlugin": "Centre par rapport au lieu",
"ControlsPlugin": "Panoramiser avec la souris",
"SearchPlugin": "Recherche de lieu",
"FeaturedataPlugin": "Données de fonctionnalité",
Expand Down
2 changes: 0 additions & 2 deletions bundles/framework/publisher2/resources/locale/is.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ Oskari.registerLocalization(
"maptools": {
"label": "Tól",
"tooltip": "Velja tiltæk kortatól. Athugaðu staðsetningu við forskoðun korts.",
"ScaleBarPlugin": "Mælikvarðastika",
"IndexMapPlugin": "Index kort",
"PanButtons": "Hliðrunartól",
"Portti2Zoombar": "Þysjunarstika",
"MyLocationPlugin": "Miðja",
"ControlsPlugin": "Hliðra með mús",
"SearchPlugin": "Leit eftir stað",
"FeaturedataPlugin": "Fitjugögn",
Expand Down
2 changes: 0 additions & 2 deletions bundles/framework/publisher2/resources/locale/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ Oskari.registerLocalization(
"maptools": {
"label": "Инструменты",
"tooltip": "Выберите доступные инструменты карты. Проверка размещения в окне предварительного просмотра карты.",
"ScaleBarPlugin": "Масштабная линейка",
"TimeseriesControlPlugin": "Временные ряды",
"IndexMapPlugin": "Номенклатура карты",
"PanButtons": "Инструмент панорамирования",
"Portti2Zoombar": "Панель увеличения",
"MyLocationPlugin": "Центровать к месту",
"ControlsPlugin": "Панорамирование мышью",
"SearchPlugin": "Поиск места",
"FeaturedataPlugin": "Данные объекта",
Expand Down
1 change: 0 additions & 1 deletion bundles/framework/publisher2/resources/locale/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Oskari.registerLocalization(
"IndexMapPlugin": "Indexkarta",
"PanButtons": "Gå tillbaka till standardvyn för kartvyn",
"Portti2Zoombar": "Skalans glidreglage",
"MyLocationPlugin": "Centrera kartan på användarens position",
"ControlsPlugin": "Flytta kartvyn med musen",
"SearchPlugin": "Adress- och ortnamnssökning",
"FeaturedataPlugin": "Objektuppgifter",
Expand Down
196 changes: 0 additions & 196 deletions bundles/framework/publisher2/tools/MyLocationTool.js

This file was deleted.

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
};
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 };
Loading

0 comments on commit f11051e

Please sign in to comment.