3b868c3d2a
In this PR: - Refactored the page layout renderer - Converted all the states to component states - Removed the page layout edition in settings TODOs in next PRs: - Fix bug with the drag selector not taking the scroll into account to display the dragged area - Readd the tab edition in edit mode
25 lines
571 B
TypeScript
25 lines
571 B
TypeScript
import { type TabLayouts } from '@/page-layout/types/tab-layouts';
|
|
|
|
export const removeWidgetLayoutFromTab = (
|
|
allTabLayouts: TabLayouts,
|
|
tabId: string,
|
|
widgetId: string,
|
|
): TabLayouts => {
|
|
if (!allTabLayouts[tabId]) {
|
|
return allTabLayouts;
|
|
}
|
|
|
|
const currentTabLayouts = allTabLayouts[tabId];
|
|
return {
|
|
...allTabLayouts,
|
|
[tabId]: {
|
|
desktop: currentTabLayouts.desktop.filter(
|
|
(layout) => layout.i !== widgetId,
|
|
),
|
|
mobile: currentTabLayouts.mobile.filter(
|
|
(layout) => layout.i !== widgetId,
|
|
),
|
|
},
|
|
};
|
|
};
|