Fix layout issue of sidebar panel due to timeline plugin#12432
Fix layout issue of sidebar panel due to timeline plugin#12432subashtiwari1010 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
@subashtiwari1010 I saw you managed to fix the same problem on several plugins in the same way. Excellent fix.
But to ensure this solution remains more robust over time, I propose moving the replicated code in the plugins to a single point and then importing it in any plugins.
In particular, this one, which has a constant 40 pixels, in the calculation:
https://github.com/geosolutions-it/MapStore2/pull/12432/changes?show-viewed-files=false#diff-aab8635813be3f3fbb3dd7b03ecff52fa0ff2d5afeed87ea466f30bd423b71deR1062-R1065
Defining it as a new utils that accepts layout as a parameter from plugins.
This should prevent it from breaking with future changes to the plugins.
And let's reduce the replicated code for managing plugin layouts.
For example, a function getBoundingSidebarRect(layout) in the file: /web/client/utils/LayoutUtils.js
then in the plugins:
import {getBoundingSidebarRect} from "/web/client/utils/LayoutUtils.js"
...
...plugin specific code..
...
.map(({layout}) => {
const boundingSidebarRect = getBoundingSidebarRect(layout);
const action = updateMapLayout({
...
...
...plugin specific code..
...and new utils in /web/client/utils/LayoutUtils.js:
const = DEFAULT_RIGHT = 40;
export const getBoundingSidebarRect = (layout) => ({
...(layout?.boundingSidebarRect || {}),
right: layout?.boundingSidebarRect?.right ?? DEFAULT_RIGHT
});or smilar to this one
Description
This PR updates the layout styling for the Sidebar panel i.e. Itinerary, Isochrone, Longitudinal profile and Geoprocessing when expanding the timeline plugin as mentioned in the #12332 (comment).
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
What is the current behavior?
The sidebar panel shifts to the left whenever the timeline plugin is expanded/collapsed.
#11926
What is the new behavior?
The sidebar panel are all in their respective position even when the timeline plugin is expanded/collapsed.
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information