fix(workspace): open edit panel for PAGE_LAYOUT sidebar items (#23293)
Fixes #22649. Custom page-layout links in the sidebar (like "Star History") couldn't be removed. Clicking them in edit mode did nothing. **Root cause** `handleNavigationMenuItemClick` in `WorkspaceSection.tsx` switches on `item.type`. `FOLDER` and `LINK` have explicit cases that call `openNavigationMenuItemInSidePanel`. `PAGE_LAYOUT` fell through to `default`, which calls `openViewOrRecordEditPanelAndNavigate`. That function only opens the side panel when `objectMetadataItem` is defined - PAGE_LAYOUT items don't have one - so the panel never opened. **Fix** Add a `PAGE_LAYOUT` case that calls `openNavigationMenuItemInSidePanel` directly, using the item's own label and icon. Same pattern as `LINK`. **How to test** 1. Create a custom page link in the sidebar (Settings > Workspace > Add menu item > Page layout). 2. Click the wrench icon to enter edit mode. 3. Click the custom page item - the edit side panel should now open. 4. Verify you can remove it from the sidebar. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/23293?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by: prastoin <paul@twenty.com>
This commit is contained in:
+8
@@ -152,6 +152,14 @@ export const WorkspaceSection = () => {
|
||||
pageIcon: IconLink,
|
||||
});
|
||||
break;
|
||||
case NavigationMenuItemType.PAGE_LAYOUT:
|
||||
openNavigationMenuItemInSidePanel({
|
||||
pageTitle:
|
||||
getNavigationMenuItemLabel(item, objectMetadataItems, views) ||
|
||||
t`Edit page`,
|
||||
pageIcon: getIcon(item.icon),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
openViewOrRecordEditPanelAndNavigate(item, objectMetadataItem);
|
||||
}
|
||||
|
||||
+2
@@ -19,6 +19,8 @@ const getLabelForItem = (
|
||||
return item.name ?? 'Folder';
|
||||
case NavigationMenuItemType.LINK:
|
||||
return item.name ?? 'Link';
|
||||
case NavigationMenuItemType.PAGE_LAYOUT:
|
||||
return item.name ?? 'Page';
|
||||
case NavigationMenuItemType.OBJECT:
|
||||
case NavigationMenuItemType.VIEW:
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user