Page layout refactoring (#14535)

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
This commit is contained in:
Raphaël Bosi
2025-09-16 17:42:51 +02:00
committed by GitHub
parent e69131790c
commit 3b868c3d2a
90 changed files with 2070 additions and 1928 deletions
@@ -6,14 +6,10 @@ import { COMMAND_MENU_PAGES_CONFIG } from '@/command-menu/constants/CommandMenuP
import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState';
import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState';
import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext';
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { motion } from 'framer-motion';
import { useLocation } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import { SettingsPath } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
const StyledCommandMenuContent = styled.div`
@@ -24,8 +20,6 @@ const StyledCommandMenuContent = styled.div`
export const CommandMenuRouter = () => {
const commandMenuPage = useRecoilValue(commandMenuPageState);
const commandMenuPageInfo = useRecoilValue(commandMenuPageInfoState);
const location = useLocation();
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
const commandMenuPageComponent = isDefined(commandMenuPage) ? (
COMMAND_MENU_PAGES_CONFIG.get(commandMenuPage)
@@ -35,13 +29,6 @@ export const CommandMenuRouter = () => {
const theme = useTheme();
const isSettingsPage = location.pathname.includes(SettingsPath.PageLayout);
const objectMetadataItemOverride = isSettingsPage
? objectMetadataItems.find(
(item) => item.nameSingular === CoreObjectNameSingular.Dashboard,
)
: undefined;
return (
<CommandMenuContainer>
<CommandMenuContextChipRecordSetterEffect />
@@ -64,7 +51,6 @@ export const CommandMenuRouter = () => {
isInRightDrawer={true}
displayType="listItem"
actionMenuType="command-menu"
objectMetadataItemOverride={objectMetadataItemOverride}
>
{commandMenuPageComponent}
</ActionMenuContextProvider>