fix: import sidebar issues (#1712)

This commit is contained in:
Meier Lukas
2024-12-18 13:52:10 +01:00
committed by GitHub
parent 5fbbf037ce
commit a51999457b
6 changed files with 34 additions and 9 deletions

View File

@@ -81,13 +81,26 @@ export const moveWidgetsAndAppsIfMerge = (
}
if (configuration.sidebarBehaviour === "last-section") {
if (old.settings.customization.layout.enabledLeftSidebar) {
const areas = [...old.apps.map((app) => app.area), ...old.widgets.map((widget) => widget.area)];
if (
old.settings.customization.layout.enabledLeftSidebar ||
areas.some((area) => area.type === "sidebar" && area.properties.location === "left")
) {
offset = moveWidgetsAndAppsInLeftSidebar(old, firstId, offset, configuration.screenSize);
}
if (old.settings.customization.layout.enabledRightSidebar) {
if (
old.settings.customization.layout.enabledRightSidebar ||
areas.some((area) => area.type === "sidebar" && area.properties.location === "right")
) {
moveWidgetsAndAppsInRightSidebar(old, firstId, offset, configuration.screenSize);
}
} else {
// Remove all widgets and apps in the sidebar
return {
apps: old.apps.filter((app) => app.area.type !== "sidebar"),
widgets: old.widgets.filter((app) => app.area.type !== "sidebar"),
};
}
return { apps: old.apps, widgets: old.widgets };