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:
@@ -1,9 +1,7 @@
|
||||
import { useCreateAppRouter } from '@/app/hooks/useCreateAppRouter';
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { RouterProvider } from 'react-router-dom';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
|
||||
export const AppRouter = () => {
|
||||
// We want to disable serverless function settings but keep the code for now
|
||||
@@ -15,17 +13,9 @@ export const AppRouter = () => {
|
||||
(currentUser?.canImpersonate || currentUser?.canAccessFullAdminPanel) ??
|
||||
false;
|
||||
|
||||
const isPageLayoutFeatureFlagEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_PAGE_LAYOUT_ENABLED,
|
||||
);
|
||||
|
||||
return (
|
||||
<RouterProvider
|
||||
router={useCreateAppRouter(
|
||||
isFunctionSettingsEnabled,
|
||||
isAdminPageEnabled,
|
||||
isPageLayoutFeatureFlagEnabled,
|
||||
)}
|
||||
router={useCreateAppRouter(isFunctionSettingsEnabled, isAdminPageEnabled)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -287,20 +287,6 @@ const SettingsObjectFieldEdit = lazy(() =>
|
||||
),
|
||||
);
|
||||
|
||||
const SettingsPageLayouts = lazy(() =>
|
||||
import('~/pages/settings/page-layout/SettingsPageLayouts').then((module) => ({
|
||||
default: module.SettingsPageLayouts,
|
||||
})),
|
||||
);
|
||||
|
||||
const SettingsPageLayoutEdit = lazy(() =>
|
||||
import('~/pages/settings/page-layout/SettingsPageLayoutEdit').then(
|
||||
(module) => ({
|
||||
default: module.SettingsPageLayoutEdit,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const SettingsSecurity = lazy(() =>
|
||||
import('~/pages/settings/security/SettingsSecurity').then((module) => ({
|
||||
default: module.SettingsSecurity,
|
||||
@@ -386,13 +372,11 @@ const SettingsRoleAddObjectLevel = lazy(() =>
|
||||
type SettingsRoutesProps = {
|
||||
isFunctionSettingsEnabled?: boolean;
|
||||
isAdminPageEnabled?: boolean;
|
||||
isPageLayoutFeatureFlagEnabled?: boolean;
|
||||
};
|
||||
|
||||
export const SettingsRoutes = ({
|
||||
isFunctionSettingsEnabled,
|
||||
isAdminPageEnabled,
|
||||
isPageLayoutFeatureFlagEnabled,
|
||||
}: SettingsRoutesProps) => (
|
||||
<Suspense fallback={<SettingsSkeletonLoader />}>
|
||||
<Routes>
|
||||
@@ -614,22 +598,7 @@ export const SettingsRoutes = ({
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{isPageLayoutFeatureFlagEnabled && (
|
||||
<>
|
||||
<Route
|
||||
path={SettingsPath.PageLayout}
|
||||
element={<SettingsPageLayouts />}
|
||||
/>
|
||||
<Route
|
||||
path={SettingsPath.PageLayoutNew}
|
||||
element={<SettingsPageLayoutEdit />}
|
||||
/>
|
||||
<Route
|
||||
path={SettingsPath.PageLayoutEdit}
|
||||
element={<SettingsPageLayoutEdit />}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Route
|
||||
element={
|
||||
<SettingsProtectedRouteWrapper
|
||||
|
||||
Reference in New Issue
Block a user