Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publisher themeprovider to panels #2753

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 36 additions & 34 deletions bundles/framework/publisher2/view/MapLayers/MapLayers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const LayerTitle = styled('span')`
const LayerContainer = styled('div')`
display: flex;
flex-direction: column;
margin-top: 20px;
`;

export const MapLayers = ({ state, controller }) => {
Expand All @@ -46,49 +45,52 @@ export const MapLayers = ({ state, controller }) => {
<PublisherToolsList state={state} controller={controller} />
</Card>
{layerListPluginEnabled && (
<Card size='small' title={<Message messageKey='BasicView.mapLayers.baseLayers' />}>
<LayerContainer>
{baseLayers.map((layer) => {
const disabled = !layer.isVisible();
return (
<LayerBox key={layer.getId()} disabled={disabled}>
<LayerTitle>{layer.getName()}</LayerTitle>
{!disabled && (
<IconButton
icon={<DownCircleOutlined />}
onClick={() => controller.removeBaseLayer(layer)}
/>
)}
</LayerBox>
)
})}
</LayerContainer>
{layerListPluginEnabled && baseLayers?.length < 1 && (
<Message messageKey='BasicView.mapLayers.noBaseLayers' />
)}
</Card>
)}
<Card size='small' title={<Message messageKey='BasicView.mapLayers.otherLayers' />}>
<LayerContainer>
<h3><Message messageKey='BasicView.mapLayers.baseLayers' /></h3>
{baseLayers.map((layer) => {
<div className='ant-card-head-title'></div>
{layers.map((layer) => {
const disabled = !layer.isVisible();
return (
<LayerBox key={layer.getId()} disabled={disabled}>
<LayerTitle>{layer.getName()}</LayerTitle>
{!disabled && (
<IconButton
icon={<DownCircleOutlined />}
onClick={() => controller.removeBaseLayer(layer)}
/>
{!disabled && layerListPluginEnabled && (
<Tooltip getPopupContainer={(triggerNode) => triggerNode.parentElement} title={<Message messageKey='BasicView.maptools.layerselection.selectAsBaselayer' />}>
<IconButton
icon={<UpCircleOutlined />}
onClick={() => controller.addBaseLayer(layer)}
/>
</Tooltip>
)}
</LayerBox>
)
})}
</LayerContainer>
)}
{layerListPluginEnabled && baseLayers?.length < 1 && (
<Message messageKey='BasicView.mapLayers.noBaseLayers' />
)}
<LayerContainer>
<h3><Message messageKey='BasicView.mapLayers.otherLayers' /></h3>
{layers.map((layer) => {
const disabled = !layer.isVisible();
return (
<LayerBox key={layer.getId()} disabled={disabled}>
<LayerTitle>{layer.getName()}</LayerTitle>
{!disabled && layerListPluginEnabled && (
<Tooltip getPopupContainer={(triggerNode) => triggerNode.parentElement} title={<Message messageKey='BasicView.maptools.layerselection.selectAsBaselayer' />}>
<IconButton
icon={<UpCircleOutlined />}
onClick={() => controller.addBaseLayer(layer)}
/>
</Tooltip>
)}
</LayerBox>
)
})}
</LayerContainer>
{layers?.length < 1 && (
<Message messageKey='BasicView.mapLayers.noLayers' />
)}
{layers?.length < 1 && (
<Message messageKey='BasicView.mapLayers.noLayers' />
)}
</Card>
<ButtonContainer>
<Button onClick={() => controller.openSelectedLayerList()}>
<Message messageKey='BasicView.mapLayers.layersDisplay' />
Expand Down
16 changes: 9 additions & 7 deletions bundles/framework/publisher2/view/PanelMapLayers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { LocaleProvider } from 'oskari-ui/util';
import { ThemeProvider, LocaleProvider } from 'oskari-ui/util';
import { MapLayers } from './MapLayers/MapLayers';
import ReactDOM from 'react-dom';
import { MapLayersHandler } from '../handler/MapLayersHandler';
Expand Down Expand Up @@ -189,12 +189,14 @@ Oskari.clazz.define('Oskari.mapframework.bundle.publisher2.view.PanelMapLayers',
const contentPanel = this.panel.getContainer();

ReactDOM.render(
<LocaleProvider value={{ bundleKey: 'Publisher2' }}>
<MapLayers
state={this.handler.getState()}
controller={this.handler.getController()}
/>
</LocaleProvider>,
<ThemeProvider>
<LocaleProvider value={{ bundleKey: 'Publisher2' }}>
<MapLayers
state={this.handler.getState()}
controller={this.handler.getController()}
/>
</LocaleProvider>
</ThemeProvider>,
contentPanel[0]
);
},
Expand Down
16 changes: 9 additions & 7 deletions bundles/framework/publisher2/view/PanelRpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { ToolPanelHandler } from '../handler/ToolPanelHandler';
import { PublisherToolsList } from './form/PublisherToolsList';
import { LocaleProvider } from 'oskari-ui/util';
import { ThemeProvider, LocaleProvider } from 'oskari-ui/util';

/**
* @class Oskari.mapframework.bundle.publisher.view.PanelRpc
Expand Down Expand Up @@ -100,12 +100,14 @@ Oskari.clazz.define('Oskari.mapframework.bundle.publisher2.view.PanelRpc',
}
const contentPanel = this.panel.getContainer();
ReactDOM.render(
<LocaleProvider value={{ bundleKey: 'Publisher2' }}>
<PublisherToolsList
state={this.handler.getState()}
controller={this.handler.getController()}
/>
</LocaleProvider>,
<ThemeProvider>
<LocaleProvider value={{ bundleKey: 'Publisher2' }}>
<PublisherToolsList
state={this.handler.getState()}
controller={this.handler.getController()}
/>
</LocaleProvider>
</ThemeProvider>,
contentPanel[0]
);
}
Expand Down