diff --git a/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx b/packages/twenty-front/src/loading/components/SidePanelSkeletonLoader.tsx similarity index 83% rename from packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx rename to packages/twenty-front/src/loading/components/SidePanelSkeletonLoader.tsx index 5344fbd833..f794f6b634 100644 --- a/packages/twenty-front/src/loading/components/RightDrawerSkeletonLoader.tsx +++ b/packages/twenty-front/src/loading/components/SidePanelSkeletonLoader.tsx @@ -4,7 +4,7 @@ import { useContext } from 'react'; import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; -const StyledRightDrawerContainer = styled.div` +const StyledSidePanelContainer = styled.div` display: flex; flex-direction: column; width: 100%; @@ -24,10 +24,10 @@ const StyledSkeletonLoader = () => { ); }; -export const RightDrawerSkeletonLoader = () => { +export const SidePanelSkeletonLoader = () => { return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/action-menu/actions/components/ActionOpenSidePanelPage.tsx b/packages/twenty-front/src/modules/action-menu/actions/components/ActionOpenSidePanelPage.tsx index ce8b2bc1f1..d75776a25c 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/components/ActionOpenSidePanelPage.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/components/ActionOpenSidePanelPage.tsx @@ -1,12 +1,12 @@ import { ActionDisplay } from '@/action-menu/actions/display/components/ActionDisplay'; import { ActionConfigContext } from '@/action-menu/contexts/ActionConfigContext'; -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type MessageDescriptor } from '@lingui/core'; import { t } from '@lingui/core/macro'; import { useContext } from 'react'; -import { type CommandMenuPages } from 'twenty-shared/types'; +import { type SidePanelPages } from 'twenty-shared/types'; import { type IconComponent } from 'twenty-ui/display'; export const ActionOpenSidePanelPage = ({ @@ -16,7 +16,7 @@ export const ActionOpenSidePanelPage = ({ onClick, shouldResetSearchState = false, }: { - page: CommandMenuPages; + page: SidePanelPages; pageTitle: MessageDescriptor; pageIcon: IconComponent; onClick?: () => void; @@ -24,9 +24,9 @@ export const ActionOpenSidePanelPage = ({ }) => { const actionConfig = useContext(ActionConfigContext); - const { navigateCommandMenu } = useNavigateCommandMenu(); + const { navigateSidePanel } = useNavigateSidePanel(); - const setCommandMenuSearch = useSetAtomState(commandMenuSearchState); + const setSidePanelSearch = useSetAtomState(sidePanelSearchState); if (!actionConfig) { return null; @@ -35,14 +35,14 @@ export const ActionOpenSidePanelPage = ({ const handleClick = () => { onClick?.(); - navigateCommandMenu({ + navigateSidePanel({ page, pageTitle: t(pageTitle), pageIcon, }); if (shouldResetSearchState) { - setCommandMenuSearch(''); + setSidePanelSearch(''); } }; diff --git a/packages/twenty-front/src/modules/action-menu/actions/display/components/__stories__/ActionComponent.stories.tsx b/packages/twenty-front/src/modules/action-menu/actions/display/components/__stories__/ActionComponent.stories.tsx index e61378446d..aa91f58e75 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/display/components/__stories__/ActionComponent.stories.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/display/components/__stories__/ActionComponent.stories.tsx @@ -30,7 +30,7 @@ const meta: Meta = { > ( ( ( !isInRightDrawer, + shouldBeRegistered: ({ isInSidePanel }) => !isInSidePanel, availableOn: [ActionViewType.SHOW_PAGE], component: , }, @@ -103,7 +103,7 @@ export const DEFAULT_RECORD_ACTIONS_CONFIG: Record< position: 1, isPinned: true, Icon: IconChevronUp, - shouldBeRegistered: ({ isInRightDrawer }) => !isInRightDrawer, + shouldBeRegistered: ({ isInSidePanel }) => !isInSidePanel, availableOn: [ActionViewType.SHOW_PAGE], component: , }, diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/MergeMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/MergeMultipleRecordsAction.tsx index 5a52993083..6840cd20b8 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/MergeMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/MergeMultipleRecordsAction.tsx @@ -1,6 +1,6 @@ import { ActionDisplay } from '@/action-menu/actions/display/components/ActionDisplay'; import { useSelectedRecordIds } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIds'; -import { useOpenMergeRecordsPageInCommandMenu } from '@/command-menu/hooks/useOpenMergeRecordsPageInCommandMenu'; +import { useOpenMergeRecordsPageInSidePanel } from '@/side-panel/hooks/useOpenMergeRecordsPageInSidePanel'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; @@ -17,14 +17,14 @@ export const MergeMultipleRecordsAction = () => { } const selectedRecordIds = useSelectedRecordIds(); - const { openMergeRecordsPageInCommandMenu } = - useOpenMergeRecordsPageInCommandMenu({ + const { openMergeRecordsPageInSidePanel } = + useOpenMergeRecordsPageInSidePanel({ objectNameSingular: objectMetadataItem.nameSingular, objectRecordIds: selectedRecordIds, }); const handleClick = () => { - openMergeRecordsPageInCommandMenu(); + openMergeRecordsPageInSidePanel(); }; return ; diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/UpdateMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/UpdateMultipleRecordsAction.tsx index daaa1d43ed..9139348f49 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/UpdateMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/UpdateMultipleRecordsAction.tsx @@ -1,5 +1,5 @@ import { ActionDisplay } from '@/action-menu/actions/display/components/ActionDisplay'; -import { useOpenUpdateMultipleRecordsPageInCommandMenu } from '@/command-menu/hooks/useOpenUpdateMultipleRecordsPageInCommandMenu'; +import { useOpenUpdateMultipleRecordsPageInSidePanel } from '@/side-panel/hooks/useOpenUpdateMultipleRecordsPageInSidePanel'; import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; @@ -8,13 +8,13 @@ export const UpdateMultipleRecordsAction = () => { ContextStoreComponentInstanceContext, ); - const { openUpdateMultipleRecordsPageInCommandMenu } = - useOpenUpdateMultipleRecordsPageInCommandMenu({ + const { openUpdateMultipleRecordsPageInSidePanel } = + useOpenUpdateMultipleRecordsPageInSidePanel({ contextStoreInstanceId, }); const handleClick = () => { - openUpdateMultipleRecordsPageInCommandMenu(); + openUpdateMultipleRecordsPageInSidePanel(); }; return ; diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/CreateRelatedRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/CreateRelatedRecordAction.tsx index 755a87eb0f..6d986036c3 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/CreateRelatedRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/CreateRelatedRecordAction.tsx @@ -1,6 +1,6 @@ import { Action } from '@/action-menu/actions/components/Action'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { type FieldMetadataItemRelation } from '@/object-metadata/types/FieldMetadataItemRelation'; @@ -31,7 +31,7 @@ export const CreateRelatedRecordAction = ({ objectNameSingular: CoreObjectNameSingular.Note, }); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const { createOneRecord: createOneTaskTarget } = useCreateOneRecord({ objectNameSingular: CoreObjectNameSingular.TaskTarget, @@ -87,7 +87,7 @@ export const CreateRelatedRecordAction = ({ break; } - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId: createdRecord.id, objectNameSingular: targetObject.nameSingular, isNewRecord: true, diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/CancelDashboardSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/CancelDashboardSingleRecordAction.tsx index 6c29dd8b41..f10ae02a6b 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/CancelDashboardSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/CancelDashboardSingleRecordAction.tsx @@ -1,6 +1,6 @@ import { Action } from '@/action-menu/actions/components/Action'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { useResetDraftPageLayoutToPersistedPageLayout } from '@/page-layout/hooks/useResetDraftPageLayoutToPersistedPageLayout'; import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode'; @@ -13,7 +13,7 @@ export const CancelDashboardSingleRecordAction = () => { const pageLayoutId = recordStore?.pageLayoutId; - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const { setIsPageLayoutInEditMode } = useSetIsPageLayoutInEditMode(pageLayoutId); @@ -22,7 +22,7 @@ export const CancelDashboardSingleRecordAction = () => { useResetDraftPageLayoutToPersistedPageLayout(pageLayoutId); const handleClick = () => { - closeCommandMenu(); + closeSidePanelMenu(); resetDraftPageLayoutToPersistedPageLayout(); setIsPageLayoutInEditMode(false); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/SaveDashboardSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/SaveDashboardSingleRecordAction.tsx index 92ead9ea54..725072e049 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/SaveDashboardSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/SaveDashboardSingleRecordAction.tsx @@ -1,6 +1,6 @@ import { Action } from '@/action-menu/actions/components/Action'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { useSavePageLayout } from '@/page-layout/hooks/useSavePageLayout'; import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode'; @@ -18,13 +18,13 @@ export const SaveDashboardSingleRecordAction = () => { const { setIsPageLayoutInEditMode } = useSetIsPageLayoutInEditMode(pageLayoutId); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const handleClick = async () => { const result = await savePageLayout(); if (result.status === 'successful') { - closeCommandMenu(); + closeSidePanelMenu(); setIsPageLayoutInEditMode(false); } }; diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/record-page-layout-actions/components/CancelRecordPageLayoutSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/record-page-layout-actions/components/CancelRecordPageLayoutSingleRecordAction.tsx index 45a8936860..808fc60d82 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/record-page-layout-actions/components/CancelRecordPageLayoutSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/record-page-layout-actions/components/CancelRecordPageLayoutSingleRecordAction.tsx @@ -1,5 +1,5 @@ import { Action } from '@/action-menu/actions/components/Action'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { useRecordPageLayoutIdFromRecordStoreOrThrow } from '@/page-layout/hooks/useRecordPageLayoutIdFromRecordStoreOrThrow'; import { useResetDraftPageLayoutToPersistedPageLayout } from '@/page-layout/hooks/useResetDraftPageLayoutToPersistedPageLayout'; @@ -12,7 +12,7 @@ export const CancelRecordPageLayoutSingleRecordAction = () => { targetObjectNameSingular: objectMetadataItem.nameSingular, }); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const { setIsPageLayoutInEditMode } = useSetIsPageLayoutInEditMode(pageLayoutId); @@ -21,7 +21,7 @@ export const CancelRecordPageLayoutSingleRecordAction = () => { useResetDraftPageLayoutToPersistedPageLayout(pageLayoutId); const handleClick = () => { - closeCommandMenu(); + closeSidePanelMenu(); resetDraftPageLayoutToPersistedPageLayout(); setIsPageLayoutInEditMode(false); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/record-page-layout-actions/components/SaveRecordPageLayoutSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/record-page-layout-actions/components/SaveRecordPageLayoutSingleRecordAction.tsx index 322e5296f9..b1cca98682 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/record-page-layout-actions/components/SaveRecordPageLayoutSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/record-page-layout-actions/components/SaveRecordPageLayoutSingleRecordAction.tsx @@ -1,5 +1,5 @@ import { Action } from '@/action-menu/actions/components/Action'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { useRecordPageLayoutIdFromRecordStoreOrThrow } from '@/page-layout/hooks/useRecordPageLayoutIdFromRecordStoreOrThrow'; import { useSaveFieldsWidgetGroups } from '@/page-layout/hooks/useSaveFieldsWidgetGroups'; @@ -21,7 +21,7 @@ export const SaveRecordPageLayoutSingleRecordAction = () => { const { setIsPageLayoutInEditMode } = useSetIsPageLayoutInEditMode(pageLayoutId); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const handleClick = async () => { const result = await savePageLayout(); @@ -29,7 +29,7 @@ export const SaveRecordPageLayoutSingleRecordAction = () => { if (result.status === 'successful') { await saveFieldsWidgetGroups(); - closeCommandMenu(); + closeSidePanelMenu(); setIsPageLayoutInEditMode(false); } }; diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/components/AddNodeWorkflowSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/components/AddNodeWorkflowSingleRecordAction.tsx index df359e37f4..f0d59fc762 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/components/AddNodeWorkflowSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-actions/components/AddNodeWorkflowSingleRecordAction.tsx @@ -1,20 +1,21 @@ import { Action } from '@/action-menu/actions/components/Action'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { isDefined } from 'twenty-shared/utils'; export const AddNodeWorkflowSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); const workflowWithCurrentVersion = useWorkflowWithCurrentVersion(recordId); - const { openWorkflowCreateStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowCreateStepInSidePanel } = + useSidePanelWorkflowNavigation(); const onClick = () => { if (!isDefined(workflowWithCurrentVersion)) { return; } - openWorkflowCreateStepInCommandMenu(workflowWithCurrentVersion.id); + openWorkflowCreateStepInSidePanel(workflowWithCurrentVersion.id); }; return ; diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/constants/RecordAgnosticActionsConfig.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/constants/RecordAgnosticActionsConfig.tsx index 3339c063c2..55740e16f7 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/constants/RecordAgnosticActionsConfig.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/constants/RecordAgnosticActionsConfig.tsx @@ -3,7 +3,7 @@ import { RecordAgnosticActionsKeys } from '@/action-menu/actions/record-agnostic import { type ActionConfig } from '@/action-menu/actions/types/ActionConfig'; import { ActionScope } from '@/action-menu/actions/types/ActionScope'; import { ActionType } from '@/action-menu/actions/types/ActionType'; -import { ActionViewType, CommandMenuPages } from 'twenty-shared/types'; +import { ActionViewType, SidePanelPages } from 'twenty-shared/types'; import { msg } from '@lingui/core/macro'; import { IconHistory, IconSearch, IconSparkles } from 'twenty-ui/display'; @@ -20,7 +20,7 @@ export const RECORD_AGNOSTIC_ACTIONS_CONFIG: Record = { availableOn: [ActionViewType.GLOBAL], component: ( = { availableOn: [ActionViewType.GLOBAL], component: ( @@ -61,7 +61,7 @@ export const RECORD_AGNOSTIC_ACTIONS_CONFIG: Record = { availableOn: [ActionViewType.GLOBAL], component: ( @@ -81,7 +81,7 @@ export const RECORD_AGNOSTIC_ACTIONS_CONFIG: Record = { availableOn: [ActionViewType.GLOBAL], component: ( diff --git a/packages/twenty-front/src/modules/action-menu/actions/types/ShouldBeRegisteredFunctionParams.ts b/packages/twenty-front/src/modules/action-menu/actions/types/ShouldBeRegisteredFunctionParams.ts index 65041c1130..bae8d83cc3 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/types/ShouldBeRegisteredFunctionParams.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/types/ShouldBeRegisteredFunctionParams.ts @@ -14,7 +14,7 @@ export type ShouldBeRegisteredFunctionParams = { recordFilters?: RecordFilter[]; isShowPage?: boolean; hasAnySoftDeleteFilterOnView?: boolean; - isInRightDrawer?: boolean; + isInSidePanel?: boolean; isFavorite?: boolean; isRemote?: boolean; isNoteOrTask?: boolean; diff --git a/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx b/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx index b4a8ddaddd..0d55389deb 100644 --- a/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx @@ -1,4 +1,4 @@ -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { Key } from 'ts-key-enum'; import { Button } from 'twenty-ui/input'; diff --git a/packages/twenty-front/src/modules/action-menu/components/CommandMenuActionMenuDropdown.tsx b/packages/twenty-front/src/modules/action-menu/components/CommandMenuActionMenuDropdown.tsx index 387bea6a61..e4c8af8909 100644 --- a/packages/twenty-front/src/modules/action-menu/components/CommandMenuActionMenuDropdown.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/CommandMenuActionMenuDropdown.tsx @@ -2,7 +2,7 @@ import { ActionComponent } from '@/action-menu/actions/display/components/Action import { ActionScope } from '@/action-menu/actions/types/ActionScope'; import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; -import { getRightDrawerActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getRightDrawerActionMenuDropdownIdFromActionMenuId'; +import { getSidePanelActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getSidePanelActionMenuDropdownIdFromActionMenuId'; import { OptionsDropdownMenu } from '@/ui/layout/dropdown/components/OptionsDropdownMenu'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; import { useContext } from 'react'; @@ -15,7 +15,7 @@ export const CommandMenuActionMenuDropdown = () => { ); const dropdownId = - getRightDrawerActionMenuDropdownIdFromActionMenuId(actionMenuId); + getSidePanelActionMenuDropdownIdFromActionMenuId(actionMenuId); const recordSelectionActions = actions.filter( (action) => action.scope === ActionScope.RecordSelection, diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx index 0b35d8c340..539fec5a11 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx @@ -19,14 +19,14 @@ export const RecordIndexActionMenu = () => { {contextStoreCurrentObjectMetadataItemId && ( <> {!isMobile && } diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx index 61e4cefd0b..d649b9182e 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx @@ -6,7 +6,7 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; import { recordIndexActionMenuDropdownPositionComponentState } from '@/action-menu/states/recordIndexActionMenuDropdownPositionComponentState'; import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getActionMenuDropdownIdFromActionMenuId'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; @@ -54,7 +54,7 @@ export const RecordIndexActionMenuDropdown = () => { dropdownId, ); - const { openCommandMenu } = useCommandMenu(); + const { openSidePanelMenu } = useSidePanelMenu(); const selectedItemIdArray = [ ...recordIndexActions.map((action) => action.key), @@ -95,14 +95,14 @@ export const RecordIndexActionMenuDropdown = () => { key="more-actions" onEnter={() => { closeDropdown(dropdownId); - openCommandMenu(); + openSidePanelMenu(); }} > { closeDropdown(dropdownId); - openCommandMenu(); + openSidePanelMenu(); }} focused={selectedItemId === 'more-actions'} text={t`More actions`} diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx index d11e0f214a..590c916369 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx @@ -27,7 +27,7 @@ export const RecordShowActionMenu = () => { <> {hasSelectedRecord && contextStoreCurrentObjectMetadataItemId && ( diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerActionMenu.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordShowSidePanelActionMenu.tsx similarity index 91% rename from packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerActionMenu.tsx rename to packages/twenty-front/src/modules/action-menu/components/RecordShowSidePanelActionMenu.tsx index 5da8207a9a..fd86271939 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerActionMenu.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowSidePanelActionMenu.tsx @@ -3,7 +3,7 @@ import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuCont import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; -export const RecordShowRightDrawerActionMenu = () => { +export const RecordShowSidePanelActionMenu = () => { const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, ); @@ -12,7 +12,7 @@ export const RecordShowRightDrawerActionMenu = () => { <> {contextStoreCurrentObjectMetadataItemId && ( diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordShowSidePanelOpenRecordButton.tsx similarity index 80% rename from packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx rename to packages/twenty-front/src/modules/action-menu/components/RecordShowSidePanelOpenRecordButton.tsx index 960cd52874..f448a8d309 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowSidePanelOpenRecordButton.tsx @@ -1,9 +1,9 @@ import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; -import { getRightDrawerActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getRightDrawerActionMenuDropdownIdFromActionMenuId'; -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { getSidePanelActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getSidePanelActionMenuDropdownIdFromActionMenuId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreRecordShowParentViewComponentState } from '@/context-store/states/contextStoreRecordShowParentViewComponentState'; import { CoreObjectNameSingular, AppPath } from 'twenty-shared/types'; @@ -28,27 +28,27 @@ import { Button } from 'twenty-ui/input'; import { getOsControlSymbol } from 'twenty-ui/utilities'; import { useNavigateApp } from '~/hooks/useNavigateApp'; -type RecordShowRightDrawerOpenRecordButtonProps = { +type RecordShowSidePanelOpenRecordButtonProps = { objectNameSingular: string; recordId: string; }; -export const RecordShowRightDrawerOpenRecordButton = ({ +export const RecordShowSidePanelOpenRecordButton = ({ objectNameSingular, recordId, -}: RecordShowRightDrawerOpenRecordButtonProps) => { +}: RecordShowSidePanelOpenRecordButtonProps) => { const record = useAtomFamilyStateValue(recordStoreFamilyState, recordId) as | ObjectRecord | null | undefined; - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); - const commandMenuPageComponentInstance = useComponentInstanceStateContext( - CommandMenuPageComponentInstanceContext, + const sidePanelPageComponentInstance = useComponentInstanceStateContext( + SidePanelPageComponentInstanceContext, ); const tabListComponentId = getShowPageTabListComponentId({ - pageId: commandMenuPageComponentInstance?.instanceId, + pageId: sidePanelPageComponentInstance?.instanceId, targetObjectId: recordId, }); @@ -101,7 +101,7 @@ export const RecordShowRightDrawerOpenRecordButton = ({ store.set(parentViewState, undefined); } - store.set(commandMenuNavigationStackState.atom, []); + store.set(sidePanelNavigationStackState.atom, []); navigate(AppPath.RecordShowPage, { objectNameSingular, @@ -109,14 +109,14 @@ export const RecordShowRightDrawerOpenRecordButton = ({ }); closeDropdown( - getRightDrawerActionMenuDropdownIdFromActionMenuId(actionMenuId), + getSidePanelActionMenuDropdownIdFromActionMenuId(actionMenuId), ); - closeCommandMenu(); + closeSidePanelMenu(); }, [ actionMenuId, activeTabId, - closeCommandMenu, + closeSidePanelMenu, closeDropdown, navigate, objectNameSingular, diff --git a/packages/twenty-front/src/modules/action-menu/components/__stories__/CommandMenuActionMenuDropdown.stories.tsx b/packages/twenty-front/src/modules/action-menu/components/__stories__/CommandMenuActionMenuDropdown.stories.tsx index 19884ae8fa..e6f75d1426 100644 --- a/packages/twenty-front/src/modules/action-menu/components/__stories__/CommandMenuActionMenuDropdown.stories.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/__stories__/CommandMenuActionMenuDropdown.stories.tsx @@ -40,7 +40,7 @@ const meta: Meta = { > = { > ({ - isInRightDrawer: false, + isInSidePanel: false, actionMenuType: 'command-menu', displayType: 'button', actions: [], diff --git a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx index 65cfdd0473..da801fed98 100644 --- a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx +++ b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx @@ -11,7 +11,7 @@ import { isDefined } from 'twenty-shared/utils'; export const ActionMenuContextProvider = ({ children, - isInRightDrawer, + isInSidePanel, displayType, actionMenuType, objectMetadataItemOverride, @@ -46,7 +46,7 @@ export const ActionMenuContextProvider = ({ if (isWorkflowObject) { return ( { - const { actionMenuType, isInRightDrawer } = useContext(ActionMenuContext); + const { actionMenuType, isInSidePanel } = useContext(ActionMenuContext); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const { closeDropdown } = useCloseDropdown(); @@ -25,8 +25,8 @@ export const useCloseActionMenu = ({ ActionMenuComponentInstanceContext, ); - const dropdownId = isInRightDrawer - ? getRightDrawerActionMenuDropdownIdFromActionMenuId(actionMenuId) + const dropdownId = isInSidePanel + ? getSidePanelActionMenuDropdownIdFromActionMenuId(actionMenuId) : getActionMenuDropdownIdFromActionMenuId(actionMenuId); const closeActionMenu = () => { @@ -37,7 +37,7 @@ export const useCloseActionMenu = ({ ) { return; } - closeCommandMenu(); + closeSidePanelMenu(); } if ( @@ -52,7 +52,7 @@ export const useCloseActionMenu = ({ isDefined(closeSidePanelOnShowPageOptionsActionExecution) && closeSidePanelOnShowPageOptionsActionExecution ) { - closeCommandMenu(); + closeSidePanelMenu(); } }; diff --git a/packages/twenty-front/src/modules/action-menu/hooks/useCommandMenuContextApi.ts b/packages/twenty-front/src/modules/action-menu/hooks/useCommandMenuContextApi.ts index d48b2454f3..5a3e431515 100644 --- a/packages/twenty-front/src/modules/action-menu/hooks/useCommandMenuContextApi.ts +++ b/packages/twenty-front/src/modules/action-menu/hooks/useCommandMenuContextApi.ts @@ -30,7 +30,7 @@ import { FeatureFlagKey } from '~/generated-metadata/graphql'; export const useCommandMenuContextApi = (): CommandMenuContextApi => { const store = useStore(); - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, @@ -140,7 +140,7 @@ export const useCommandMenuContextApi = (): CommandMenuContextApi => { return { isShowPage, - isInRightDrawer, + isInSidePanel, isFavorite, isRemote, isNoteOrTask, diff --git a/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts b/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts index 1f0396767b..2e4d5f9541 100644 --- a/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts +++ b/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts @@ -84,7 +84,7 @@ export const useShouldActionBeRegisteredParams = ({ objectMetadataItem?.nameSingular === CoreObjectNameSingular.Note || objectMetadataItem?.nameSingular === CoreObjectNameSingular.Task; - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); const { recordIndexId } = useRecordIndexIdFromCurrentContextStore(); @@ -149,7 +149,7 @@ export const useShouldActionBeRegisteredParams = ({ isFavorite, objectPermissions, isNoteOrTask, - isInRightDrawer, + isInSidePanel, hasAnySoftDeleteFilterOnView, isShowPage, isSelectAll, diff --git a/packages/twenty-front/src/modules/action-menu/utils/__tests__/getRightDrawerActionMenuDropdownIdFromActionMenuId.test.ts b/packages/twenty-front/src/modules/action-menu/utils/__tests__/getRightDrawerActionMenuDropdownIdFromActionMenuId.test.ts deleted file mode 100644 index 92ff58bc04..0000000000 --- a/packages/twenty-front/src/modules/action-menu/utils/__tests__/getRightDrawerActionMenuDropdownIdFromActionMenuId.test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { getRightDrawerActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getRightDrawerActionMenuDropdownIdFromActionMenuId'; - -describe('getRightDrawerActionMenuDropdownIdFromActionMenuId', () => { - it('should return the right drawer action menu dropdown id', () => { - expect( - getRightDrawerActionMenuDropdownIdFromActionMenuId('action-menu-id'), - ).toBe('right-drawer-action-menu-dropdown-action-menu-id'); - }); -}); diff --git a/packages/twenty-front/src/modules/action-menu/utils/__tests__/getSidePanelActionMenuDropdownIdFromActionMenuId.test.ts b/packages/twenty-front/src/modules/action-menu/utils/__tests__/getSidePanelActionMenuDropdownIdFromActionMenuId.test.ts new file mode 100644 index 0000000000..32b6fdf644 --- /dev/null +++ b/packages/twenty-front/src/modules/action-menu/utils/__tests__/getSidePanelActionMenuDropdownIdFromActionMenuId.test.ts @@ -0,0 +1,9 @@ +import { getSidePanelActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getSidePanelActionMenuDropdownIdFromActionMenuId'; + +describe('getSidePanelActionMenuDropdownIdFromActionMenuId', () => { + it('should return the side panel action menu dropdown id', () => { + expect( + getSidePanelActionMenuDropdownIdFromActionMenuId('action-menu-id'), + ).toBe('side-panel-action-menu-dropdown-action-menu-id'); + }); +}); diff --git a/packages/twenty-front/src/modules/action-menu/utils/getRightDrawerActionMenuDropdownIdFromActionMenuId.ts b/packages/twenty-front/src/modules/action-menu/utils/getRightDrawerActionMenuDropdownIdFromActionMenuId.ts deleted file mode 100644 index 8e1d49133d..0000000000 --- a/packages/twenty-front/src/modules/action-menu/utils/getRightDrawerActionMenuDropdownIdFromActionMenuId.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const getRightDrawerActionMenuDropdownIdFromActionMenuId = ( - actionMenuId: string, -) => { - return `right-drawer-action-menu-dropdown-${actionMenuId}`; -}; diff --git a/packages/twenty-front/src/modules/action-menu/utils/getSidePanelActionMenuDropdownIdFromActionMenuId.ts b/packages/twenty-front/src/modules/action-menu/utils/getSidePanelActionMenuDropdownIdFromActionMenuId.ts new file mode 100644 index 0000000000..bde04a52a3 --- /dev/null +++ b/packages/twenty-front/src/modules/action-menu/utils/getSidePanelActionMenuDropdownIdFromActionMenuId.ts @@ -0,0 +1,5 @@ +export const getSidePanelActionMenuDropdownIdFromActionMenuId = ( + actionMenuId: string, +) => { + return `side-panel-action-menu-dropdown-${actionMenuId}`; +}; diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx index b8a22e4431..96a208dc1d 100644 --- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx +++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx @@ -13,7 +13,7 @@ import { getCalendarEventEndDate } from '@/activities/calendar/utils/getCalendar import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalendarEventStartDate'; import { hasCalendarEventEnded } from '@/activities/calendar/utils/hasCalendarEventEnded'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useOpenCalendarEventInCommandMenu } from '@/command-menu/hooks/useOpenCalendarEventInCommandMenu'; +import { useOpenCalendarEventInSidePanel } from '@/side-panel/hooks/useOpenCalendarEventInSidePanel'; import { useContext } from 'react'; import { IconArrowRight } from 'twenty-ui/display'; import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; @@ -77,8 +77,7 @@ export const CalendarEventRow = ({ }: CalendarEventRowProps) => { const { theme } = useContext(ThemeContext); const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); - const { openCalendarEventInCommandMenu } = - useOpenCalendarEventInCommandMenu(); + const { openCalendarEventInSidePanel } = useOpenCalendarEventInSidePanel(); const startsAt = getCalendarEventStartDate(calendarEvent); const endsAt = getCalendarEventEndDate(calendarEvent); @@ -102,7 +101,7 @@ export const CalendarEventRow = ({ onClick={ showTitle ? () => { - openCalendarEventInCommandMenu(calendarEvent.id); + openCalendarEventInSidePanel(calendarEvent.id); } : undefined } diff --git a/packages/twenty-front/src/modules/activities/calendar/components/__stories__/Calendar.stories.tsx b/packages/twenty-front/src/modules/activities/calendar/components/__stories__/Calendar.stories.tsx index 4df444cc72..718848ecfa 100644 --- a/packages/twenty-front/src/modules/activities/calendar/components/__stories__/Calendar.stories.tsx +++ b/packages/twenty-front/src/modules/activities/calendar/components/__stories__/Calendar.stories.tsx @@ -28,7 +28,7 @@ const meta: Meta = { targetObjectNameSingular: CoreObjectNameSingular.Company, }, layoutType: PageLayoutType.RECORD_PAGE, - isInRightDrawer: false, + isInSidePanel: false, }} > diff --git a/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx b/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx index a8b5708b94..e4b442d13f 100644 --- a/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx +++ b/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx @@ -20,7 +20,7 @@ import { ActivityRichTextEditorChangeOnActivityIdEffect } from '@/activities/com import { type Attachment } from '@/activities/files/types/Attachment'; import { type Note } from '@/activities/types/Note'; import { type Task } from '@/activities/types/Task'; -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; import { useLabelIdentifierFieldMetadataItem } from '@/object-metadata/hooks/useLabelIdentifierFieldMetadataItem'; import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; @@ -299,7 +299,7 @@ export const ActivityRichTextEditor = ({ // The problem with this library is that it takes the focus before anything else and does not prevent the event from bubbling // Because of this, other events listen at the same time, and when we're in luck, the click outside gets triggered, // but this leaves the door open for unpredicted behavior with click handlers conflicts, - // we recently had a bug which was deleting what the user typed and closed the right drawer if he used backspace key. + // we recently had a bug which was deleting what the user typed and closed the side panel if he used backspace key. // We could maybe use the types of components in the focus stack. const handleBlockEditorFocus = useCallback(() => { const isRecordTitleCellOpen = store.get( diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx index bffb0c937d..6d447a5be1 100644 --- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx +++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx @@ -2,9 +2,8 @@ import { styled } from '@linaria/react'; import { ActivityRow } from '@/activities/components/ActivityRow'; import { EmailThreadNotShared } from '@/activities/emails/components/EmailThreadNotShared'; -import { useOpenEmailThreadInCommandMenu } from '@/command-menu/hooks/useOpenEmailThreadInCommandMenu'; +import { useOpenEmailThreadInSidePanel } from '@/side-panel/hooks/useOpenEmailThreadInSidePanel'; import { useContext } from 'react'; - import { Avatar } from 'twenty-ui/display'; import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; import { @@ -75,8 +74,8 @@ type EmailThreadPreviewProps = { }; export const EmailThreadPreview = ({ thread }: EmailThreadPreviewProps) => { + const { openEmailThreadInSidePanel } = useOpenEmailThreadInSidePanel(); const { theme } = useContext(ThemeContext); - const { openEmailThreadInCommandMenu } = useOpenEmailThreadInCommandMenu(); const visibility = thread.visibility; @@ -103,7 +102,7 @@ export const EmailThreadPreview = ({ thread }: EmailThreadPreviewProps) => { thread.visibility === MessageChannelVisibility.SHARE_EVERYTHING; if (canOpen) { - openEmailThreadInCommandMenu(thread.id); + openEmailThreadInSidePanel(thread.id); } }; diff --git a/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenCreateActivityDrawer.test.tsx b/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenCreateActivityDrawer.test.tsx index 3ba0bac5c0..cc72092728 100644 --- a/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenCreateActivityDrawer.test.tsx +++ b/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenCreateActivityDrawer.test.tsx @@ -4,8 +4,8 @@ import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateAct import { activityTargetableEntityArrayState } from '@/activities/states/activityTargetableEntityArrayState'; import { isUpsertingActivityInDBState } from '@/activities/states/isCreatingActivityInDBState'; import { CoreObjectNameSingular } from 'twenty-shared/types'; -import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; -import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState'; +import { viewableRecordIdState } from '@/object-record/record-side-panel/states/viewableRecordIdState'; +import { viewableRecordNameSingularState } from '@/object-record/record-side-panel/states/viewableRecordNameSingularState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; @@ -23,11 +23,11 @@ jest.mock('@/object-record/hooks/useCreateOneRecord', () => ({ : { createOneRecord: mockCreateOneNote }, })); -const mockOpenRecordInCommandMenu = jest.fn(); +const mockOpenRecordInSidePanel = jest.fn(); -jest.mock('@/command-menu/hooks/useOpenRecordInCommandMenu', () => ({ - useOpenRecordInCommandMenu: () => ({ - openRecordInCommandMenu: mockOpenRecordInCommandMenu, +jest.mock('@/side-panel/hooks/useOpenRecordInSidePanel', () => ({ + useOpenRecordInSidePanel: () => ({ + openRecordInSidePanel: mockOpenRecordInSidePanel, }), })); @@ -46,7 +46,7 @@ describe('useOpenCreateActivityDrawer', () => { }); }); - it('should create a note and note target then open the record in the command menu', async () => { + it('should create a note and note target then open the record in the side panel', async () => { const { result } = renderHook( () => useOpenCreateActivityDrawer({ @@ -69,7 +69,7 @@ describe('useOpenCreateActivityDrawer', () => { noteId: fakeNoteId, }); - expect(mockOpenRecordInCommandMenu).toHaveBeenCalledWith({ + expect(mockOpenRecordInSidePanel).toHaveBeenCalledWith({ recordId: fakeNoteId, objectNameSingular: CoreObjectNameSingular.Note, isNewRecord: true, diff --git a/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts b/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts index 7af9ba5e62..483a8d1131 100644 --- a/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts +++ b/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts @@ -1,7 +1,7 @@ import { activityTargetableEntityArrayState } from '@/activities/states/activityTargetableEntityArrayState'; import { CoreObjectNameSingular } from 'twenty-shared/types'; -import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; -import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState'; +import { viewableRecordIdState } from '@/object-record/record-side-panel/states/viewableRecordIdState'; +import { viewableRecordNameSingularState } from '@/object-record/record-side-panel/states/viewableRecordNameSingularState'; import { type WorkspaceMember } from '@/workspace-member/types/WorkspaceMember'; import { isUpsertingActivityInDBState } from '@/activities/states/isCreatingActivityInDBState'; @@ -11,7 +11,7 @@ import { type Note } from '@/activities/types/Note'; import { type NoteTarget } from '@/activities/types/NoteTarget'; import { type Task } from '@/activities/types/Task'; import { type TaskTarget } from '@/activities/types/TaskTarget'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord'; import { findTargetFieldInfo } from '@/object-record/record-field/ui/utils/junction/findTargetFieldInfo'; @@ -51,7 +51,7 @@ export const useOpenCreateActivityDrawer = ({ isUpsertingActivityInDBState, ); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const { objectMetadataItems } = useObjectMetadataItems(); @@ -125,7 +125,7 @@ export const useOpenCreateActivityDrawer = ({ setActivityTargetableEntityArray([]); } - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId: activity.id, objectNameSingular: activityObjectNameSingular, isNewRecord: true, diff --git a/packages/twenty-front/src/modules/activities/inline-cell/hooks/useActivityTargetsComponentInstanceId.ts b/packages/twenty-front/src/modules/activities/inline-cell/hooks/useActivityTargetsComponentInstanceId.ts index 81ec3e1499..cbfee7ee7e 100644 --- a/packages/twenty-front/src/modules/activities/inline-cell/hooks/useActivityTargetsComponentInstanceId.ts +++ b/packages/twenty-front/src/modules/activities/inline-cell/hooks/useActivityTargetsComponentInstanceId.ts @@ -1,11 +1,11 @@ -import { useIsInRightDrawerOrThrow } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { useIsInSidePanelOrThrow } from '@/ui/layout/side-panel/contexts/SidePanelContext'; export const useActivityTargetsComponentInstanceId = ( baseComponentInstanceId: string, ) => { - const { isInRightDrawer } = useIsInRightDrawerOrThrow(); + const { isInSidePanel } = useIsInSidePanelOrThrow(); - return isInRightDrawer - ? `${baseComponentInstanceId}-right-drawer` + return isInSidePanel + ? `${baseComponentInstanceId}-side-panel` : baseComponentInstanceId; }; diff --git a/packages/twenty-front/src/modules/activities/notes/components/NoteTile.tsx b/packages/twenty-front/src/modules/activities/notes/components/NoteTile.tsx index 363aea6309..b64bf407a8 100644 --- a/packages/twenty-front/src/modules/activities/notes/components/NoteTile.tsx +++ b/packages/twenty-front/src/modules/activities/notes/components/NoteTile.tsx @@ -5,7 +5,7 @@ import { ActivityTargetsInlineCell } from '@/activities/inline-cell/components/A import { useActivityTargetsComponentInstanceId } from '@/activities/inline-cell/hooks/useActivityTargetsComponentInstanceId'; import { type Note } from '@/activities/types/Note'; import { getActivityPreview } from '@/activities/utils/getActivityPreview'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { RecordFieldsScopeContextProvider } from '@/object-record/record-field-list/contexts/RecordFieldsScopeContext'; import { FieldContextProvider } from '@/object-record/record-field/ui/components/FieldContextProvider'; @@ -72,7 +72,7 @@ export const NoteTile = ({ note: Note; isSingleNote: boolean; }) => { - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const body = getActivityPreview(note?.bodyV2?.blocknote ?? null); @@ -85,7 +85,7 @@ export const NoteTile = ({ - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId: note.id, objectNameSingular: CoreObjectNameSingular.Note, }) diff --git a/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx b/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx index df23d4d220..9b483fd6ea 100644 --- a/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx +++ b/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx @@ -8,7 +8,7 @@ import { beautifyExactDate, hasDatePassed } from '~/utils/date-utils'; import { ActivityRow } from '@/activities/components/ActivityRow'; import { useActivityTargetsComponentInstanceId } from '@/activities/inline-cell/hooks/useActivityTargetsComponentInstanceId'; import { type Task } from '@/activities/types/Task'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { StopPropagationContainer } from '@/object-record/record-board/record-board-card/components/StopPropagationContainer'; import { RecordFieldsScopeContextProvider } from '@/object-record/record-field-list/contexts/RecordFieldsScopeContext'; @@ -86,7 +86,7 @@ const StyledCheckboxContainer = styled.div` export const TaskRow = ({ task }: { task: Task }) => { const { theme } = useContext(ThemeContext); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const body = getActivitySummary(task?.bodyV2?.blocknote ?? null); @@ -100,7 +100,7 @@ export const TaskRow = ({ task }: { task: Task }) => { return ( { - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId: task.id, objectNameSingular: CoreObjectNameSingular.Task, }); diff --git a/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskGroups.stories.tsx b/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskGroups.stories.tsx index 1100737082..f21d7a15ce 100644 --- a/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskGroups.stories.tsx +++ b/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskGroups.stories.tsx @@ -6,7 +6,7 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/ob import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext'; import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator'; import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator'; -import { RightDrawerDecorator } from '~/testing/decorators/RightDrawerDecorator'; +import { SidePanelDecorator } from '~/testing/decorators/SidePanelDecorator'; import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator'; import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode'; import { graphqlMocks } from '~/testing/graphqlMocks'; @@ -29,7 +29,7 @@ const meta: Meta = { ), ComponentWithRouterDecorator, ObjectMetadataItemsDecorator, - RightDrawerDecorator, + SidePanelDecorator, SnackBarDecorator, ], }; diff --git a/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskList.stories.tsx b/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskList.stories.tsx index 8e62d7a41a..bd819dfe73 100644 --- a/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskList.stories.tsx +++ b/packages/twenty-front/src/modules/activities/tasks/components/__stories__/TaskList.stories.tsx @@ -7,7 +7,7 @@ import { ComponentDecorator } from 'twenty-ui/testing'; import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator'; import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator'; import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator'; -import { RightDrawerDecorator } from '~/testing/decorators/RightDrawerDecorator'; +import { SidePanelDecorator } from '~/testing/decorators/SidePanelDecorator'; import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator'; import { graphqlMocks } from '~/testing/graphqlMocks'; import { mockedTaskRecords } from '~/testing/mock-data/generated/data/tasks/mock-tasks-data'; @@ -25,7 +25,7 @@ const meta: Meta = { MemoryRouterDecorator, ObjectMetadataItemsDecorator, SnackBarDecorator, - RightDrawerDecorator, + SidePanelDecorator, ], args: { title: 'Tasks', diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/components/TimelineCard.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/components/TimelineCard.tsx index 20a05c9adc..eef9404347 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/components/TimelineCard.tsx +++ b/packages/twenty-front/src/modules/activities/timeline-activities/components/TimelineCard.tsx @@ -38,7 +38,7 @@ const StyledMainContainer = styled.div` } `; -const StyledRightDrawerAnimatedPlaceholderEmptyContainer = styled( +const StyledSidePanelAnimatedPlaceholderEmptyContainer = styled( AnimatedPlaceholderEmptyContainer, )` height: auto; @@ -47,7 +47,7 @@ const StyledRightDrawerAnimatedPlaceholderEmptyContainer = styled( export const TimelineCard = () => { const targetRecord = useTargetRecord(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const { timelineActivities, loading, fetchMoreRecords } = useTimelineActivities(targetRecord); @@ -59,8 +59,8 @@ export const TimelineCard = () => { } if (isTimelineActivitiesEmpty) { - const EmptyContainer = isInRightDrawer - ? StyledRightDrawerAnimatedPlaceholderEmptyContainer + const EmptyContainer = isInSidePanel + ? StyledSidePanelAnimatedPlaceholderEmptyContainer : AnimatedPlaceholderEmptyContainer; return ( diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/components/__stories__/TimelineActivities.stories.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/components/__stories__/TimelineActivities.stories.tsx index 816ca27e14..b0ee7a1198 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/components/__stories__/TimelineActivities.stories.tsx +++ b/packages/twenty-front/src/modules/activities/timeline-activities/components/__stories__/TimelineActivities.stories.tsx @@ -27,7 +27,7 @@ const meta: Meta = { targetObjectNameSingular: CoreObjectNameSingular.Company, }, layoutType: PageLayoutType.RECORD_PAGE, - isInRightDrawer: false, + isInSidePanel: false, }} > diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/activity/components/EventRowActivity.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/activity/components/EventRowActivity.tsx index d065fe5ce9..6c31332514 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/activity/components/EventRowActivity.tsx +++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/activity/components/EventRowActivity.tsx @@ -7,7 +7,7 @@ import { StyledEventRowItemColumn, } from '@/activities/timeline-activities/rows/components/EventRowDynamicComponent'; import { isTimelineActivityWithLinkedRecord } from '@/activities/timeline-activities/types/TimelineActivity'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { type CoreObjectNameSingular } from 'twenty-shared/types'; import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordFromCache'; import { isNonEmptyString } from '@sniptt/guards'; @@ -96,7 +96,7 @@ export const EventRowActivity = ({ }; const activityTitle = computeActivityTitle(); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); return ( @@ -108,7 +108,7 @@ export const EventRowActivity = ({ - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId: event.linkedRecordId, objectNameSingular, }) diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/calendar/components/EventCardCalendarEvent.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/calendar/components/EventCardCalendarEvent.tsx index b2350cbd1b..f28a34c5ac 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/calendar/components/EventCardCalendarEvent.tsx +++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/calendar/components/EventCardCalendarEvent.tsx @@ -5,7 +5,7 @@ import { isUndefined } from '@sniptt/guards'; import { CalendarEventNotSharedContent } from '@/activities/calendar/components/CalendarEventNotSharedContent'; import { CalendarEventParticipantsAvatarGroup } from '@/activities/calendar/components/CalendarEventParticipantsAvatarGroup'; import { type CalendarEvent } from '@/activities/calendar/types/CalendarEvent'; -import { useOpenCalendarEventInCommandMenu } from '@/command-menu/hooks/useOpenCalendarEventInCommandMenu'; +import { useOpenCalendarEventInSidePanel } from '@/side-panel/hooks/useOpenCalendarEventInSidePanel'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; @@ -97,8 +97,7 @@ export const EventCardCalendarEvent = ({ calendarEventId: string; }) => { const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const { openCalendarEventInCommandMenu } = - useOpenCalendarEventInCommandMenu(); + const { openCalendarEventInSidePanel } = useOpenCalendarEventInSidePanel(); const { record: calendarEvent, @@ -171,7 +170,7 @@ export const EventCardCalendarEvent = ({ const handleClick = () => { if (canOpen) { - openCalendarEventInCommandMenu(calendarEventId); + openCalendarEventInSidePanel(calendarEventId); } }; diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/message/components/EventCardMessage.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/message/components/EventCardMessage.tsx index e713a3a253..9ffe8b4c0f 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/message/components/EventCardMessage.tsx +++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/message/components/EventCardMessage.tsx @@ -3,7 +3,7 @@ import { styled } from '@linaria/react'; import { type EmailThreadMessage } from '@/activities/emails/types/EmailThreadMessage'; import { EventCardMessageBodyNotShared } from '@/activities/timeline-activities/rows/message/components/EventCardMessageBodyNotShared'; import { EventCardMessageForbidden } from '@/activities/timeline-activities/rows/message/components/EventCardMessageForbidden'; -import { useOpenEmailThreadInCommandMenu } from '@/command-menu/hooks/useOpenEmailThreadInCommandMenu'; +import { useOpenEmailThreadInSidePanel } from '@/side-panel/hooks/useOpenEmailThreadInSidePanel'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; @@ -62,7 +62,7 @@ export const EventCardMessage = ({ }) => { const { t } = useLingui(); const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const { openEmailThreadInCommandMenu } = useOpenEmailThreadInCommandMenu(); + const { openEmailThreadInSidePanel } = useOpenEmailThreadInSidePanel(); const { record: message, @@ -132,7 +132,7 @@ export const EventCardMessage = ({ const handleClick = () => { if (canOpen && isDefined(message.messageThreadId)) { - openEmailThreadInCommandMenu(message.messageThreadId); + openEmailThreadInSidePanel(message.messageThreadId); } }; diff --git a/packages/twenty-front/src/modules/ai/hooks/useAIChatThreadClick.ts b/packages/twenty-front/src/modules/ai/hooks/useAIChatThreadClick.ts index 2bf1814923..5a5a99a89b 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAIChatThreadClick.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAIChatThreadClick.ts @@ -1,7 +1,7 @@ import { agentChatUsageState } from '@/ai/states/agentChatUsageState'; import { currentAIChatThreadState } from '@/ai/states/currentAIChatThreadState'; import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState'; -import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu'; +import { useOpenAskAIPageInSidePanel } from '@/side-panel/hooks/useOpenAskAIPageInSidePanel'; import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isDefined } from 'twenty-shared/utils'; @@ -20,7 +20,7 @@ export const useAIChatThreadClick = ( currentAIChatThreadTitleState, ); const setAgentChatUsage = useSetAtomState(agentChatUsageState); - const { openAskAIPage } = useOpenAskAIPageInCommandMenu(); + const { openAskAIPage } = useOpenAskAIPageInSidePanel(); const handleThreadClick = (thread: AgentChatThread) => { setCurrentAIChatThread(thread.id); diff --git a/packages/twenty-front/src/modules/ai/hooks/useCreateNewAIChatThread.ts b/packages/twenty-front/src/modules/ai/hooks/useCreateNewAIChatThread.ts index 2e50557d83..81feeb37c6 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useCreateNewAIChatThread.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useCreateNewAIChatThread.ts @@ -4,7 +4,7 @@ import { CHAT_THREADS_PAGE_SIZE } from '@/ai/constants/ChatThreads'; import { agentChatUsageState } from '@/ai/states/agentChatUsageState'; import { currentAIChatThreadState } from '@/ai/states/currentAIChatThreadState'; import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState'; -import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu'; +import { useOpenAskAIPageInSidePanel } from '@/side-panel/hooks/useOpenAskAIPageInSidePanel'; import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isDefined } from 'twenty-shared/utils'; @@ -23,7 +23,7 @@ export const useCreateNewAIChatThread = () => { currentAIChatThreadTitleState, ); - const { openAskAIPage } = useOpenAskAIPageInCommandMenu(); + const { openAskAIPage } = useOpenAskAIPageInSidePanel(); const [createChatThread] = useCreateChatThreadMutation({ onCompleted: (data) => { setCurrentAIChatThread(data.createChatThread.id); diff --git a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx index 62cfc70882..6faab06532 100644 --- a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx +++ b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx @@ -10,9 +10,9 @@ import { useReturnToPath } from '@/auth/hooks/useReturnToPath'; import { useRequestFreshCaptchaToken } from '@/captcha/hooks/useRequestFreshCaptchaToken'; import { isCaptchaScriptLoadedState } from '@/captcha/states/isCaptchaScriptLoadedState'; import { isCaptchaRequiredForPath } from '@/captcha/utils/isCaptchaRequiredForPath'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState'; @@ -40,7 +40,7 @@ import { useNavigate, useParams, } from 'react-router-dom'; -import { AppBasePath, AppPath, CommandMenuPages } from 'twenty-shared/types'; +import { AppBasePath, AppPath, SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { AnalyticsType } from '~/generated-metadata/graphql'; import { usePageChangeEffectNavigateLocation } from '~/hooks/usePageChangeEffectNavigateLocation'; @@ -107,7 +107,7 @@ export const PageChangeEffect = () => { isAppEffectRedirectEnabledState, ); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const { saveReturnToPath, getReturnToPath, clearReturnToPath } = useReturnToPath(); @@ -116,21 +116,21 @@ export const PageChangeEffect = () => { isMatchingLocation(location, appPath), ); - const closeCommandMenuUnlessNotRelevant = useCallback(() => { - const currentPage = store.get(commandMenuPageState.atom); + const closeSidePanelUnlessNotRelevant = useCallback(() => { + const currentPage = store.get(sidePanelPageState.atom); - if (currentPage === CommandMenuPages.NavigationMenuItemEdit) { + if (currentPage === SidePanelPages.NavigationMenuItemEdit) { return; } - const commandMenuIsAiChat = currentPage === CommandMenuPages.AskAI; + const sidePanelIsAiChat = currentPage === SidePanelPages.AskAI; - if (commandMenuIsAiChat) { + if (sidePanelIsAiChat) { return; } - closeCommandMenu(); - }, [closeCommandMenu, store]); + closeSidePanelMenu(); + }, [closeSidePanelMenu, store]); const { resetFocusStackToFocusItem } = useResetFocusStackToFocusItem(); @@ -139,8 +139,8 @@ export const PageChangeEffect = () => { const { openNewRecordTitleCell } = useOpenNewRecordTitleCell(); useEffect(() => { - closeCommandMenuUnlessNotRelevant(); - }, [location.pathname, closeCommandMenuUnlessNotRelevant]); + closeSidePanelUnlessNotRelevant(); + }, [location.pathname, closeSidePanelUnlessNotRelevant]); useEffect(() => { if (!previousLocation || previousLocation !== location.pathname) { @@ -228,9 +228,9 @@ export const PageChangeEffect = () => { }); } - const isCommandMenuOpen = store.get(isCommandMenuOpenedState.atom); + const isSidePanelOpen = store.get(isSidePanelOpenedState.atom); - if (isCommandMenuOpen) { + if (isSidePanelOpen) { return; } diff --git a/packages/twenty-front/src/modules/command-menu-item/hooks/useCommandMenuItemFrontComponentActions.tsx b/packages/twenty-front/src/modules/command-menu-item/hooks/useCommandMenuItemFrontComponentActions.tsx index 3aa3c12f74..4a7a789cdd 100644 --- a/packages/twenty-front/src/modules/command-menu-item/hooks/useCommandMenuItemFrontComponentActions.tsx +++ b/packages/twenty-front/src/modules/command-menu-item/hooks/useCommandMenuItemFrontComponentActions.tsx @@ -3,7 +3,7 @@ import { HeadlessFrontComponentAction } from '@/action-menu/actions/display/comp import { ActionScope } from '@/action-menu/actions/types/ActionScope'; import { ActionType } from '@/action-menu/actions/types/ActionType'; import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { useOpenFrontComponentInCommandMenu } from '@/command-menu/hooks/useOpenFrontComponentInCommandMenu'; +import { useOpenFrontComponentInSidePanel } from '@/side-panel/hooks/useOpenFrontComponentInSidePanel'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; @@ -40,7 +40,7 @@ type BuildActionFromItemParams = { index: number; isPinned: boolean; getIcon: ReturnType['getIcon']; - openFrontComponentInCommandMenu: (params: { + openFrontComponentInSidePanel: (params: { frontComponentId: string; pageTitle: string; pageIcon: IconComponent; @@ -65,7 +65,7 @@ const buildActionFromItem = ({ index, isPinned, getIcon, - openFrontComponentInCommandMenu, + openFrontComponentInSidePanel, mountHeadlessFrontComponent, mountContext, commandMenuContextApi, @@ -80,7 +80,7 @@ const buildActionFromItem = ({ if (isHeadless) { mountHeadlessFrontComponent(item.frontComponentId, mountContext); } else { - openFrontComponentInCommandMenu({ + openFrontComponentInSidePanel({ frontComponentId: item.frontComponentId, pageTitle: displayLabel, pageIcon: Icon, @@ -123,8 +123,7 @@ export const useCommandMenuItemFrontComponentActions = ( commandMenuContextApi: CommandMenuContextApi, ) => { const { getIcon } = useIcons(); - const { openFrontComponentInCommandMenu } = - useOpenFrontComponentInCommandMenu(); + const { openFrontComponentInSidePanel } = useOpenFrontComponentInSidePanel(); const mountHeadlessFrontComponent = useMountHeadlessFrontComponent(); const contextStoreIsPageInEditMode = useAtomComponentStateValue( @@ -208,7 +207,7 @@ export const useCommandMenuItemFrontComponentActions = ( index, isPinned: !contextStoreIsPageInEditMode && item.isPinned, getIcon, - openFrontComponentInCommandMenu, + openFrontComponentInSidePanel, mountHeadlessFrontComponent, commandMenuContextApi, }), @@ -221,7 +220,7 @@ export const useCommandMenuItemFrontComponentActions = ( index, isPinned: !contextStoreIsPageInEditMode && item.isPinned, getIcon, - openFrontComponentInCommandMenu, + openFrontComponentInSidePanel, mountHeadlessFrontComponent, commandMenuContextApi, mountContext, diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuDashboardPageLayoutInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuDashboardPageLayoutInfo.tsx deleted file mode 100644 index 195cf53a52..0000000000 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuDashboardPageLayoutInfo.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { CommandMenuPageLayoutInfoContent } from '@/command-menu/components/CommandMenuPageLayoutInfoContent'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { isDefined } from 'twenty-shared/utils'; - -export const CommandMenuDashboardPageLayoutInfo = () => { - const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); - - if (!isDefined(pageLayoutId)) { - return null; - } - - return ; -}; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuForMobile.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuForMobile.tsx index 37ae3eaba7..5ce54492f9 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuForMobile.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuForMobile.tsx @@ -1,6 +1,6 @@ import { CommandMenuOpenContainer } from '@/command-menu/components/CommandMenuOpenContainer'; -import { CommandMenuRouter } from '@/command-menu/components/CommandMenuRouter'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { SidePanelRouter } from '@/side-panel/components/SidePanelRouter'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { styled } from '@linaria/react'; @@ -13,16 +13,16 @@ const StyledCommandMenuMobileFullScreenContainer = styled.div` `; export const CommandMenuForMobile = () => { - const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState); + const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState); return ( - {isCommandMenuOpened && ( + {isSidePanelOpened && ( <> {createPortal( - + , document.body, diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemDropdown.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemDropdown.tsx index 264db9a6d5..07df281606 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemDropdown.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemDropdown.tsx @@ -2,7 +2,7 @@ import { CommandMenuItem, type CommandMenuItemProps, } from '@/command-menu/components/CommandMenuItem'; -import { COMMAND_MENU_LIST_SELECTABLE_LIST_ID } from '@/command-menu/constants/CommandMenuListSelectableListId'; +import { SIDE_PANEL_SELECTABLE_LIST_ID } from '@/side-panel/constants/SidePanelSelectableListId'; import { Dropdown, type DropdownProps, @@ -37,7 +37,7 @@ export const CommandMenuItemDropdown = ({ ); const { setSelectedItemId } = useSelectableList( - COMMAND_MENU_LIST_SELECTABLE_LIST_ID, + SIDE_PANEL_SELECTABLE_LIST_ID, ); return ( diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx index 27db5ba554..dac0ba9b98 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx @@ -1,29 +1,29 @@ -import { COMMAND_MENU_ANIMATION_VARIANTS } from '@/command-menu/constants/CommandMenuAnimationVariants'; import { COMMAND_MENU_CLICK_OUTSIDE_ID } from '@/command-menu/constants/CommandMenuClickOutsideId'; -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { isSidePanelAnimatingState } from '@/command-menu/states/isSidePanelAnimatingState'; -import { type CommandMenuAnimationVariant } from '@/command-menu/types/CommandMenuAnimationVariant'; import { RECORD_CHIP_CLICK_OUTSIDE_ID } from '@/object-record/record-table/constants/RecordChipClickOutsideId'; +import { SIDE_PANEL_ANIMATION_VARIANTS } from '@/side-panel/constants/SidePanelAnimationVariants'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { isSidePanelAnimatingState } from '@/side-panel/states/isSidePanelAnimatingState'; +import { type SidePanelAnimationVariant } from '@/side-panel/types/SidePanelAnimationVariant'; import { MENTION_MENU_DROPDOWN_CLICK_OUTSIDE_ID } from '@/ui/input/constants/MentionMenuDropdownClickOutsideId'; import { SLASH_MENU_DROPDOWN_CLICK_OUTSIDE_ID } from '@/ui/input/constants/SlashMenuDropdownClickOutsideId'; import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices'; +import { PAGE_HEADER_SIDE_PANEL_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/page-header/constants/PageHeaderSidePanelButtonClickOutsideId'; import { NAVIGATION_DRAWER_CLICK_OUTSIDE_ID } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerClickOutsideId'; -import { PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/page-header/constants/PageHeaderCommandMenuButtonClickOutsideId'; import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useStore } from 'jotai'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { WORKFLOW_DIAGRAM_CREATE_STEP_NODE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramCreateStepNodeClickOutsideId'; import { WORKFLOW_DIAGRAM_STEP_NODE_BASE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramStepNodeClickOutsideId'; import { WORKFLOW_DIAGRAM_EDGE_OPTIONS_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/workflow-edges/constants/WorkflowDiagramEdgeOptionsClickOutsideId'; +import { useStore } from 'jotai'; import { styled } from '@linaria/react'; import { motion } from 'framer-motion'; import { useCallback, useContext, useRef } from 'react'; import { LINK_CHIP_CLICK_OUTSIDE_ID } from 'twenty-ui/components'; -import { useIsMobile } from 'twenty-ui/utilities'; import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; +import { useIsMobile } from 'twenty-ui/utilities'; const StyledCommandMenuBase = styled.div` background: ${themeCssVariables.background.primary}; border-left: 1px solid ${themeCssVariables.border.color.medium}; @@ -35,7 +35,7 @@ const StyledCommandMenuBase = styled.div` position: fixed; right: 0%; top: 0%; - z-index: ${RootStackingContextZIndices.CommandMenu}; + z-index: ${RootStackingContextZIndices.SidePanel}; display: flex; flex-direction: column; `; @@ -47,10 +47,10 @@ export const CommandMenuOpenContainer = ({ const { theme } = useContext(ThemeContext); const isMobile = useIsMobile(); - const targetVariantForAnimation: CommandMenuAnimationVariant = isMobile + const targetVariantForAnimation: SidePanelAnimationVariant = isMobile ? 'fullScreen' : 'normal'; - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const commandMenuRef = useRef(null); const setIsSidePanelAnimating = useSetAtomState(isSidePanelAnimatingState); @@ -64,10 +64,10 @@ export const CommandMenuOpenContainer = ({ if (currentFocusId === SIDE_PANEL_FOCUS_ID) { event.stopImmediatePropagation(); event.preventDefault(); - closeCommandMenu(); + closeSidePanelMenu(); } }, - [closeCommandMenu, store], + [closeSidePanelMenu, store], ); useListenClickOutside({ @@ -76,7 +76,7 @@ export const CommandMenuOpenContainer = ({ listenerId: 'COMMAND_MENU_LISTENER_ID', excludedClickOutsideIds: [ NAVIGATION_DRAWER_CLICK_OUTSIDE_ID, - PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID, + PAGE_HEADER_SIDE_PANEL_BUTTON_CLICK_OUTSIDE_ID, LINK_CHIP_CLICK_OUTSIDE_ID, RECORD_CHIP_CLICK_OUTSIDE_ID, SLASH_MENU_DROPDOWN_CLICK_OUTSIDE_ID, @@ -95,7 +95,7 @@ export const CommandMenuOpenContainer = ({ animate={targetVariantForAnimation} initial="closed" exit="closed" - variants={COMMAND_MENU_ANIMATION_VARIANTS} + variants={SIDE_PANEL_ANIMATION_VARIANTS} transition={{ duration: theme.animation.duration.normal, }} diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordPageLayoutInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordPageLayoutInfo.tsx deleted file mode 100644 index 6604f8f222..0000000000 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordPageLayoutInfo.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { CommandMenuPageLayoutInfoContent } from '@/command-menu/components/CommandMenuPageLayoutInfoContent'; -import { usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord'; - -export const CommandMenuRecordPageLayoutInfo = () => { - const { pageLayoutId } = - usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord(); - - return ; -}; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx deleted file mode 100644 index 3d8ecea57f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuContextProvider'; -import { CommandMenuContainer } from '@/command-menu/components/CommandMenuContainer'; -import { CommandMenuTopBar } from '@/command-menu/components/CommandMenuTopBar'; -import { COMMAND_MENU_PAGES_CONFIG } from '@/command-menu/constants/CommandMenuPagesConfig'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; -import { styled } from '@linaria/react'; -import { motion } from 'framer-motion'; -import { useContext } from 'react'; -import { isDefined } from 'twenty-shared/utils'; -import { ThemeContext } from 'twenty-ui/theme-constants'; - -const StyledCommandMenuContent = styled.div` - flex: 1; - overflow-y: auto; -`; - -export const CommandMenuRouter = () => { - const { theme } = useContext(ThemeContext); - const commandMenuPage = useAtomStateValue(commandMenuPageState); - const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState); - - const commandMenuPageComponent = isDefined(commandMenuPage) ? ( - COMMAND_MENU_PAGES_CONFIG.get(commandMenuPage) - ) : ( - <> - ); - return ( - - - - - - - - {commandMenuPageComponent} - - - - - ); -}; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarInputFocusEffect.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarInputFocusEffect.tsx deleted file mode 100644 index 2a4189000b..0000000000 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarInputFocusEffect.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; -import { useEffect } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; - -type CommandMenuTopBarInputFocusEffectProps = { - inputRef: React.RefObject; -}; - -export const CommandMenuTopBarInputFocusEffect = ({ - inputRef, -}: CommandMenuTopBarInputFocusEffectProps) => { - const commandMenuPage = useAtomStateValue(commandMenuPageState); - - useEffect(() => { - if ( - commandMenuPage === CommandMenuPages.Root || - commandMenuPage === CommandMenuPages.SearchRecords - ) { - inputRef.current?.focus(); - } - }, [commandMenuPage, inputRef]); - - return null; -}; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWidthEffect.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuWidthEffect.tsx deleted file mode 100644 index 49f052d389..0000000000 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWidthEffect.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { useEffect } from 'react'; - -import { - COMMAND_MENU_WIDTH_VAR, - commandMenuWidthState, -} from '@/command-menu/states/commandMenuWidthState'; -import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; - -export const CommandMenuWidthEffect = () => { - const commandMenuWidth = useAtomStateValue(commandMenuWidthState); - - useEffect(() => { - document.documentElement.style.setProperty( - COMMAND_MENU_WIDTH_VAR, - `${commandMenuWidth}px`, - ); - }, [commandMenuWidth]); - - return null; -}; diff --git a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx index 14dda7a5b2..341172035a 100644 --- a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx @@ -22,12 +22,12 @@ import { sleep } from '~/utils/sleep'; import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState'; -import { type CommandMenu } from '@/command-menu/components/CommandMenu'; -import { CommandMenuRouter } from '@/command-menu/components/CommandMenuRouter'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { SidePanelRouter } from '@/side-panel/components/SidePanelRouter'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; +import { type SidePanelRootPage } from '@/side-panel/pages/root/components/SidePanelRootPage'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState'; @@ -37,7 +37,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { HttpResponse, graphql } from 'msw'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { IconDotsVertical } from 'twenty-ui/display'; import { JestContextStoreSetter } from '~/testing/jest/JestContextStoreSetter'; @@ -47,16 +47,16 @@ const openTimeout = 50; const ContextStoreDecorator: Decorator = (Story) => { return ( { ); }; -const meta: Meta = { +const meta: Meta = { title: 'Modules/CommandMenu/CommandMenu', - component: CommandMenuRouter, + component: SidePanelRouter, decorators: [ (Story) => { jotaiStore.set(currentWorkspaceState.atom, mockCurrentWorkspace); @@ -86,10 +86,10 @@ const meta: Meta = { currentUserWorkspaceState.atom, mockedUserData.currentUserWorkspace, ); - jotaiStore.set(isCommandMenuOpenedState.atom, true); - jotaiStore.set(commandMenuNavigationStackState.atom, [ + jotaiStore.set(isSidePanelOpenedState.atom, true); + jotaiStore.set(sidePanelNavigationStackState.atom, [ { - page: CommandMenuPages.Root, + page: SidePanelPages.Root, pageTitle: 'Command Menu', pageIcon: IconDotsVertical, pageId: '1', @@ -128,7 +128,7 @@ const meta: Meta = { }; export default meta; -type Story = StoryObj; +type Story = StoryObj; export const DefaultWithoutSearch: Story = { play: async ({ canvasElement }) => { diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuComponentInstanceId.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuComponentInstanceId.ts deleted file mode 100644 index 3a756e6e8f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuComponentInstanceId.ts +++ /dev/null @@ -1 +0,0 @@ -export const COMMAND_MENU_COMPONENT_INSTANCE_ID = 'command-menu'; diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuContextChipGroupsDropdownId.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuContextChipGroupsDropdownId.ts deleted file mode 100644 index a9f5c92428..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuContextChipGroupsDropdownId.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const COMMAND_MENU_CONTEXT_CHIP_GROUPS_DROPDOWN_ID = - 'command-menu-context-chip-groups-dropdown'; diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuListSelectableListId.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuListSelectableListId.ts deleted file mode 100644 index 794415147b..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuListSelectableListId.ts +++ /dev/null @@ -1 +0,0 @@ -export const COMMAND_MENU_LIST_SELECTABLE_LIST_ID = 'command-menu-list'; diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuNavigationHistoryDropdownId.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuNavigationHistoryDropdownId.ts deleted file mode 100644 index 8bf0c9b33f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuNavigationHistoryDropdownId.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const COMMAND_MENU_NAVIGATION_HISTORY_DROPDOWN_ID = - 'command-menu-navigation-history-dropdown'; diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPagesConfig.tsx b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPagesConfig.tsx deleted file mode 100644 index dc30d3e717..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPagesConfig.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { CommandMenu } from '@/command-menu/components/CommandMenu'; -import { CommandMenuAIChatThreadsPage } from '@/command-menu/pages/AIChatThreads/components/CommandMenuAIChatThreadsPage'; -import { CommandMenuAskAIPage } from '@/command-menu/pages/ask-ai/components/CommandMenuAskAIPage'; -import { CommandMenuCalendarEventPage } from '@/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage'; -import { CommandMenuFrontComponentPage } from '@/command-menu/pages/front-component/components/CommandMenuFrontComponentPage'; -import { CommandMenuMessageThreadPage } from '@/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage'; -import { CommandMenuNavigationMenuItemEditPage } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNavigationMenuItemEditPage'; -import { CommandMenuNewSidebarItemPage } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemPage'; -import { CommandMenuPageLayoutChartSettings } from '@/command-menu/pages/page-layout/components/CommandMenuPageLayoutChartSettings'; -import { CommandMenuPageLayoutFieldsLayout } from '@/command-menu/pages/page-layout/components/CommandMenuPageLayoutFieldsLayout'; -import { CommandMenuPageLayoutFieldsSettings } from '@/command-menu/pages/page-layout/components/CommandMenuPageLayoutFieldsSettings'; -import { CommandMenuPageLayoutGraphFilter } from '@/command-menu/pages/page-layout/components/CommandMenuPageLayoutGraphFilter'; -import { CommandMenuPageLayoutIframeSettings } from '@/command-menu/pages/page-layout/components/CommandMenuPageLayoutIframeSettings'; -import { CommandMenuPageLayoutTabSettings } from '@/command-menu/pages/page-layout/components/CommandMenuPageLayoutTabSettings'; -import { CommandMenuPageLayoutWidgetTypeSelect } from '@/command-menu/pages/page-layout/components/CommandMenuPageLayoutWidgetTypeSelect'; -import { CommandMenuMergeRecordPage } from '@/command-menu/pages/record-page/components/CommandMenuMergeRecordPage'; -import { CommandMenuRecordPage } from '@/command-menu/pages/record-page/components/CommandMenuRecordPage'; -import { CommandMenuUpdateMultipleRecords } from '@/command-menu/pages/record-page/components/CommandMenuUpdateMultipleRecords'; -import { CommandMenuEditRichTextPage } from '@/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage'; -import { CommandMenuSearchRecordsPage } from '@/command-menu/pages/search/components/CommandMenuSearchRecordsPage'; -import { CommandMenuWorkflowCreateStep } from '@/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStep'; -import { CommandMenuWorkflowEditStep } from '@/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStep'; -import { CommandMenuWorkflowEditStepType } from '@/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepType'; -import { CommandMenuWorkflowRunViewStep } from '@/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStep'; -import { CommandMenuWorkflowViewStep } from '@/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStep'; -import { CommandMenuWorkflowSelectTriggerType } from '@/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerType'; -import { CommandMenuPages } from 'twenty-shared/types'; - -export const COMMAND_MENU_PAGES_CONFIG = new Map< - CommandMenuPages, - React.ReactNode ->([ - [CommandMenuPages.Root, ], - [CommandMenuPages.ViewRecord, ], - [CommandMenuPages.MergeRecords, ], - [CommandMenuPages.UpdateRecords, ], - [CommandMenuPages.ViewEmailThread, ], - [CommandMenuPages.ViewCalendarEvent, ], - [CommandMenuPages.EditRichText, ], - [ - CommandMenuPages.WorkflowTriggerSelectType, - , - ], - [CommandMenuPages.WorkflowStepCreate, ], - [CommandMenuPages.WorkflowStepEditType, ], - [CommandMenuPages.WorkflowStepEdit, ], - [CommandMenuPages.WorkflowStepView, ], - [CommandMenuPages.WorkflowRunStepView, ], - [CommandMenuPages.SearchRecords, ], - [CommandMenuPages.AskAI, ], - [CommandMenuPages.ViewPreviousAIChats, ], - [ - CommandMenuPages.PageLayoutWidgetTypeSelect, - , - ], - [ - CommandMenuPages.PageLayoutGraphTypeSelect, - , - ], - [ - CommandMenuPages.PageLayoutGraphFilter, - , - ], - [ - CommandMenuPages.PageLayoutIframeSettings, - , - ], - [ - CommandMenuPages.PageLayoutTabSettings, - , - ], - [ - CommandMenuPages.PageLayoutFieldsSettings, - , - ], - [ - CommandMenuPages.PageLayoutFieldsLayout, - , - ], - [CommandMenuPages.ViewFrontComponent, ], - [ - CommandMenuPages.NavigationMenuItemEdit, - , - ], - [CommandMenuPages.NavigationMenuAddItem, ], -]); diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPreviousComponentInstanceId.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPreviousComponentInstanceId.ts deleted file mode 100644 index fe73880f64..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPreviousComponentInstanceId.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID = - 'command-menu-previous'; diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarHeight.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarHeight.ts deleted file mode 100644 index a6d01f1b73..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarHeight.ts +++ /dev/null @@ -1 +0,0 @@ -export const COMMAND_MENU_SEARCH_BAR_HEIGHT = 40; diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarHeightMobile.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarHeightMobile.ts deleted file mode 100644 index 0d5a6fa713..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarHeightMobile.ts +++ /dev/null @@ -1 +0,0 @@ -export const COMMAND_MENU_SEARCH_BAR_HEIGHT_MOBILE = 52; diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarPadding.ts b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarPadding.ts deleted file mode 100644 index 31ae4b2433..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuSearchBarPadding.ts +++ /dev/null @@ -1 +0,0 @@ -export const COMMAND_MENU_SEARCH_BAR_PADDING = 2; diff --git a/packages/twenty-front/src/modules/command-menu/constants/ResetContextToSelection.ts b/packages/twenty-front/src/modules/command-menu/constants/ResetContextToSelection.ts deleted file mode 100644 index 7c49587cf2..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/ResetContextToSelection.ts +++ /dev/null @@ -1 +0,0 @@ -export const RESET_CONTEXT_TO_SELECTION = 'reset-context-to-selection'; diff --git a/packages/twenty-front/src/modules/command-menu/constants/SidePanelFocusId.ts b/packages/twenty-front/src/modules/command-menu/constants/SidePanelFocusId.ts deleted file mode 100644 index 111b98055e..0000000000 --- a/packages/twenty-front/src/modules/command-menu/constants/SidePanelFocusId.ts +++ /dev/null @@ -1 +0,0 @@ -export const SIDE_PANEL_FOCUS_ID = 'command-menu'; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenu.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenu.test.tsx index 3a2b326027..8749049699 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenu.test.tsx @@ -3,13 +3,13 @@ import { Provider as JotaiProvider } from 'jotai'; import { act } from 'react'; import { MemoryRouter } from 'react-router-dom'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconDotsVertical } from 'twenty-ui/display'; const Wrapper = ({ children }: { children: React.ReactNode }) => ( @@ -26,7 +26,7 @@ const Wrapper = ({ children }: { children: React.ReactNode }) => ( const renderHooks = () => { const { result } = renderHook( () => { - const commandMenu = useCommandMenu(); + const commandMenu = useSidePanelMenu(); return { commandMenu, @@ -39,7 +39,7 @@ const renderHooks = () => { return { result }; }; -describe('useCommandMenu', () => { +describe('useSidePanelMenu', () => { beforeEach(() => { jest.clearAllMocks(); }); @@ -48,88 +48,78 @@ describe('useCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.commandMenu.openCommandMenu(); + result.current.commandMenu.openSidePanelMenu(); }); - expect(jotaiStore.get(isCommandMenuOpenedState.atom)).toBe(true); + expect(jotaiStore.get(isSidePanelOpenedState.atom)).toBe(true); act(() => { - result.current.commandMenu.closeCommandMenu(); + result.current.commandMenu.closeSidePanelMenu(); }); - expect(jotaiStore.get(isCommandMenuOpenedState.atom)).toBe(false); + expect(jotaiStore.get(isSidePanelOpenedState.atom)).toBe(false); }); it('should toggle the command menu', () => { const { result } = renderHooks(); - expect(jotaiStore.get(isCommandMenuOpenedState.atom)).toBe(false); + expect(jotaiStore.get(isSidePanelOpenedState.atom)).toBe(false); act(() => { - result.current.commandMenu.toggleCommandMenu(); + result.current.commandMenu.toggleSidePanelMenu(); }); - expect(jotaiStore.get(isCommandMenuOpenedState.atom)).toBe(true); + expect(jotaiStore.get(isSidePanelOpenedState.atom)).toBe(true); act(() => { - result.current.commandMenu.toggleCommandMenu(); + result.current.commandMenu.toggleSidePanelMenu(); }); - expect(jotaiStore.get(isCommandMenuOpenedState.atom)).toBe(false); + expect(jotaiStore.get(isSidePanelOpenedState.atom)).toBe(false); }); it('should navigate command menu and reset navigation stack when resetNavigationStack is true', () => { const { result } = renderHooks(); act(() => { - result.current.commandMenu.navigateCommandMenu({ - page: CommandMenuPages.Root, + result.current.commandMenu.navigateSidePanelMenu({ + page: SidePanelPages.Root, pageTitle: 'First Page', pageIcon: IconDotsVertical, resetNavigationStack: false, }); }); - expect(jotaiStore.get(commandMenuPageState.atom)).toBe( - CommandMenuPages.Root, - ); - expect(jotaiStore.get(commandMenuPageInfoState.atom).title).toBe( + expect(jotaiStore.get(sidePanelPageState.atom)).toBe(SidePanelPages.Root); + expect(jotaiStore.get(sidePanelPageInfoState.atom).title).toBe( 'First Page', ); - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toHaveLength( - 1, - ); + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toHaveLength(1); act(() => { - result.current.commandMenu.navigateCommandMenu({ - page: CommandMenuPages.SearchRecords, + result.current.commandMenu.navigateSidePanelMenu({ + page: SidePanelPages.SearchRecords, pageTitle: 'Second Page', pageIcon: IconDotsVertical, resetNavigationStack: false, }); }); - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toHaveLength( - 2, - ); + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toHaveLength(2); act(() => { - result.current.commandMenu.navigateCommandMenu({ - page: CommandMenuPages.Root, + result.current.commandMenu.navigateSidePanelMenu({ + page: SidePanelPages.Root, pageTitle: 'Reset Page', pageIcon: IconDotsVertical, resetNavigationStack: true, }); }); - expect(jotaiStore.get(commandMenuPageState.atom)).toBe( - CommandMenuPages.Root, - ); - expect(jotaiStore.get(commandMenuPageInfoState.atom).title).toBe( + expect(jotaiStore.get(sidePanelPageState.atom)).toBe(SidePanelPages.Root); + expect(jotaiStore.get(sidePanelPageInfoState.atom).title).toBe( 'Reset Page', ); - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toHaveLength( - 1, - ); + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toHaveLength(1); }); }); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuCloseAnimationCompleteCleanup.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuCloseAnimationCompleteCleanup.test.tsx deleted file mode 100644 index 6cd0ccf9f8..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuCloseAnimationCompleteCleanup.test.tsx +++ /dev/null @@ -1,177 +0,0 @@ -import { renderHook } from '@testing-library/react'; -import { Provider as JotaiProvider } from 'jotai'; -import { act } from 'react'; -import { MemoryRouter } from 'react-router-dom'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { COMMAND_MENU_CONTEXT_CHIP_GROUPS_DROPDOWN_ID } from '@/command-menu/constants/CommandMenuContextChipGroupsDropdownId'; -import { COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuPreviousComponentInstanceId'; -import { useCommandMenuCloseAnimationCompleteCleanup } from '@/command-menu/hooks/useCommandMenuCloseAnimationCompleteCleanup'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; -import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; -import { isCommandMenuClosingState } from '@/command-menu/states/isCommandMenuClosingState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; -import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; -import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; -import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; -import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; -import { CommandMenuPages } from 'twenty-shared/types'; -import { IconList } from 'twenty-ui/display'; - -const mockCloseDropdown = jest.fn(); -const mockResetContextStoreStates = jest.fn(); -const mockResetSelectedItem = jest.fn(); -const mockEmitSidePanelCloseEvent = jest.fn(); - -jest.mock('@/ui/layout/dropdown/hooks/useCloseDropdown', () => ({ - useCloseDropdown: () => ({ - closeDropdown: mockCloseDropdown, - }), -})); - -jest.mock('@/command-menu/hooks/useResetContextStoreStates', () => ({ - useResetContextStoreStates: () => ({ - resetContextStoreStates: mockResetContextStoreStates, - }), -})); - -jest.mock('@/ui/layout/selectable-list/hooks/useSelectableList', () => ({ - useSelectableList: () => ({ - resetSelectedItem: mockResetSelectedItem, - }), -})); - -jest.mock('@/ui/layout/right-drawer/utils/emitSidePanelCloseEvent', () => ({ - emitSidePanelCloseEvent: () => { - mockEmitSidePanelCloseEvent(); - }, -})); - -const Wrapper = ({ children }: { children: React.ReactNode }) => ( - - {children} - -); - -describe('useCommandMenuCloseAnimationCompleteCleanup', () => { - beforeEach(() => { - jest.clearAllMocks(); - }); - - const renderHooks = () => { - const { result } = renderHook( - () => { - const { commandMenuCloseAnimationCompleteCleanup } = - useCommandMenuCloseAnimationCompleteCleanup(); - - const viewableRecordId = useAtomStateValue(viewableRecordIdState); - - const setViewableRecordId = useSetAtomState(viewableRecordIdState); - - return { - commandMenuCloseAnimationCompleteCleanup, - viewableRecordId, - setViewableRecordId, - }; - }, - { - wrapper: Wrapper, - }, - ); - return { result }; - }; - - it('should reset modified states back to default values', () => { - const { result } = renderHooks(); - - act(() => { - jotaiStore.set(commandMenuPageState.atom, CommandMenuPages.ViewRecord); - jotaiStore.set(commandMenuPageInfoState.atom, { - title: 'Test Record', - Icon: IconList, - instanceId: 'test-id', - }); - jotaiStore.set(isCommandMenuOpenedState.atom, true); - jotaiStore.set(commandMenuSearchState.atom, 'test search'); - jotaiStore.set(commandMenuNavigationStackState.atom, [ - { - page: CommandMenuPages.SearchRecords, - pageTitle: 'Search', - pageIcon: IconList, - pageId: '1', - }, - ]); - jotaiStore.set(hasUserSelectedCommandState.atom, true); - jotaiStore.set(isCommandMenuClosingState.atom, true); - result.current.setViewableRecordId('record-123'); - }); - - expect(jotaiStore.get(commandMenuPageState.atom)).toBe( - CommandMenuPages.ViewRecord, - ); - expect(jotaiStore.get(commandMenuPageInfoState.atom)).toEqual({ - title: 'Test Record', - Icon: IconList, - instanceId: 'test-id', - }); - expect(jotaiStore.get(isCommandMenuOpenedState.atom)).toBe(true); - expect(jotaiStore.get(commandMenuSearchState.atom)).toBe('test search'); - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toEqual([ - { - page: CommandMenuPages.SearchRecords, - pageTitle: 'Search', - pageIcon: IconList, - pageId: '1', - }, - ]); - expect(jotaiStore.get(hasUserSelectedCommandState.atom)).toBe(true); - expect(jotaiStore.get(isCommandMenuClosingState.atom)).toBe(true); - expect(result.current.viewableRecordId).toBe('record-123'); - - act(() => { - result.current.commandMenuCloseAnimationCompleteCleanup(); - }); - - expect(jotaiStore.get(commandMenuPageState.atom)).toBe( - CommandMenuPages.Root, - ); - expect(jotaiStore.get(commandMenuPageInfoState.atom)).toEqual({ - title: undefined, - Icon: undefined, - instanceId: '', - }); - expect(jotaiStore.get(isCommandMenuOpenedState.atom)).toBe(false); - expect(jotaiStore.get(commandMenuSearchState.atom)).toBe(''); - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toEqual([]); - expect(jotaiStore.get(hasUserSelectedCommandState.atom)).toBe(false); - expect(jotaiStore.get(isCommandMenuClosingState.atom)).toBe(false); - expect(result.current.viewableRecordId).toBe(null); - }); - - it('should call all dependent functions correctly', () => { - const { result } = renderHooks(); - - act(() => { - result.current.commandMenuCloseAnimationCompleteCleanup(); - }); - - expect(mockCloseDropdown).toHaveBeenCalledTimes(1); - expect(mockResetContextStoreStates).toHaveBeenCalledTimes(2); - expect(mockResetSelectedItem).toHaveBeenCalledTimes(1); - expect(mockEmitSidePanelCloseEvent).toHaveBeenCalledTimes(1); - - expect(mockCloseDropdown).toHaveBeenCalledWith( - COMMAND_MENU_CONTEXT_CHIP_GROUPS_DROPDOWN_ID, - ); - expect(mockResetContextStoreStates).toHaveBeenNthCalledWith( - 1, - COMMAND_MENU_COMPONENT_INSTANCE_ID, - ); - expect(mockResetContextStoreStates).toHaveBeenNthCalledWith( - 2, - COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID, - ); - }); -}); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuHistory.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuHistory.test.tsx deleted file mode 100644 index f13a261434..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuHistory.test.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import { renderHook } from '@testing-library/react'; -import { Provider as JotaiProvider } from 'jotai'; -import { act } from 'react'; -import { MemoryRouter } from 'react-router-dom'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useCommandMenuCloseAnimationCompleteCleanup } from '@/command-menu/hooks/useCommandMenuCloseAnimationCompleteCleanup'; -import { useCommandMenuHistory } from '@/command-menu/hooks/useCommandMenuHistory'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; -import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; -import { CommandMenuPages } from 'twenty-shared/types'; -import { IconList, IconSearch } from 'twenty-ui/display'; - -const Wrapper = ({ children }: { children: React.ReactNode }) => ( - - {children} - -); - -const renderHooks = () => { - const { result } = renderHook( - () => { - const commandMenu = useCommandMenu(); - const commandMenuHistory = useCommandMenuHistory(); - const commandMenuCloseAnimationCompleteCleanup = - useCommandMenuCloseAnimationCompleteCleanup(); - - return { - commandMenu, - commandMenuHistory, - commandMenuCloseAnimationCompleteCleanup, - }; - }, - { - wrapper: Wrapper, - }, - ); - return { result }; -}; - -describe('useCommandMenuHistory', () => { - it('should go back from a page', () => { - const { result } = renderHooks(); - - act(() => { - result.current.commandMenu.navigateCommandMenu({ - page: CommandMenuPages.SearchRecords, - pageTitle: 'Search', - pageIcon: IconSearch, - pageId: '1', - }); - }); - - act(() => { - result.current.commandMenu.navigateCommandMenu({ - page: CommandMenuPages.ViewRecord, - pageTitle: 'Company', - pageIcon: IconList, - pageId: '2', - }); - }); - - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toEqual([ - { - page: CommandMenuPages.SearchRecords, - pageTitle: 'Search', - pageIcon: IconSearch, - pageId: '1', - }, - { - page: CommandMenuPages.ViewRecord, - pageTitle: 'Company', - pageIcon: IconList, - pageId: '2', - }, - ]); - - act(() => { - result.current.commandMenuHistory.goBackFromCommandMenu(); - }); - - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toEqual([ - { - page: CommandMenuPages.SearchRecords, - pageTitle: 'Search', - pageIcon: IconSearch, - pageId: '1', - }, - ]); - expect(jotaiStore.get(commandMenuPageState.atom)).toBe( - CommandMenuPages.SearchRecords, - ); - expect(jotaiStore.get(commandMenuPageInfoState.atom)).toEqual({ - title: 'Search', - Icon: IconSearch, - instanceId: '1', - }); - - act(() => { - result.current.commandMenuHistory.goBackFromCommandMenu(); - result.current.commandMenuCloseAnimationCompleteCleanup.commandMenuCloseAnimationCompleteCleanup(); - }); - - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toEqual([]); - expect(jotaiStore.get(commandMenuPageState.atom)).toBe( - CommandMenuPages.Root, - ); - expect(jotaiStore.get(commandMenuPageInfoState.atom)).toEqual({ - title: undefined, - instanceId: '', - Icon: undefined, - }); - expect(jotaiStore.get(isCommandMenuOpenedState.atom)).toBe(false); - }); - - it('should navigate to a page in history', () => { - const { result } = renderHooks(); - - act(() => { - result.current.commandMenu.navigateCommandMenu({ - page: CommandMenuPages.SearchRecords, - pageTitle: 'Search', - pageIcon: IconSearch, - pageId: '1', - }); - }); - - act(() => { - result.current.commandMenuHistory.navigateCommandMenuHistory(0); - }); - - expect(jotaiStore.get(commandMenuPageState.atom)).toBe( - CommandMenuPages.SearchRecords, - ); - expect(jotaiStore.get(commandMenuPageInfoState.atom)).toEqual({ - title: 'Search', - Icon: IconSearch, - instanceId: '1', - }); - }); -}); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenAskAIPageInCommandMenu.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenAskAIPageInCommandMenu.test.tsx deleted file mode 100644 index 0c590a61b2..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenAskAIPageInCommandMenu.test.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import { act, renderHook } from '@testing-library/react'; -import { Provider as JotaiProvider } from 'jotai'; -import { type ReactNode } from 'react'; - -import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; -import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; -import { CommandMenuPages } from 'twenty-shared/types'; -import { IconSparkles } from 'twenty-ui/display'; - -const navigateCommandMenuMock = jest.fn(); - -jest.mock('@/command-menu/hooks/useCommandMenu', () => ({ - useCommandMenu: () => ({ - navigateCommandMenu: navigateCommandMenuMock, - openCommandMenu: jest.fn(), - closeCommandMenu: jest.fn(), - toggleCommandMenu: jest.fn(), - }), -})); - -const Wrapper = ({ children }: { children: ReactNode }) => ( - {children} -); - -describe('useOpenAskAIPageInCommandMenu', () => { - beforeEach(() => { - jest.clearAllMocks(); - jotaiStore.set(isCommandMenuOpenedState.atom, false); - }); - - it('should navigate to AskAI page with correct defaults', () => { - const { result } = renderHook(() => useOpenAskAIPageInCommandMenu(), { - wrapper: Wrapper, - }); - - act(() => { - result.current.openAskAIPage(); - }); - - expect(navigateCommandMenuMock).toHaveBeenCalledWith( - expect.objectContaining({ - page: CommandMenuPages.AskAI, - pageTitle: 'Ask AI', - pageIcon: IconSparkles, - }), - ); - }); - - it('should use resetNavigationStack from argument when provided', () => { - jotaiStore.set(isCommandMenuOpenedState.atom, true); - - const { result } = renderHook(() => useOpenAskAIPageInCommandMenu(), { - wrapper: Wrapper, - }); - - act(() => { - result.current.openAskAIPage({ resetNavigationStack: false }); - }); - - expect(navigateCommandMenuMock).toHaveBeenCalledWith( - expect.objectContaining({ - resetNavigationStack: false, - }), - ); - }); - - it('should default resetNavigationStack to isCommandMenuOpened', () => { - jotaiStore.set(isCommandMenuOpenedState.atom, true); - - const { result } = renderHook(() => useOpenAskAIPageInCommandMenu(), { - wrapper: Wrapper, - }); - - act(() => { - result.current.openAskAIPage(); - }); - - expect(navigateCommandMenuMock).toHaveBeenCalledWith( - expect.objectContaining({ - resetNavigationStack: true, - }), - ); - }); -}); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useSetGlobalCommandMenuContext.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useSetGlobalCommandMenuContext.test.tsx index 0cd80fe0a2..c4c4c317db 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useSetGlobalCommandMenuContext.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useSetGlobalCommandMenuContext.test.tsx @@ -1,11 +1,11 @@ import { renderHook } from '@testing-library/react'; import { act } from 'react'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuPreviousComponentInstanceId'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelPreviousComponentInstanceId'; import { useSetGlobalCommandMenuContext } from '@/command-menu/hooks/useSetGlobalCommandMenuContext'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { contextStoreAnyFieldFilterValueComponentState } from '@/context-store/states/contextStoreAnyFieldFilterValueComponentState'; import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState'; @@ -37,7 +37,7 @@ jotaiStore.set( const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ apolloMocks: [], - componentInstanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, + componentInstanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, contextStoreCurrentObjectMetadataNameSingular: personMockObjectMetadataItem.nameSingular, contextStoreCurrentViewId: 'my-view-id', @@ -62,32 +62,32 @@ describe('useSetGlobalCommandMenuContext', () => { const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); const contextStoreNumberOfSelectedRecords = useAtomComponentStateValue( contextStoreNumberOfSelectedRecordsComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); const contextStoreCurrentViewType = useAtomComponentStateValue( contextStoreCurrentViewTypeComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); return { @@ -115,16 +115,16 @@ describe('useSetGlobalCommandMenuContext', () => { expect(result.current.contextStoreCurrentViewType).toBe( ContextStoreViewType.Table, ); - const commandMenuPageInfo = jotaiStore.get(commandMenuPageInfoState.atom); - expect(commandMenuPageInfo).toEqual({ + const sidePanelPageInfo = jotaiStore.get(sidePanelPageInfoState.atom); + expect(sidePanelPageInfo).toEqual({ title: undefined, Icon: undefined, instanceId: '', }); - const hasUserSelectedCommand = jotaiStore.get( - hasUserSelectedCommandState.atom, + const hasUserSelectedSidePanelListItem = jotaiStore.get( + hasUserSelectedSidePanelListItemState.atom, ); - expect(hasUserSelectedCommand).toBe(false); + expect(hasUserSelectedSidePanelListItem).toBe(false); act(() => { result.current.setGlobalCommandMenuContext(); @@ -140,18 +140,16 @@ describe('useSetGlobalCommandMenuContext', () => { expect(result.current.contextStoreCurrentViewType).toBe( ContextStoreViewType.Table, ); - const commandMenuPageInfoAfter = jotaiStore.get( - commandMenuPageInfoState.atom, - ); - expect(commandMenuPageInfoAfter).toEqual({ + const sidePanelPageInfoAfter = jotaiStore.get(sidePanelPageInfoState.atom); + expect(sidePanelPageInfoAfter).toEqual({ title: undefined, Icon: undefined, instanceId: '', }); - const hasUserSelectedCommandAfter = jotaiStore.get( - hasUserSelectedCommandState.atom, + const hasUserSelectedSidePanelListItemAfter = jotaiStore.get( + hasUserSelectedSidePanelListItemState.atom, ); - expect(hasUserSelectedCommandAfter).toBe(false); + expect(hasUserSelectedSidePanelListItemAfter).toBe(false); }); it('should copy context store states to previous instance before resetting', () => { @@ -163,13 +161,13 @@ describe('useSetGlobalCommandMenuContext', () => { // eslint-disable-next-line twenty/matching-state-variable const previousTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, - COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID, + SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID, ); // eslint-disable-next-line twenty/matching-state-variable const previousNumberOfSelectedRecords = useAtomComponentStateValue( contextStoreNumberOfSelectedRecordsComponentState, - COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID, + SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID, ); return { diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useWorkflowCommandMenu.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useWorkflowCommandMenu.test.tsx index ec31da767e..84674f6cc4 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useWorkflowCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useWorkflowCommandMenu.test.tsx @@ -1,10 +1,10 @@ import { renderHook } from '@testing-library/react'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { viewableRecordNameSingularComponentState } from '@/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState'; -import { commandMenuWorkflowIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState'; -import { commandMenuWorkflowVersionIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { viewableRecordNameSingularComponentState } from '@/side-panel/pages/record-page/states/viewableRecordNameSingularComponentState'; +import { sidePanelWorkflowIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowIdComponentState'; +import { sidePanelWorkflowVersionIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowVersionIdComponentState'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState'; import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState'; @@ -13,7 +13,7 @@ import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { act } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconBolt, IconSettingsAutomation, useIcons } from 'twenty-ui/display'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -23,9 +23,9 @@ jest.mock('uuid', () => ({ })); const mockNavigateCommandMenu = jest.fn(); -jest.mock('@/command-menu/hooks/useNavigateCommandMenu', () => ({ - useNavigateCommandMenu: () => ({ - navigateCommandMenu: mockNavigateCommandMenu, +jest.mock('@/side-panel/hooks/useNavigateSidePanel', () => ({ + useNavigateSidePanel: () => ({ + navigateSidePanel: mockNavigateCommandMenu, }), })); @@ -41,7 +41,7 @@ jest.mock('@/object-metadata/hooks/useObjectMetadataItem', () => ({ const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ apolloMocks: [], - componentInstanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, + componentInstanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, contextStoreCurrentObjectMetadataNameSingular: workflowMockObjectMetadataItem.nameSingular, contextStoreCurrentViewId: 'my-view-id', @@ -57,12 +57,12 @@ const renderHooks = () => { const { result } = renderHook( () => { const { - openWorkflowTriggerTypeInCommandMenu, - openWorkflowCreateStepInCommandMenu, - openWorkflowEditStepInCommandMenu, - openWorkflowEditStepTypeInCommandMenu, - openWorkflowViewStepInCommandMenu, - } = useWorkflowCommandMenu(); + openWorkflowTriggerTypeInSidePanel, + openWorkflowCreateStepInSidePanel, + openWorkflowEditStepInSidePanel, + openWorkflowEditStepTypeInSidePanel, + openWorkflowViewStepInSidePanel, + } = useSidePanelWorkflowNavigation(); const viewableRecordNameSingular = useAtomComponentStateValue( viewableRecordNameSingularComponentState, @@ -85,24 +85,24 @@ const renderHooks = () => { contextStoreCurrentViewTypeComponentState, 'mocked-uuid', ); - const commandMenuWorkflowId = useAtomComponentStateValue( - commandMenuWorkflowIdComponentState, + const sidePanelWorkflowId = useAtomComponentStateValue( + sidePanelWorkflowIdComponentState, 'mocked-uuid', ); - const commandMenuWorkflowVersionId = useAtomComponentStateValue( - commandMenuWorkflowVersionIdComponentState, + const sidePanelWorkflowVersionId = useAtomComponentStateValue( + sidePanelWorkflowVersionIdComponentState, 'mocked-uuid', ); const { getIcon } = useIcons(); return { - openWorkflowTriggerTypeInCommandMenu, - openWorkflowCreateStepInCommandMenu, - openWorkflowEditStepInCommandMenu, - openWorkflowEditStepTypeInCommandMenu, - openWorkflowViewStepInCommandMenu, - commandMenuWorkflowId, - commandMenuWorkflowVersionId, + openWorkflowTriggerTypeInSidePanel, + openWorkflowCreateStepInSidePanel, + openWorkflowEditStepInSidePanel, + openWorkflowEditStepTypeInSidePanel, + openWorkflowViewStepInSidePanel, + sidePanelWorkflowId, + sidePanelWorkflowVersionId, viewableRecordNameSingular, contextStoreCurrentObjectMetadataItemId, contextStoreTargetedRecordsRule, @@ -118,7 +118,7 @@ const renderHooks = () => { return { result }; }; -describe('useWorkflowCommandMenu', () => { +describe('useSidePanelWorkflowNavigation', () => { beforeEach(() => { jest.clearAllMocks(); }); @@ -127,13 +127,13 @@ describe('useWorkflowCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.openWorkflowTriggerTypeInCommandMenu('test-workflow-id'); + result.current.openWorkflowTriggerTypeInSidePanel('test-workflow-id'); }); - expect(result.current.commandMenuWorkflowId).toBe('test-workflow-id'); + expect(result.current.sidePanelWorkflowId).toBe('test-workflow-id'); expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.WorkflowTriggerSelectType, + page: SidePanelPages.WorkflowTriggerSelectType, pageTitle: t`Trigger Type`, pageIcon: IconBolt, pageId: 'mocked-uuid', @@ -144,13 +144,13 @@ describe('useWorkflowCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.openWorkflowCreateStepInCommandMenu('test-workflow-id'); + result.current.openWorkflowCreateStepInSidePanel('test-workflow-id'); }); - expect(result.current.commandMenuWorkflowId).toBe('test-workflow-id'); + expect(result.current.sidePanelWorkflowId).toBe('test-workflow-id'); expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.WorkflowStepCreate, + page: SidePanelPages.WorkflowStepCreate, pageTitle: t`Select Action`, pageIcon: IconSettingsAutomation, pageId: 'mocked-uuid', @@ -161,13 +161,13 @@ describe('useWorkflowCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.openWorkflowEditStepTypeInCommandMenu('test-workflow-id'); + result.current.openWorkflowEditStepTypeInSidePanel('test-workflow-id'); }); - expect(result.current.commandMenuWorkflowId).toBe('test-workflow-id'); + expect(result.current.sidePanelWorkflowId).toBe('test-workflow-id'); expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.WorkflowStepEditType, + page: SidePanelPages.WorkflowStepEditType, pageTitle: t`Select action`, pageIcon: IconSettingsAutomation, pageId: 'mocked-uuid', @@ -178,17 +178,17 @@ describe('useWorkflowCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.openWorkflowEditStepInCommandMenu( + result.current.openWorkflowEditStepInSidePanel( 'test-workflow-id', 'Edit Step', IconSettingsAutomation, ); }); - expect(result.current.commandMenuWorkflowId).toBe('test-workflow-id'); + expect(result.current.sidePanelWorkflowId).toBe('test-workflow-id'); expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.WorkflowStepEdit, + page: SidePanelPages.WorkflowStepEdit, pageTitle: 'Edit Step', pageIcon: IconSettingsAutomation, pageId: 'mocked-uuid', @@ -199,7 +199,7 @@ describe('useWorkflowCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.openWorkflowViewStepInCommandMenu({ + result.current.openWorkflowViewStepInSidePanel({ workflowId: 'test-workflow-id', workflowVersionId: 'test-workflow-version-id', icon: IconSettingsAutomation, @@ -207,13 +207,13 @@ describe('useWorkflowCommandMenu', () => { }); }); - expect(result.current.commandMenuWorkflowId).toBe('test-workflow-id'); - expect(result.current.commandMenuWorkflowVersionId).toBe( + expect(result.current.sidePanelWorkflowId).toBe('test-workflow-id'); + expect(result.current.sidePanelWorkflowVersionId).toBe( 'test-workflow-version-id', ); expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.WorkflowStepView, + page: SidePanelPages.WorkflowStepView, pageTitle: 'View Step', pageIcon: IconSettingsAutomation, pageId: 'mocked-uuid', diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts index 84d6a131ea..055a1419d3 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts +++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts @@ -1,12 +1,12 @@ -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useCommandMenuHistory } from '@/command-menu/hooks/useCommandMenuHistory'; -import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu'; -import { useOpenRecordsSearchPageInCommandMenu } from '@/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useSidePanelHistory } from '@/side-panel/hooks/useSidePanelHistory'; +import { useOpenAskAIPageInSidePanel } from '@/side-panel/hooks/useOpenAskAIPageInSidePanel'; +import { useOpenRecordsSearchPageInSidePanel } from '@/side-panel/hooks/useOpenRecordsSearchPageInSidePanel'; import { useSetGlobalCommandMenuContext } from '@/command-menu/hooks/useSetGlobalCommandMenuContext'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu'; import { useGlobalHotkeys } from '@/ui/utilities/hotkey/hooks/useGlobalHotkeys'; @@ -16,41 +16,41 @@ import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { isNonEmptyString } from '@sniptt/guards'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Key } from 'ts-key-enum'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; export const useCommandMenuHotKeys = () => { - const { toggleCommandMenu } = useCommandMenu(); + const { toggleSidePanelMenu } = useSidePanelMenu(); - const { openRecordsSearchPage } = useOpenRecordsSearchPageInCommandMenu(); + const { openRecordsSearchPage } = useOpenRecordsSearchPageInSidePanel(); - const { openAskAIPage } = useOpenAskAIPageInCommandMenu(); + const { openAskAIPage } = useOpenAskAIPageInSidePanel(); - const { goBackFromCommandMenu } = useCommandMenuHistory(); + const { goBackFromSidePanel } = useSidePanelHistory(); const { setGlobalCommandMenuContext } = useSetGlobalCommandMenuContext(); - const commandMenuSearch = useAtomStateValue(commandMenuSearchState); + const sidePanelSearch = useAtomStateValue(sidePanelSearchState); const { closeKeyboardShortcutMenu } = useKeyboardShortcutMenu(); - const commandMenuPage = useAtomStateValue(commandMenuPageState); + const sidePanelPage = useAtomStateValue(sidePanelPageState); const isAiEnabled = useIsFeatureEnabled(FeatureFlagKey.IS_AI_ENABLED); const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); useGlobalHotkeys({ keys: ['ctrl+k', 'meta+k'], callback: () => { closeKeyboardShortcutMenu(); - toggleCommandMenu(); + toggleSidePanelMenu(); }, containsModifier: true, - dependencies: [closeKeyboardShortcutMenu, toggleCommandMenu], + dependencies: [closeKeyboardShortcutMenu, toggleSidePanelMenu], }); useGlobalHotkeys({ @@ -82,10 +82,10 @@ export const useCommandMenuHotKeys = () => { useHotkeysOnFocusedElement({ keys: [Key.Escape], callback: () => { - goBackFromCommandMenu(); + goBackFromSidePanel(); }, focusId: SIDE_PANEL_FOCUS_ID, - dependencies: [goBackFromCommandMenu], + dependencies: [goBackFromSidePanel], options: { enableOnFormTags: false, }, @@ -94,12 +94,12 @@ export const useCommandMenuHotKeys = () => { useHotkeysOnFocusedElement({ keys: [Key.Backspace, Key.Delete], callback: () => { - if (isNonEmptyString(commandMenuSearch)) { + if (isNonEmptyString(sidePanelSearch)) { return; } if ( - commandMenuPage === CommandMenuPages.Root && + sidePanelPage === SidePanelPages.Root && !( contextStoreTargetedRecordsRule.mode === 'selection' && contextStoreTargetedRecordsRule.selectedRecordIds.length === 0 @@ -107,16 +107,16 @@ export const useCommandMenuHotKeys = () => { ) { setGlobalCommandMenuContext(); } - if (commandMenuPage !== CommandMenuPages.Root) { - goBackFromCommandMenu(); + if (sidePanelPage !== SidePanelPages.Root) { + goBackFromSidePanel(); } }, focusId: SIDE_PANEL_FOCUS_ID, dependencies: [ - commandMenuPage, - commandMenuSearch, + sidePanelPage, + sidePanelSearch, contextStoreTargetedRecordsRule, - goBackFromCommandMenu, + goBackFromSidePanel, setGlobalCommandMenuContext, ], options: { diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useNavigateCommandMenu.ts b/packages/twenty-front/src/modules/command-menu/hooks/useNavigateCommandMenu.ts deleted file mode 100644 index b941b7a7f1..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/useNavigateCommandMenu.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; -import { useCommandMenuCloseAnimationCompleteCleanup } from '@/command-menu/hooks/useCommandMenuCloseAnimationCompleteCleanup'; -import { useCopyContextStoreStates } from '@/command-menu/hooks/useCopyContextStoreAndActionMenuStates'; -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { commandMenuShouldFocusTitleInputComponentState } from '@/command-menu/states/commandMenuShouldFocusTitleInputComponentState'; -import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; -import { isCommandMenuClosingState } from '@/command-menu/states/isCommandMenuClosingState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; -import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; -import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; -import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useStore } from 'jotai'; -import { useCallback } from 'react'; -import { type CommandMenuPages } from 'twenty-shared/types'; -import { type IconComponent } from 'twenty-ui/display'; -import { v4 } from 'uuid'; - -export type CommandMenuNavigationStackItem = { - page: CommandMenuPages; - pageTitle: string; - pageIcon: IconComponent; - pageIconColor?: string; - pageId?: string; -}; - -export const useNavigateCommandMenu = () => { - const store = useStore(); - const { copyContextStoreStates } = useCopyContextStoreStates(); - - const { commandMenuCloseAnimationCompleteCleanup } = - useCommandMenuCloseAnimationCompleteCleanup(); - - const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); - - const openCommandMenu = useCallback(() => { - const isCommandMenuOpened = store.get(isCommandMenuOpenedState.atom); - - const isCommandMenuClosing = store.get(isCommandMenuClosingState.atom); - - if (isCommandMenuClosing) { - commandMenuCloseAnimationCompleteCleanup({ - emitSidePanelCloseEvent: false, - }); - } - - if (isCommandMenuOpened) { - return; - } - - pushFocusItemToFocusStack({ - focusId: SIDE_PANEL_FOCUS_ID, - component: { - type: FocusComponentType.SIDE_PANEL, - instanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, - }, - globalHotkeysConfig: { - enableGlobalHotkeysConflictingWithKeyboard: false, - }, - }); - - copyContextStoreStates({ - instanceIdToCopyFrom: MAIN_CONTEXT_STORE_INSTANCE_ID, - instanceIdToCopyTo: COMMAND_MENU_COMPONENT_INSTANCE_ID, - }); - - store.set(isCommandMenuOpenedState.atom, true); - store.set(hasUserSelectedCommandState.atom, false); - }, [ - copyContextStoreStates, - commandMenuCloseAnimationCompleteCleanup, - pushFocusItemToFocusStack, - store, - ]); - - const navigateCommandMenu = useCallback( - ({ - page, - pageTitle, - pageIcon, - pageIconColor, - pageId, - focusTitleInput = false, - resetNavigationStack = false, - }: CommandMenuNavigationStackItem & { - resetNavigationStack?: boolean; - focusTitleInput?: boolean; - }) => { - const computedPageId = pageId || v4(); - - openCommandMenu(); - store.set(commandMenuPageState.atom, page); - store.set(commandMenuPageInfoState.atom, { - title: pageTitle, - Icon: pageIcon, - instanceId: computedPageId, - }); - - if (focusTitleInput) { - store.set( - commandMenuShouldFocusTitleInputComponentState.atomFamily({ - instanceId: computedPageId, - }), - true, - ); - } - - const isCommandMenuClosing = store.get(isCommandMenuClosingState.atom); - - const currentNavigationStack = isCommandMenuClosing - ? [] - : store.get(commandMenuNavigationStackState.atom); - - if (resetNavigationStack) { - store.set(commandMenuNavigationStackState.atom, [ - { - page, - pageTitle, - pageIcon, - pageIconColor, - pageId: computedPageId, - }, - ]); - - store.set(commandMenuNavigationMorphItemsByPageState.atom, new Map()); - } else { - store.set(commandMenuNavigationStackState.atom, [ - ...currentNavigationStack, - { - page, - pageTitle, - pageIcon, - pageIconColor, - pageId: computedPageId, - }, - ]); - } - }, - [openCommandMenu, store], - ); - - return { - navigateCommandMenu, - }; -}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu.ts b/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu.ts deleted file mode 100644 index 5c8a2f61ab..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; -import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; -import { t } from '@lingui/core/macro'; -import { CommandMenuPages } from 'twenty-shared/types'; -import { IconSearch } from 'twenty-ui/display'; -import { v4 } from 'uuid'; - -export const useOpenRecordsSearchPageInCommandMenu = () => { - const { navigateCommandMenu } = useCommandMenu(); - const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState); - - const openRecordsSearchPage = () => { - navigateCommandMenu({ - page: CommandMenuPages.SearchRecords, - pageTitle: t`Search`, - pageIcon: IconSearch, - pageId: v4(), - resetNavigationStack: isCommandMenuOpened, - }); - }; - - return { - openRecordsSearchPage, - }; -}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenUpdateMultipleRecordsPageInCommandMenu.tsx b/packages/twenty-front/src/modules/command-menu/hooks/useOpenUpdateMultipleRecordsPageInCommandMenu.tsx deleted file mode 100644 index 71b998a247..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenUpdateMultipleRecordsPageInCommandMenu.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { CommandMenuPages } from 'twenty-shared/types'; - -import { msg, t } from '@lingui/core/macro'; -import { useCallback } from 'react'; -import { IconBoxMultiple } from 'twenty-ui/display'; - -type UseOpenUpdateMultipleRecordsPageInCommandMenuProps = { - contextStoreInstanceId: string; -}; - -export const useOpenUpdateMultipleRecordsPageInCommandMenu = ({ - contextStoreInstanceId, -}: UseOpenUpdateMultipleRecordsPageInCommandMenuProps) => { - const { navigateCommandMenu } = useNavigateCommandMenu(); - - const openUpdateMultipleRecordsPageInCommandMenu = useCallback(async () => { - navigateCommandMenu({ - page: CommandMenuPages.UpdateRecords, - pageTitle: t(msg`Update records`), - pageIcon: IconBoxMultiple, - pageId: contextStoreInstanceId, - }); - }, [navigateCommandMenu, contextStoreInstanceId]); - - return { - openUpdateMultipleRecordsPageInCommandMenu, - }; -}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useResetPreviousCommandMenuContext.ts b/packages/twenty-front/src/modules/command-menu/hooks/useResetPreviousCommandMenuContext.ts deleted file mode 100644 index eb32ac8d9d..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/useResetPreviousCommandMenuContext.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuPreviousComponentInstanceId'; -import { useCopyContextStoreStates } from '@/command-menu/hooks/useCopyContextStoreAndActionMenuStates'; -import { useResetContextStoreStates } from '@/command-menu/hooks/useResetContextStoreStates'; - -export const useResetPreviousCommandMenuContext = () => { - const { copyContextStoreStates } = useCopyContextStoreStates(); - const { resetContextStoreStates } = useResetContextStoreStates(); - - const resetPreviousCommandMenuContext = () => { - copyContextStoreStates({ - instanceIdToCopyFrom: COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID, - instanceIdToCopyTo: COMMAND_MENU_COMPONENT_INSTANCE_ID, - }); - resetContextStoreStates(COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID); - }; - - return { - resetPreviousCommandMenuContext, - }; -}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useRichTextCommandMenu.ts b/packages/twenty-front/src/modules/command-menu/hooks/useRichTextCommandMenu.ts deleted file mode 100644 index fcc41f6aac..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/useRichTextCommandMenu.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { viewableRichTextComponentState } from '@/command-menu/pages/rich-text-page/states/viewableRichTextComponentState'; -import { t } from '@lingui/core/macro'; -import { useStore } from 'jotai'; -import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; -import { IconPencil } from 'twenty-ui/display'; - -export const useRichTextCommandMenu = () => { - const { navigateCommandMenu, openCommandMenu } = useCommandMenu(); - - const store = useStore(); - - const openRichTextInCommandMenu = useCallback( - ({ - activityId, - activityObjectNameSingular, - }: { - activityId: string; - activityObjectNameSingular: string; - }) => { - store.set(viewableRichTextComponentState.atom, { - activityId, - activityObjectNameSingular, - }); - - openCommandMenu(); - navigateCommandMenu({ - page: CommandMenuPages.EditRichText, - pageTitle: t`Rich Text`, - pageIcon: IconPencil, - }); - }, - [navigateCommandMenu, openCommandMenu, store], - ); - - const editRichText = useCallback( - (activityId: string, activityObjectNameSingular: string) => { - openRichTextInCommandMenu({ activityId, activityObjectNameSingular }); - }, - [openRichTextInCommandMenu], - ); - - return { - editRichText, - }; -}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useSetGlobalCommandMenuContext.ts b/packages/twenty-front/src/modules/command-menu/hooks/useSetGlobalCommandMenuContext.ts index dc4cad7380..48ebd872c0 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useSetGlobalCommandMenuContext.ts +++ b/packages/twenty-front/src/modules/command-menu/hooks/useSetGlobalCommandMenuContext.ts @@ -1,7 +1,7 @@ -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuPreviousComponentInstanceId'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelPreviousComponentInstanceId'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState'; import { contextStoreAnyFieldFilterValueComponentState } from '@/context-store/states/contextStoreAnyFieldFilterValueComponentState'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; @@ -21,8 +21,8 @@ export const useSetGlobalCommandMenuContext = () => { const setGlobalCommandMenuContext = useCallback(() => { store.set( atom(null, (get, batchSet) => { - const fromId = COMMAND_MENU_COMPONENT_INSTANCE_ID; - const toId = COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID; + const fromId = SIDE_PANEL_COMPONENT_INSTANCE_ID; + const toId = SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID; batchSet( contextStoreCurrentObjectMetadataItemIdComponentState.atomFamily({ @@ -165,13 +165,13 @@ export const useSetGlobalCommandMenuContext = () => { ContextStoreViewType.Table, ); - batchSet(commandMenuPageInfoState.atom, { + batchSet(sidePanelPageInfoState.atom, { title: undefined, Icon: undefined, instanceId: '', }); - batchSet(hasUserSelectedCommandState.atom, false); + batchSet(hasUserSelectedSidePanelListItemState.atom, false); }), ); }, [store]); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useUpdateCommandMenuPageInfo.ts b/packages/twenty-front/src/modules/command-menu/hooks/useUpdateCommandMenuPageInfo.ts deleted file mode 100644 index 2243ee3b65..0000000000 --- a/packages/twenty-front/src/modules/command-menu/hooks/useUpdateCommandMenuPageInfo.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { useCallback } from 'react'; -import { type IconComponent, IconDotsVertical } from 'twenty-ui/display'; -import { useStore } from 'jotai'; - -export const useUpdateCommandMenuPageInfo = () => { - const store = useStore(); - const updateCommandMenuPageInfo = useCallback( - ({ - pageTitle, - pageIcon, - }: { - pageTitle?: string; - pageIcon?: IconComponent; - }) => { - const commandMenuPageInfo = store.get(commandMenuPageInfoState.atom); - - const newCommandMenuPageInfo = { - ...commandMenuPageInfo, - title: pageTitle ?? commandMenuPageInfo.title ?? '', - Icon: pageIcon ?? commandMenuPageInfo.Icon ?? IconDotsVertical, - }; - - store.set(commandMenuPageInfoState.atom, newCommandMenuPageInfo); - - const commandMenuNavigationStack = store.get( - commandMenuNavigationStackState.atom, - ); - - const lastCommandMenuNavigationStackItem = - commandMenuNavigationStack.at(-1); - - if (!lastCommandMenuNavigationStackItem) { - return; - } - - const newCommandMenuNavigationStack = [ - ...commandMenuNavigationStack.slice(0, -1), - { - page: lastCommandMenuNavigationStackItem.page, - pageTitle: newCommandMenuPageInfo.title, - pageIcon: newCommandMenuPageInfo.Icon, - pageId: lastCommandMenuNavigationStackItem.pageId, - }, - ]; - - store.set( - commandMenuNavigationStackState.atom, - newCommandMenuNavigationStack, - ); - }, - [store], - ); - - return { - updateCommandMenuPageInfo, - }; -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState.ts deleted file mode 100644 index b236a5d52f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; - -export const viewableFrontComponentIdComponentState = createAtomComponentState< - string | null ->({ - key: 'command-menu/viewable-front-component-id', - defaultValue: null, - componentInstanceContext: CommandMenuPageComponentInstanceContext, -}); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemPage.tsx b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemPage.tsx deleted file mode 100644 index bdd2ae8460..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemPage.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { useState } from 'react'; - -import { CommandMenuNewSidebarItemMainMenu } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemMainMenu'; -import { CommandMenuNewSidebarItemObjectFlow } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemObjectFlow'; -import { CommandMenuNewSidebarItemRecordSubView } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemRecordSubView'; -import { CommandMenuNewSidebarItemViewFlow } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewFlow'; - -type SelectedOption = 'object' | 'record' | 'view' | null; - -export const CommandMenuNewSidebarItemPage = () => { - const [selectedOption, setSelectedOption] = useState(null); - - const handleBackToMain = () => { - setSelectedOption(null); - }; - - switch (selectedOption) { - case 'view': - return ; - case 'object': - return ; - case 'record': - return ( - - ); - default: - return ( - setSelectedOption('record')} - onSelectObject={() => setSelectedOption('object')} - onSelectView={() => setSelectedOption('view')} - /> - ); - } -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds.ts b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds.ts deleted file mode 100644 index 596de726f4..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { CommandMenuNavigationItemActions } from '@/command-menu/pages/navigation-menu-item/command-menu-navigation-item-actions'; - -const ORGANIZE_ACTIONS_WITHOUT_MOVE_TO_FOLDER: CommandMenuNavigationItemActions[] = - [ - CommandMenuNavigationItemActions.MOVE_UP, - CommandMenuNavigationItemActions.MOVE_DOWN, - CommandMenuNavigationItemActions.ADD_BEFORE, - CommandMenuNavigationItemActions.ADD_AFTER, - CommandMenuNavigationItemActions.REMOVE, - ]; - -const ORGANIZE_ACTIONS_WITH_MOVE_TO_FOLDER: CommandMenuNavigationItemActions[] = - [ - CommandMenuNavigationItemActions.MOVE_UP, - CommandMenuNavigationItemActions.MOVE_DOWN, - CommandMenuNavigationItemActions.MOVE_TO_FOLDER, - CommandMenuNavigationItemActions.ADD_BEFORE, - CommandMenuNavigationItemActions.ADD_AFTER, - CommandMenuNavigationItemActions.REMOVE, - ]; - -export const getOrganizeActionsSelectableItemIds = ( - includeMoveToFolder: boolean, -): CommandMenuNavigationItemActions[] => - includeMoveToFolder - ? ORGANIZE_ACTIONS_WITH_MOVE_TO_FOLDER - : ORGANIZE_ACTIONS_WITHOUT_MOVE_TO_FOLDER; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/AggregateChartSettings.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/AggregateChartSettings.ts deleted file mode 100644 index b21b917805..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/AggregateChartSettings.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { CHART_SETTINGS_HEADINGS } from '@/command-menu/pages/page-layout/constants/ChartSettingsHeadings'; -import { CHART_DATA_SOURCE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting'; -import { DATA_DISPLAY_AGGREGATE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataDisplayAggregateSetting'; -import { FILTER_SETTING } from '@/command-menu/pages/page-layout/constants/settings/FilterSetting'; -import { PREFIX_SETTING } from '@/command-menu/pages/page-layout/constants/settings/PrefixSetting'; -import { SUFFIX_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SuffixSetting'; -import { type ChartSettingsGroup } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; - -export const AGGREGATE_CHART_SETTINGS: ChartSettingsGroup[] = [ - { - heading: CHART_SETTINGS_HEADINGS.DATA, - items: [ - CHART_DATA_SOURCE_SETTING, - FILTER_SETTING, - DATA_DISPLAY_AGGREGATE_SETTING, - ], - }, - { - heading: CHART_SETTINGS_HEADINGS.STYLE, - items: [PREFIX_SETTING, SUFFIX_SETTING], - }, -]; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/GaugeChartSettings.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/GaugeChartSettings.ts deleted file mode 100644 index 6a7c80ad27..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/GaugeChartSettings.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { CHART_SETTINGS_HEADINGS } from '@/command-menu/pages/page-layout/constants/ChartSettingsHeadings'; -import { CHART_DATA_SOURCE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting'; -import { DATA_LABELS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataLabelsSetting'; -import { FILTER_SETTING } from '@/command-menu/pages/page-layout/constants/settings/FilterSetting'; -import { type ChartSettingsGroup } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; - -export const GAUGE_CHART_SETTINGS: ChartSettingsGroup[] = [ - { - heading: CHART_SETTINGS_HEADINGS.DATA, - items: [CHART_DATA_SOURCE_SETTING, FILTER_SETTING], - }, - { - heading: CHART_SETTINGS_HEADINGS.STYLE, - items: [DATA_LABELS_SETTING], - }, -]; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/LineChartSettings.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/LineChartSettings.ts deleted file mode 100644 index 4098bf7541..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/LineChartSettings.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { CHART_SETTINGS_HEADINGS } from '@/command-menu/pages/page-layout/constants/ChartSettingsHeadings'; -import { AXIS_NAME_SETTING } from '@/command-menu/pages/page-layout/constants/settings/AxisNameSetting'; -import { CHART_DATA_SOURCE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting'; -import { COLORS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ColorsSetting'; -import { CUMULATIVE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/CumulativeSetting'; -import { DATA_DISPLAY_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataDisplayXSetting'; -import { DATA_DISPLAY_Y_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataDisplayYSetting'; -import { DATA_LABELS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataLabelsSetting'; -import { DATE_GRANULARITY_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DateGranularityXSetting'; -import { DATE_GRANULARITY_Y_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DateGranularityYSetting'; -import { FILTER_SETTING } from '@/command-menu/pages/page-layout/constants/settings/FilterSetting'; -import { GROUP_BY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/GroupBySetting'; -import { OMIT_NULL_VALUES_SETTING } from '@/command-menu/pages/page-layout/constants/settings/OmitNullValuesSetting'; -import { PRIMARY_SORT_BY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/PrimarySortBySetting'; -import { RANGE_MAX_SETTING } from '@/command-menu/pages/page-layout/constants/settings/RangeMaxSetting'; -import { RANGE_MIN_SETTING } from '@/command-menu/pages/page-layout/constants/settings/RangeMinSetting'; -import { SHOW_LEGEND_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ShowLegendSetting'; -import { SORT_BY_GROUP_BY_FIELD_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SortByGroupByFieldSetting'; -import { SPLIT_MULTI_VALUE_FIELDS_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting'; -import { SPLIT_MULTI_VALUE_FIELDS_Y_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting'; -import { STACKED_LINES_SETTING } from '@/command-menu/pages/page-layout/constants/settings/StackedLineSettings'; -import { type ChartSettingsGroup } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; - -export const LINE_CHART_SETTINGS: ChartSettingsGroup[] = [ - { - heading: CHART_SETTINGS_HEADINGS.DATA, - items: [CHART_DATA_SOURCE_SETTING, FILTER_SETTING], - }, - { - heading: CHART_SETTINGS_HEADINGS.X_AXIS, - items: [ - DATA_DISPLAY_X_SETTING, - DATE_GRANULARITY_X_SETTING, - PRIMARY_SORT_BY_SETTING, - OMIT_NULL_VALUES_SETTING, - SPLIT_MULTI_VALUE_FIELDS_X_SETTING, - ], - }, - { - heading: CHART_SETTINGS_HEADINGS.Y_AXIS, - items: [ - DATA_DISPLAY_Y_SETTING, - GROUP_BY_SETTING, - DATE_GRANULARITY_Y_SETTING, - SORT_BY_GROUP_BY_FIELD_SETTING, - CUMULATIVE_SETTING, - RANGE_MIN_SETTING, - RANGE_MAX_SETTING, - SPLIT_MULTI_VALUE_FIELDS_Y_SETTING, - ], - }, - { - heading: CHART_SETTINGS_HEADINGS.STYLE, - items: [ - COLORS_SETTING, - AXIS_NAME_SETTING, - STACKED_LINES_SETTING, - DATA_LABELS_SETTING, - SHOW_LEGEND_SETTING, - ], - }, -]; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/PieChartSettings.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/PieChartSettings.ts deleted file mode 100644 index ac2dc0cd38..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/PieChartSettings.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { CHART_SETTINGS_HEADINGS } from '@/command-menu/pages/page-layout/constants/ChartSettingsHeadings'; -import { CENTER_METRIC_SETTING } from '@/command-menu/pages/page-layout/constants/settings/CenterMetricSetting'; -import { CHART_DATA_SOURCE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting'; -import { COLORS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ColorsSetting'; -import { DATA_DISPLAY_PIE_CHART_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataDisplayPieChartSetting'; -import { DATA_LABELS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataLabelsSetting'; -import { DATE_GRANULARITY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DateGranularitySetting'; -import { EACH_SLICE_REPRESENTS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/EachSliceRepresentsSetting'; -import { FILTER_SETTING } from '@/command-menu/pages/page-layout/constants/settings/FilterSetting'; -import { HIDE_EMPTY_CATEGORY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/HideEmptyCategorySetting'; -import { PRIMARY_SORT_BY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/PrimarySortBySetting'; -import { SHOW_LEGEND_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ShowLegendSetting'; -import { SPLIT_MULTI_VALUE_FIELDS_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting'; -import { type ChartSettingsGroup } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; - -export const PIE_CHART_SETTINGS: ChartSettingsGroup[] = [ - { - heading: CHART_SETTINGS_HEADINGS.DATA, - items: [ - CHART_DATA_SOURCE_SETTING, - FILTER_SETTING, - DATA_DISPLAY_PIE_CHART_SETTING, - DATE_GRANULARITY_SETTING, - EACH_SLICE_REPRESENTS_SETTING, - PRIMARY_SORT_BY_SETTING, - HIDE_EMPTY_CATEGORY_SETTING, - SPLIT_MULTI_VALUE_FIELDS_X_SETTING, - ], - }, - { - heading: CHART_SETTINGS_HEADINGS.STYLE, - items: [ - COLORS_SETTING, - DATA_LABELS_SETTING, - SHOW_LEGEND_SETTING, - CENTER_METRIC_SETTING, - ], - }, -]; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/AxisNameSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/AxisNameSetting.ts deleted file mode 100644 index f9aee4a4ce..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/AxisNameSetting.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ChartAxisNameSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconGizmo } from 'twenty-ui/display'; - -export const AXIS_NAME_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconGizmo, - label: CHART_CONFIGURATION_SETTING_LABELS.AXIS_NAME, - id: CHART_CONFIGURATION_SETTING_IDS.AXIS_NAME, - DropdownContent: ChartAxisNameSelectionDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/CenterMetricSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/CenterMetricSetting.ts deleted file mode 100644 index 86ebf3b587..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/CenterMetricSetting.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconNumber123 } from 'twenty-ui/display'; - -export const CENTER_METRIC_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconNumber123, - label: CHART_CONFIGURATION_SETTING_LABELS.CENTER_METRIC, - id: CHART_CONFIGURATION_SETTING_IDS.CENTER_METRIC, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting.ts deleted file mode 100644 index eced94ec34..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ChartDataSourceDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconDatabase } from 'twenty-ui/display'; - -export const CHART_DATA_SOURCE_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconDatabase, - label: CHART_CONFIGURATION_SETTING_LABELS.SOURCE, - id: CHART_CONFIGURATION_SETTING_IDS.SOURCE, - DropdownContent: ChartDataSourceDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ColorsSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ColorsSetting.ts deleted file mode 100644 index ede862ffec..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ColorsSetting.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ChartColorSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { IconColorSwatch } from 'twenty-ui/display'; - -export const COLORS_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconColorSwatch, - label: CHART_CONFIGURATION_SETTING_LABELS.COLORS, - id: CHART_CONFIGURATION_SETTING_IDS.COLORS, - DropdownContent: ChartColorSelectionDropdownContent, - dropdownWidth: GenericDropdownContentWidth.ExtraLarge, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/CumulativeSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/CumulativeSetting.ts deleted file mode 100644 index f79cf32f22..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/CumulativeSetting.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconChartBarPopular } from 'twenty-ui/display'; - -export const CUMULATIVE_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconChartBarPopular, - label: CHART_CONFIGURATION_SETTING_LABELS.CUMULATIVE, - id: CHART_CONFIGURATION_SETTING_IDS.CUMULATIVE, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayAggregateSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayAggregateSetting.ts deleted file mode 100644 index 4f297132d3..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayAggregateSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ChartFieldSelectionForAggregateOperationDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconSum } from 'twenty-ui/display'; - -export const DATA_DISPLAY_AGGREGATE_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconSum, - label: CHART_CONFIGURATION_SETTING_LABELS.DATA_ON_DISPLAY_AGGREGATE, - id: CHART_CONFIGURATION_SETTING_IDS.DATA_ON_DISPLAY_AGGREGATE, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], - DropdownContent: ChartFieldSelectionForAggregateOperationDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayPieChartSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayPieChartSetting.ts deleted file mode 100644 index 07218b893d..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayPieChartSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ChartPieFieldSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartPieFieldSelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconChartPie } from 'twenty-ui/display'; - -export const DATA_DISPLAY_PIE_CHART_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconChartPie, - label: CHART_CONFIGURATION_SETTING_LABELS.DATA_ON_DISPLAY_PIE_CHART, - id: CHART_CONFIGURATION_SETTING_IDS.DATA_ON_DISPLAY_PIE_CHART, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], - DropdownContent: ChartPieFieldSelectionDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayXSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayXSetting.ts deleted file mode 100644 index f11ed0ca4a..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayXSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ChartXAxisFieldSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartXAxisFieldSelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconAxisX } from 'twenty-ui/display'; - -export const DATA_DISPLAY_X_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconAxisX, - label: CHART_CONFIGURATION_SETTING_LABELS.DATA_ON_DISPLAY_X, - id: CHART_CONFIGURATION_SETTING_IDS.DATA_ON_DISPLAY_X, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], - DropdownContent: ChartXAxisFieldSelectionDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayYSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayYSetting.ts deleted file mode 100644 index fe0b163a6f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataDisplayYSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ChartFieldSelectionForAggregateOperationDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconAxisY } from 'twenty-ui/display'; - -export const DATA_DISPLAY_Y_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconAxisY, - label: CHART_CONFIGURATION_SETTING_LABELS.DATA_ON_DISPLAY_Y, - id: CHART_CONFIGURATION_SETTING_IDS.DATA_ON_DISPLAY_Y, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], - DropdownContent: ChartFieldSelectionForAggregateOperationDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataLabelsSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataLabelsSetting.ts deleted file mode 100644 index 71066a1af5..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DataLabelsSetting.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconBadge2k } from 'twenty-ui/display'; - -export const DATA_LABELS_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconBadge2k, - label: CHART_CONFIGURATION_SETTING_LABELS.DATA_LABELS, - id: CHART_CONFIGURATION_SETTING_IDS.DATA_LABELS, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularitySetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularitySetting.ts deleted file mode 100644 index 024e9b5901..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularitySetting.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ChartDateGranularitySelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconCalendar } from 'twenty-ui/display'; - -export const DATE_GRANULARITY_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconCalendar, - label: CHART_CONFIGURATION_SETTING_LABELS.DATE_GRANULARITY, - id: CHART_CONFIGURATION_SETTING_IDS.DATE_GRANULARITY, - DropdownContent: ChartDateGranularitySelectionDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/EachSliceRepresentsSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/EachSliceRepresentsSetting.ts deleted file mode 100644 index a8064f9dc3..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/EachSliceRepresentsSetting.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ChartFieldSelectionForAggregateOperationDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconChartPie } from 'twenty-ui/display'; - -export const EACH_SLICE_REPRESENTS_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconChartPie, - label: CHART_CONFIGURATION_SETTING_LABELS.EACH_SLICE_REPRESENTS, - id: CHART_CONFIGURATION_SETTING_IDS.EACH_SLICE_REPRESENTS, - DropdownContent: ChartFieldSelectionForAggregateOperationDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/FilterSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/FilterSetting.ts deleted file mode 100644 index 4597ea79ac..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/FilterSetting.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconFilter } from 'twenty-ui/display'; - -export const FILTER_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconFilter, - label: CHART_CONFIGURATION_SETTING_LABELS.FILTER, - id: CHART_CONFIGURATION_SETTING_IDS.FILTER, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/GroupBySetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/GroupBySetting.ts deleted file mode 100644 index 7756201001..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/GroupBySetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ChartGroupByFieldSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconFilters } from 'twenty-ui/display'; - -export const GROUP_BY_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconFilters, - label: CHART_CONFIGURATION_SETTING_LABELS.GROUP_BY, - id: CHART_CONFIGURATION_SETTING_IDS.GROUP_BY, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], - DropdownContent: ChartGroupByFieldSelectionDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/HideEmptyCategorySetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/HideEmptyCategorySetting.ts deleted file mode 100644 index ec879e5d7a..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/HideEmptyCategorySetting.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconEyeOff } from 'twenty-ui/display'; - -export const HIDE_EMPTY_CATEGORY_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconEyeOff, - label: CHART_CONFIGURATION_SETTING_LABELS.HIDE_EMPTY_CATEGORY, - id: CHART_CONFIGURATION_SETTING_IDS.HIDE_EMPTY_CATEGORY, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/OmitNullValuesSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/OmitNullValuesSetting.ts deleted file mode 100644 index 4cd1f1412c..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/OmitNullValuesSetting.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconEyeOff } from 'twenty-ui/display'; - -export const OMIT_NULL_VALUES_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconEyeOff, - label: CHART_CONFIGURATION_SETTING_LABELS.OMIT_NULL_VALUES, - id: CHART_CONFIGURATION_SETTING_IDS.OMIT_NULL_VALUES, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/PrefixSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/PrefixSetting.ts deleted file mode 100644 index 8d811ce0d0..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/PrefixSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { msg } from '@lingui/core/macro'; -import { IconCaretLeft } from 'twenty-ui/display'; - -export const PREFIX_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconCaretLeft, - label: CHART_CONFIGURATION_SETTING_LABELS.PREFIX, - id: CHART_CONFIGURATION_SETTING_IDS.PREFIX, - isTextInput: true, - inputPlaceholder: msg`unit`, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/PrimarySortBySetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/PrimarySortBySetting.ts deleted file mode 100644 index 89c05c36b7..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/PrimarySortBySetting.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ChartSortBySelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconArrowsSort } from 'twenty-ui/display'; - -export const PRIMARY_SORT_BY_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconArrowsSort, - label: CHART_CONFIGURATION_SETTING_LABELS.PRIMARY_SORT_BY, - id: CHART_CONFIGURATION_SETTING_IDS.PRIMARY_SORT_BY, - DropdownContent: ChartSortBySelectionDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/RangeMaxSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/RangeMaxSetting.ts deleted file mode 100644 index c5de8e07d8..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/RangeMaxSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { msg } from '@lingui/core/macro'; -import { IconMathMax } from 'twenty-ui/display'; - -export const RANGE_MAX_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconMathMax, - label: CHART_CONFIGURATION_SETTING_LABELS.MAX_RANGE, - id: CHART_CONFIGURATION_SETTING_IDS.MAX_RANGE, - isNumberInput: true, - inputPlaceholder: msg`Max`, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/RangeMinSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/RangeMinSetting.ts deleted file mode 100644 index d483d38955..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/RangeMinSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { msg } from '@lingui/core/macro'; -import { IconMathMin } from 'twenty-ui/display'; - -export const RANGE_MIN_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconMathMin, - label: CHART_CONFIGURATION_SETTING_LABELS.MIN_RANGE, - id: CHART_CONFIGURATION_SETTING_IDS.MIN_RANGE, - isNumberInput: true, - inputPlaceholder: msg`Min`, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ShowLegendSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ShowLegendSetting.ts deleted file mode 100644 index 40e5d1048f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ShowLegendSetting.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconTextCaption } from 'twenty-ui/display'; - -export const SHOW_LEGEND_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconTextCaption, - label: CHART_CONFIGURATION_SETTING_LABELS.SHOW_LEGEND, - id: CHART_CONFIGURATION_SETTING_IDS.SHOW_LEGEND, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.GROUP_BY], -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SortByGroupByFieldSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SortByGroupByFieldSetting.ts deleted file mode 100644 index 131b342d1f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SortByGroupByFieldSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ChartSortByGroupByFieldDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconArrowsSort } from 'twenty-ui/display'; - -export const SORT_BY_GROUP_BY_FIELD_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconArrowsSort, - label: CHART_CONFIGURATION_SETTING_LABELS.SORT_BY_GROUP_BY_FIELD, - id: CHART_CONFIGURATION_SETTING_IDS.SORT_BY_GROUP_BY_FIELD, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.GROUP_BY], - DropdownContent: ChartSortByGroupByFieldDropdownContent, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting.ts deleted file mode 100644 index 03ec1291e5..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconArrowsSplit2 } from 'twenty-ui/display'; - -export const SPLIT_MULTI_VALUE_FIELDS_X_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconArrowsSplit2, - label: CHART_CONFIGURATION_SETTING_LABELS.SPLIT_MULTI_VALUE_FIELDS_X, - id: CHART_CONFIGURATION_SETTING_IDS.SPLIT_MULTI_VALUE_FIELDS_X, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting.ts deleted file mode 100644 index 4634cb0070..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconArrowsSplit2 } from 'twenty-ui/display'; - -export const SPLIT_MULTI_VALUE_FIELDS_Y_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconArrowsSplit2, - label: CHART_CONFIGURATION_SETTING_LABELS.SPLIT_MULTI_VALUE_FIELDS_Y, - id: CHART_CONFIGURATION_SETTING_IDS.SPLIT_MULTI_VALUE_FIELDS_Y, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/StackedBarsSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/StackedBarsSetting.ts deleted file mode 100644 index 2d886cafa1..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/StackedBarsSetting.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconStack2 } from 'twenty-ui/display'; - -export const STACKED_BARS_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconStack2, - label: CHART_CONFIGURATION_SETTING_LABELS.STACKED_BARS, - id: CHART_CONFIGURATION_SETTING_IDS.STACKED_BARS, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.GROUP_BY], -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/StackedLineSettings.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/StackedLineSettings.ts deleted file mode 100644 index da76d6aff6..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/StackedLineSettings.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconStack2 } from 'twenty-ui/display'; - -export const STACKED_LINES_SETTING: ChartSettingsItem = { - isBoolean: true, - Icon: IconStack2, - label: CHART_CONFIGURATION_SETTING_LABELS.STACKED_LINES, - id: CHART_CONFIGURATION_SETTING_IDS.STACKED_LINES, - dependsOn: [CHART_CONFIGURATION_SETTING_IDS.GROUP_BY], -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SuffixSetting.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SuffixSetting.ts deleted file mode 100644 index 0ef23c709d..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/SuffixSetting.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { msg } from '@lingui/core/macro'; -import { IconCaretRight } from 'twenty-ui/display'; - -export const SUFFIX_SETTING: ChartSettingsItem = { - isBoolean: false, - Icon: IconCaretRight, - label: CHART_CONFIGURATION_SETTING_LABELS.SUFFIX, - id: CHART_CONFIGURATION_SETTING_IDS.SUFFIX, - isTextInput: true, - inputPlaceholder: msg`unit`, -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu.ts deleted file mode 100644 index 9461644602..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { type PageLayoutCommandMenuPage } from '@/command-menu/pages/page-layout/types/PageLayoutCommandMenuPage'; -import { getPageLayoutIcon } from '@/command-menu/pages/page-layout/utils/getPageLayoutIcon'; -import { getPageLayoutPageTitle } from '@/command-menu/pages/page-layout/utils/getPageLayoutPageTitle'; -import { useCallback } from 'react'; -import { isDefined } from 'twenty-shared/utils'; -import { type IconComponent } from 'twenty-ui/display'; - -type NavigatePageLayoutCommandMenuProps = { - commandMenuPage: PageLayoutCommandMenuPage; - pageTitle?: string; - pageIcon?: IconComponent; - focusTitleInput?: boolean; - resetNavigationStack?: boolean; -}; - -export const useNavigatePageLayoutCommandMenu = () => { - const { navigateCommandMenu } = useNavigateCommandMenu(); - - const navigatePageLayoutCommandMenu = useCallback( - ({ - commandMenuPage, - pageTitle, - pageIcon, - focusTitleInput = false, - resetNavigationStack = false, - }: NavigatePageLayoutCommandMenuProps) => { - navigateCommandMenu({ - page: commandMenuPage, - pageTitle: isDefined(pageTitle) - ? pageTitle - : getPageLayoutPageTitle(commandMenuPage), - pageIcon: isDefined(pageIcon) - ? pageIcon - : getPageLayoutIcon(commandMenuPage), - focusTitleInput, - resetNavigationStack, - }); - }, - [navigateCommandMenu], - ); - - return { - navigatePageLayoutCommandMenu, - }; -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartWidgetConfiguration.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartWidgetConfiguration.ts deleted file mode 100644 index 2bbd8375a1..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartWidgetConfiguration.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { type TypedAggregateChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedAggregateChartConfiguration'; -import { type TypedBarChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedBarChartConfiguration'; -import { type TypedGaugeChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedGaugeChartConfiguration'; -import { type TypedLineChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedLineChartConfiguration'; -import { type TypedPieChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedPieChartConfiguration'; - -export type ChartWidgetConfiguration = - | TypedBarChartConfiguration - | TypedGaugeChartConfiguration - | TypedLineChartConfiguration - | TypedAggregateChartConfiguration - | TypedPieChartConfiguration; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/PageLayoutCommandMenuPage.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/PageLayoutCommandMenuPage.ts deleted file mode 100644 index 02c64c6a61..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/PageLayoutCommandMenuPage.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { type CommandMenuPages } from 'twenty-shared/types'; - -export type PageLayoutCommandMenuPage = - | CommandMenuPages.PageLayoutWidgetTypeSelect - | CommandMenuPages.PageLayoutGraphTypeSelect - | CommandMenuPages.PageLayoutIframeSettings - | CommandMenuPages.PageLayoutGraphFilter - | CommandMenuPages.PageLayoutTabSettings - | CommandMenuPages.PageLayoutFieldsSettings - | CommandMenuPages.PageLayoutFieldsLayout; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getBarChartSettings.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getBarChartSettings.ts deleted file mode 100644 index 972c19252d..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getBarChartSettings.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { CHART_SETTINGS_HEADINGS } from '@/command-menu/pages/page-layout/constants/ChartSettingsHeadings'; -import { AXIS_NAME_SETTING } from '@/command-menu/pages/page-layout/constants/settings/AxisNameSetting'; -import { CHART_DATA_SOURCE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting'; -import { COLORS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ColorsSetting'; -import { CUMULATIVE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/CumulativeSetting'; -import { DATA_DISPLAY_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataDisplayXSetting'; -import { DATA_DISPLAY_Y_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataDisplayYSetting'; -import { DATA_LABELS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataLabelsSetting'; -import { DATE_GRANULARITY_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DateGranularityXSetting'; -import { DATE_GRANULARITY_Y_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DateGranularityYSetting'; -import { FILTER_SETTING } from '@/command-menu/pages/page-layout/constants/settings/FilterSetting'; -import { GROUP_BY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/GroupBySetting'; -import { OMIT_NULL_VALUES_SETTING } from '@/command-menu/pages/page-layout/constants/settings/OmitNullValuesSetting'; -import { PRIMARY_SORT_BY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/PrimarySortBySetting'; -import { RANGE_MAX_SETTING } from '@/command-menu/pages/page-layout/constants/settings/RangeMaxSetting'; -import { RANGE_MIN_SETTING } from '@/command-menu/pages/page-layout/constants/settings/RangeMinSetting'; -import { SHOW_LEGEND_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ShowLegendSetting'; -import { SORT_BY_GROUP_BY_FIELD_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SortByGroupByFieldSetting'; -import { SPLIT_MULTI_VALUE_FIELDS_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting'; -import { SPLIT_MULTI_VALUE_FIELDS_Y_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting'; -import { STACKED_BARS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/StackedBarsSetting'; -import { type ChartSettingsGroup } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { IconAxisX, IconAxisY } from 'twenty-ui/display'; -import { BarChartLayout } from '~/generated-metadata/graphql'; - -export const getBarChartSettings = ( - layout: BarChartLayout, -): ChartSettingsGroup[] => { - const isHorizontal = layout === BarChartLayout.HORIZONTAL; - - const dataDisplayXIcon = isHorizontal ? IconAxisY : IconAxisX; - const dataDisplayYIcon = isHorizontal ? IconAxisX : IconAxisY; - - const primaryAxisItems = [ - { ...DATA_DISPLAY_X_SETTING, Icon: dataDisplayXIcon }, - DATE_GRANULARITY_X_SETTING, - PRIMARY_SORT_BY_SETTING, - OMIT_NULL_VALUES_SETTING, - SPLIT_MULTI_VALUE_FIELDS_X_SETTING, - ]; - - const secondaryAxisItems = [ - { ...DATA_DISPLAY_Y_SETTING, Icon: dataDisplayYIcon }, - GROUP_BY_SETTING, - DATE_GRANULARITY_Y_SETTING, - SORT_BY_GROUP_BY_FIELD_SETTING, - CUMULATIVE_SETTING, - RANGE_MIN_SETTING, - RANGE_MAX_SETTING, - SPLIT_MULTI_VALUE_FIELDS_Y_SETTING, - ]; - - const xAxisItems = isHorizontal ? secondaryAxisItems : primaryAxisItems; - const yAxisItems = isHorizontal ? primaryAxisItems : secondaryAxisItems; - - return [ - { - heading: CHART_SETTINGS_HEADINGS.DATA, - items: [CHART_DATA_SOURCE_SETTING, FILTER_SETTING], - }, - { - heading: CHART_SETTINGS_HEADINGS.X_AXIS, - items: xAxisItems, - }, - { - heading: CHART_SETTINGS_HEADINGS.Y_AXIS, - items: yAxisItems, - }, - { - heading: CHART_SETTINGS_HEADINGS.STYLE, - items: [ - COLORS_SETTING, - AXIS_NAME_SETTING, - STACKED_BARS_SETTING, - DATA_LABELS_SETTING, - SHOW_LEGEND_SETTING, - ], - }, - ]; -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getPageLayoutIcon.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getPageLayoutIcon.ts deleted file mode 100644 index 53478c30fc..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getPageLayoutIcon.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { type PageLayoutCommandMenuPage } from '@/command-menu/pages/page-layout/types/PageLayoutCommandMenuPage'; -import { CommandMenuPages } from 'twenty-shared/types'; -import { assertUnreachable } from 'twenty-shared/utils'; -import { - IconAppWindow, - IconChartPie, - IconFilter, - IconFrame, - IconLayoutSidebarRight, - IconList, -} from 'twenty-ui/display'; - -export const getPageLayoutIcon = (page: PageLayoutCommandMenuPage) => { - switch (page) { - case CommandMenuPages.PageLayoutWidgetTypeSelect: - return IconAppWindow; - case CommandMenuPages.PageLayoutGraphTypeSelect: - return IconChartPie; - case CommandMenuPages.PageLayoutIframeSettings: - return IconFrame; - case CommandMenuPages.PageLayoutGraphFilter: - return IconFilter; - case CommandMenuPages.PageLayoutTabSettings: - return IconAppWindow; - case CommandMenuPages.PageLayoutFieldsSettings: - return IconList; - case CommandMenuPages.PageLayoutFieldsLayout: - return IconLayoutSidebarRight; - default: - assertUnreachable(page); - } -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getPageLayoutPageTitle.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getPageLayoutPageTitle.ts deleted file mode 100644 index a9c07bd1b1..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getPageLayoutPageTitle.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { type PageLayoutCommandMenuPage } from '@/command-menu/pages/page-layout/types/PageLayoutCommandMenuPage'; -import { t } from '@lingui/core/macro'; -import { CommandMenuPages } from 'twenty-shared/types'; -import { assertUnreachable } from 'twenty-shared/utils'; - -export const getPageLayoutPageTitle = (page: PageLayoutCommandMenuPage) => { - switch (page) { - case CommandMenuPages.PageLayoutWidgetTypeSelect: - return t`Add Widget`; - case CommandMenuPages.PageLayoutGraphTypeSelect: - return t`Select Graph Type`; - case CommandMenuPages.PageLayoutIframeSettings: - return t`iFrame Settings`; - case CommandMenuPages.PageLayoutGraphFilter: - return t`Configure filters`; - case CommandMenuPages.PageLayoutTabSettings: - return t`Tab Settings`; - case CommandMenuPages.PageLayoutFieldsSettings: - return t`Fields Settings`; - case CommandMenuPages.PageLayoutFieldsLayout: - return t`Layout`; - default: - assertUnreachable(page); - } -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordIdComponentState.ts deleted file mode 100644 index 65bd6aa539..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordIdComponentState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; - -export const viewableRecordIdComponentState = createAtomComponentState< - string | null ->({ - key: 'command-menu/viewable-record-id', - defaultValue: null, - componentInstanceContext: CommandMenuPageComponentInstanceContext, -}); diff --git a/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState.ts deleted file mode 100644 index 142dfd69f8..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; - -export const viewableRecordNameSingularComponentState = - createAtomComponentState({ - key: 'command-menu/viewable-record-name-singular', - defaultValue: null, - componentInstanceContext: CommandMenuPageComponentInstanceContext, - }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow.ts deleted file mode 100644 index 2a075cf5b2..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { commandMenuWorkflowIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState'; -import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; -import { isDefined } from 'twenty-shared/utils'; - -export const useCommandMenuWorkflowIdOrThrow = () => { - const commandMenuWorkflowId = useAtomComponentStateValue( - commandMenuWorkflowIdComponentState, - ); - if (!isDefined(commandMenuWorkflowId)) { - throw new Error( - 'Expected commandMenuWorkflowIdComponentState to be defined', - ); - } - - return commandMenuWorkflowId; -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState.ts deleted file mode 100644 index 5682baa76c..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; - -export const commandMenuWorkflowIdComponentState = createAtomComponentState< - string | undefined ->({ - key: 'command-menu/workflow-id', - defaultValue: undefined, - componentInstanceContext: CommandMenuPageComponentInstanceContext, -}); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState.ts deleted file mode 100644 index 426396300f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; - -export const commandMenuWorkflowRunIdComponentState = createAtomComponentState< - string | undefined ->({ - key: 'command-menu/workflow-run-id', - defaultValue: undefined, - componentInstanceContext: CommandMenuPageComponentInstanceContext, -}); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState.ts deleted file mode 100644 index d3f3b3092f..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; - -export const commandMenuWorkflowStepIdComponentState = createAtomComponentState< - string | undefined ->({ - key: 'command-menu/workflow-step-id', - defaultValue: undefined, - componentInstanceContext: CommandMenuPageComponentInstanceContext, -}); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState.ts deleted file mode 100644 index 44914182b3..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; - -export const commandMenuWorkflowVersionIdComponentState = - createAtomComponentState({ - key: 'command-menu/workflow-version-id', - defaultValue: undefined, - componentInstanceContext: CommandMenuPageComponentInstanceContext, - }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/hooks/useCommandMenuWorkflowRunIdOrThrow.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/hooks/useCommandMenuWorkflowRunIdOrThrow.ts deleted file mode 100644 index 998910f035..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/hooks/useCommandMenuWorkflowRunIdOrThrow.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { commandMenuWorkflowRunIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState'; -import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; -import { isDefined } from 'twenty-shared/utils'; - -export const useCommandMenuWorkflowRunIdOrThrow = () => { - const commandMenuWorkflowRunId = useAtomComponentStateValue( - commandMenuWorkflowRunIdComponentState, - ); - if (!isDefined(commandMenuWorkflowRunId)) { - throw new Error( - 'Expected the commandMenuWorkflowRunIdComponentState to be defined.', - ); - } - - return commandMenuWorkflowRunId; -}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/hooks/useCommandMenuWorkflowVersionIdOrThrow.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/hooks/useCommandMenuWorkflowVersionIdOrThrow.ts deleted file mode 100644 index d9a89385fb..0000000000 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/hooks/useCommandMenuWorkflowVersionIdOrThrow.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { commandMenuWorkflowVersionIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState'; -import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; -import { isDefined } from 'twenty-shared/utils'; - -export const useCommandMenuWorkflowVersionIdOrThrow = () => { - const commandMenuWorkflowVersionId = useAtomComponentStateValue( - commandMenuWorkflowVersionIdComponentState, - ); - if (!isDefined(commandMenuWorkflowVersionId)) { - throw new Error( - 'Expected commandMenuWorkflowVersionIdComponentState to be defined', - ); - } - - return commandMenuWorkflowVersionId; -}; diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationStackState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationStackState.ts deleted file mode 100644 index e27fafe9e7..0000000000 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationStackState.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -import { type CommandMenuPages } from 'twenty-shared/types'; -import { type IconComponent } from 'twenty-ui/display'; - -export type CommandMenuNavigationStackItem = { - page: CommandMenuPages; - pageTitle: string; - pageIcon: IconComponent; - pageIconColor?: string; - pageId: string; -}; - -export const commandMenuNavigationStackState = createAtomState< - CommandMenuNavigationStackItem[] ->({ - key: 'command-menu/commandMenuNavigationStackState', - defaultValue: [], -}); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuPageState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuPageState.ts deleted file mode 100644 index 3916210c17..0000000000 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuPageState.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -import { CommandMenuPages } from 'twenty-shared/types'; - -export const commandMenuPageState = createAtomState({ - key: 'command-menu/commandMenuPageState', - defaultValue: CommandMenuPages.Root, -}); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts deleted file mode 100644 index efc7c4e001..0000000000 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const commandMenuSearchState = createAtomState({ - key: 'command-menu/commandMenuSearchState', - defaultValue: '', -}); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuShouldFocusTitleInputComponentState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuShouldFocusTitleInputComponentState.ts deleted file mode 100644 index 1e581ea1dc..0000000000 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuShouldFocusTitleInputComponentState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; - -import { CommandMenuPageComponentInstanceContext } from './contexts/CommandMenuPageComponentInstanceContext'; - -export const commandMenuShouldFocusTitleInputComponentState = - createAtomComponentState({ - key: 'commandMenuShouldFocusTitleInputComponentState', - defaultValue: false, - componentInstanceContext: CommandMenuPageComponentInstanceContext, - }); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuWidthState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuWidthState.ts deleted file mode 100644 index ac05455a8c..0000000000 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuWidthState.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { COMMAND_MENU_CONSTRAINTS } from '@/ui/layout/resizable-panel/constants/CommandMenuConstraints'; -import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; - -export const COMMAND_MENU_WIDTH_VAR = '--command-menu-width'; - -export const commandMenuWidthState = createAtomState({ - key: 'commandMenuWidth', - defaultValue: COMMAND_MENU_CONSTRAINTS.default, - useLocalStorage: true, -}); diff --git a/packages/twenty-front/src/modules/command-menu/states/isCommandMenuOpenedState.ts b/packages/twenty-front/src/modules/command-menu/states/isCommandMenuOpenedState.ts deleted file mode 100644 index eeb1ced2f6..0000000000 --- a/packages/twenty-front/src/modules/command-menu/states/isCommandMenuOpenedState.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; - -export const isCommandMenuOpenedState = createAtomState({ - key: 'command-menu/isCommandMenuOpenedState', - defaultValue: false, -}); diff --git a/packages/twenty-front/src/modules/command-menu/types/CommandMenuAnimationVariant.ts b/packages/twenty-front/src/modules/command-menu/types/CommandMenuAnimationVariant.ts deleted file mode 100644 index f937b80327..0000000000 --- a/packages/twenty-front/src/modules/command-menu/types/CommandMenuAnimationVariant.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { type COMMAND_MENU_ANIMATION_VARIANTS } from '@/command-menu/constants/CommandMenuAnimationVariants'; - -export type CommandMenuAnimationVariant = - keyof typeof COMMAND_MENU_ANIMATION_VARIANTS; diff --git a/packages/twenty-front/src/modules/front-components/components/HeadlessFrontComponentMountRoot.tsx b/packages/twenty-front/src/modules/front-components/components/HeadlessFrontComponentMountRoot.tsx index 6277f9f823..810617f2f2 100644 --- a/packages/twenty-front/src/modules/front-components/components/HeadlessFrontComponentMountRoot.tsx +++ b/packages/twenty-front/src/modules/front-components/components/HeadlessFrontComponentMountRoot.tsx @@ -38,7 +38,7 @@ export const HeadlessFrontComponentMountRoot = () => { } : undefined, layoutType: PageLayoutType.DASHBOARD, - isInRightDrawer: false, + isInSidePanel: false, }} > diff --git a/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts b/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts index 35d82aee2a..6b5e0b5de7 100644 --- a/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts +++ b/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts @@ -7,9 +7,9 @@ import { type AppPath, type EnqueueSnackbarParams } from 'twenty-shared/types'; import { useActionMenuConfirmationModal } from '@/action-menu/confirmation-modal/hooks/useActionMenuConfirmationModal'; import { currentUserState } from '@/auth/states/currentUserState'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState'; import { useRequestApplicationTokenRefresh } from '@/front-components/hooks/useRequestApplicationTokenRefresh'; import { useUnmountHeadlessFrontComponent } from '@/front-components/hooks/useUnmountHeadlessFrontComponent'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; @@ -33,8 +33,8 @@ export const useFrontComponentExecutionContext = ({ frontComponentId, }); const { openConfirmationModal } = useActionMenuConfirmationModal(); - const { navigateCommandMenu } = useNavigateCommandMenu(); - const setCommandMenuSearch = useSetAtomState(commandMenuSearchState); + const { navigateSidePanel } = useNavigateSidePanel(); + const setSidePanelSearch = useSetAtomState(sidePanelSearchState); const { getIcon } = useIcons(); const unmountHeadlessFrontComponent = useUnmountHeadlessFrontComponent(); const { @@ -43,7 +43,7 @@ export const useFrontComponentExecutionContext = ({ enqueueInfoSnackBar, enqueueWarningSnackBar, } = useSnackBar(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const navigate: FrontComponentHostCommunicationApi['navigate'] = async ( to, @@ -61,14 +61,14 @@ export const useFrontComponentExecutionContext = ({ const openSidePanelPage: FrontComponentHostCommunicationApi['openSidePanelPage'] = async ({ page, pageTitle, pageIcon, shouldResetSearchState }) => { - navigateCommandMenu({ + navigateSidePanel({ page, pageTitle, pageIcon: getIcon(pageIcon), }); if (shouldResetSearchState === true) { - setCommandMenuSearch(''); + setSidePanelSearch(''); } }; @@ -130,7 +130,7 @@ export const useFrontComponentExecutionContext = ({ const closeSidePanel: FrontComponentHostCommunicationApi['closeSidePanel'] = async () => { - closeCommandMenu(); + closeSidePanelMenu(); }; const frontComponentHostCommunicationApi: FrontComponentHostCommunicationApi = diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx index 4bbb0c7b4d..0b2b2f3817 100644 --- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx +++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx @@ -1,4 +1,4 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu'; import { isKeyboardShortcutMenuOpenedState } from '@/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedState'; @@ -12,12 +12,12 @@ export const KeyboardShortcutMenu = () => { const isKeyboardShortcutMenuOpened = useAtomStateValue( isKeyboardShortcutMenuOpenedState, ); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); useGlobalHotkeys({ keys: ['shift+?', 'meta+?'], callback: () => { - closeCommandMenu(); + closeSidePanelMenu(); toggleKeyboardShortcutMenu(); }, containsModifier: false, diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx index 5ff55213c5..13f9f06062 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx @@ -1,5 +1,5 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; import { useNavigationMenuItemsDraftState } from '@/navigation-menu-item/hooks/useNavigationMenuItemsDraftState'; import { useSaveNavigationMenuItemsDraft } from '@/navigation-menu-item/hooks/useSaveNavigationMenuItemsDraft'; import { isNavigationMenuInEditModeState } from '@/navigation-menu-item/states/isNavigationMenuInEditModeState'; @@ -13,7 +13,7 @@ import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { styled } from '@linaria/react'; import { useLingui } from '@lingui/react/macro'; import { useContext, useState } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconCheck, useIcons } from 'twenty-ui/display'; import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; @@ -40,8 +40,8 @@ export const NavigationMenuEditModeBar = () => { const { t } = useLingui(); const { getIcon } = useIcons(); const [isSaving, setIsSaving] = useState(false); - const { closeCommandMenu } = useCommandMenu(); - const commandMenuPage = useAtomStateValue(commandMenuPageState); + const { closeSidePanelMenu } = useSidePanelMenu(); + const sidePanelPage = useAtomStateValue(sidePanelPageState); const { enqueueErrorSnackBar } = useSnackBar(); const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftState, @@ -60,10 +60,10 @@ export const NavigationMenuEditModeBar = () => { setSelectedNavigationMenuItemInEditMode(null); setIsNavigationMenuInEditMode(false); const isNavItemPageOpen = - commandMenuPage === CommandMenuPages.NavigationMenuAddItem || - commandMenuPage === CommandMenuPages.NavigationMenuItemEdit; + sidePanelPage === SidePanelPages.NavigationMenuAddItem || + sidePanelPage === SidePanelPages.NavigationMenuItemEdit; if (isNavItemPageOpen) { - closeCommandMenu(); + closeSidePanelMenu(); } }; @@ -84,7 +84,7 @@ export const NavigationMenuEditModeBar = () => { try { await saveDraft(); cancelEditMode(); - closeCommandMenu(); + closeSidePanelMenu(); } catch { enqueueErrorSnackBar({ message: t`Failed to save navigation layout`, diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItems.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItems.tsx index 2a30dc4bb9..35a66dea6e 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItems.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItems.tsx @@ -11,10 +11,10 @@ import { LightIconButton } from 'twenty-ui/input'; import { themeCssVariables } from 'twenty-ui/theme-constants'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; import { FOLDER_ICON_DEFAULT } from '@/navigation-menu-item/constants/FolderIconDefault'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; -import { useOpenNavigationMenuItemInCommandMenu } from '@/navigation-menu-item/hooks/useOpenNavigationMenuItemInCommandMenu'; +import { useOpenNavigationMenuItemInSidePanel } from '@/navigation-menu-item/hooks/useOpenNavigationMenuItemInSidePanel'; import { type NavigationMenuItemClickParams, useWorkspaceSectionItems, @@ -34,7 +34,7 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useStore } from 'jotai'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; const StyledRightIconsContainer = styled.div` @@ -69,9 +69,9 @@ export const WorkspaceNavigationMenuItems = () => { const setOpenNavigationMenuItemFolderIds = useSetAtomState( openNavigationMenuItemFolderIdsState, ); - const { navigateCommandMenu } = useNavigateCommandMenu(); - const { openNavigationMenuItemInCommandMenu } = - useOpenNavigationMenuItemInCommandMenu(); + const { navigateSidePanel } = useNavigateSidePanel(); + const { openNavigationMenuItemInSidePanel } = + useOpenNavigationMenuItemInSidePanel(); const { getIcon } = useIcons(); const loading = useIsPrefetchLoading(); @@ -94,12 +94,12 @@ export const WorkspaceNavigationMenuItems = () => { ? currentOpenFolders : [...currentOpenFolders, id], ); - openNavigationMenuItemInCommandMenu({ + openNavigationMenuItemInSidePanel({ pageTitle: t`Edit folder`, pageIcon: getIcon(item.icon ?? item.Icon ?? FOLDER_ICON_DEFAULT), }); } else if (item.itemType === NavigationMenuItemType.LINK) { - openNavigationMenuItemInCommandMenu({ + openNavigationMenuItemInSidePanel({ pageTitle: t`Edit link`, pageIcon: IconLink, }); @@ -108,7 +108,7 @@ export const WorkspaceNavigationMenuItems = () => { item.itemType === NavigationMenuItemType.VIEW ? item.labelIdentifier : objectMetadataItem.labelSingular; - openNavigationMenuItemInCommandMenu({ + openNavigationMenuItemInSidePanel({ pageTitle, pageIcon: getIcon(objectMetadataItem.icon), }); @@ -121,7 +121,7 @@ export const WorkspaceNavigationMenuItems = () => { ) => { enterEditMode(); setSelectedNavigationMenuItemInEditMode(navigationMenuItemId); - openNavigationMenuItemInCommandMenu({ + openNavigationMenuItemInSidePanel({ pageTitle: objectMetadataItem.labelSingular, pageIcon: getIcon(objectMetadataItem.icon), }); @@ -129,8 +129,8 @@ export const WorkspaceNavigationMenuItems = () => { const handleAddMenuItem = (event?: React.MouseEvent) => { event?.stopPropagation(); - navigateCommandMenu({ - page: CommandMenuPages.NavigationMenuAddItem, + navigateSidePanel({ + page: SidePanelPages.NavigationMenuAddItem, pageTitle: t`New sidebar item`, pageIcon: IconColumnInsertRight, resetNavigationStack: true, diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleAddToNavigationDrop.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleAddToNavigationDrop.ts index 003550c40f..911e4f5b1d 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleAddToNavigationDrop.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleAddToNavigationDrop.ts @@ -12,7 +12,7 @@ import { useAddObjectToNavigationMenuDraft } from '@/navigation-menu-item/hooks/ import { useAddRecordToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddRecordToNavigationMenuDraft'; import { useAddViewToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddViewToNavigationMenuDraft'; import { useNavigationMenuItemsDraftState } from '@/navigation-menu-item/hooks/useNavigationMenuItemsDraftState'; -import { useOpenNavigationMenuItemInCommandMenu } from '@/navigation-menu-item/hooks/useOpenNavigationMenuItemInCommandMenu'; +import { useOpenNavigationMenuItemInSidePanel } from '@/navigation-menu-item/hooks/useOpenNavigationMenuItemInSidePanel'; import { addToNavPayloadRegistryState } from '@/navigation-menu-item/states/addToNavPayloadRegistryState'; import { isNavigationMenuInEditModeState } from '@/navigation-menu-item/states/isNavigationMenuInEditModeState'; import { navigationMenuItemsDraftState } from '@/navigation-menu-item/states/navigationMenuItemsDraftState'; @@ -40,8 +40,8 @@ export const useHandleAddToNavigationDrop = () => { const navigationMenuItemsDraft = useAtomStateValue( navigationMenuItemsDraftState, ); - const { openNavigationMenuItemInCommandMenu } = - useOpenNavigationMenuItemInCommandMenu(); + const { openNavigationMenuItemInSidePanel } = + useOpenNavigationMenuItemInSidePanel(); const { objectMetadataItems } = useObjectMetadataItems(); const coreViews = useAtomStateValue(coreViewsState); const { getIcon } = useIcons(); @@ -92,11 +92,11 @@ export const useHandleAddToNavigationDrop = () => { const openEditForNewNavItem = ( newItemId: string, - options: Parameters[0], + options: Parameters[0], ) => { setIsNavigationMenuInEditMode(true); setSelectedNavigationMenuItemInEditMode(newItemId); - openNavigationMenuItemInCommandMenu(options); + openNavigationMenuItemInSidePanel(options); }; switch (payload.type) { @@ -220,7 +220,7 @@ export const useHandleAddToNavigationDrop = () => { getIcon, navigationMenuItemsDraft, objectMetadataItems, - openNavigationMenuItemInCommandMenu, + openNavigationMenuItemInSidePanel, setOpenNavigationMenuItemFolderIds, setIsNavigationMenuInEditMode, setSelectedNavigationMenuItemInEditMode, diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenAddItemToFolderPage.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenAddItemToFolderPage.ts index 95b28eb60b..cb12604cfd 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenAddItemToFolderPage.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenAddItemToFolderPage.ts @@ -1,8 +1,8 @@ -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; import { addMenuItemInsertionContextState } from '@/navigation-menu-item/states/addMenuItemInsertionContextState'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useLingui } from '@lingui/react/macro'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconColumnInsertRight } from 'twenty-ui/display'; type OpenAddItemToFolderPageParams = { @@ -13,7 +13,7 @@ type OpenAddItemToFolderPageParams = { export const useOpenAddItemToFolderPage = () => { const { t } = useLingui(); - const { navigateCommandMenu } = useNavigateCommandMenu(); + const { navigateSidePanel } = useNavigateSidePanel(); const setAddMenuItemInsertionContext = useSetAtomState( addMenuItemInsertionContextState, ); @@ -27,8 +27,8 @@ export const useOpenAddItemToFolderPage = () => { targetFolderId, targetIndex, }); - navigateCommandMenu({ - page: CommandMenuPages.NavigationMenuAddItem, + navigateSidePanel({ + page: SidePanelPages.NavigationMenuAddItem, pageTitle: t`New sidebar item`, pageIcon: IconColumnInsertRight, resetNavigationStack, diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenNavigationMenuItemInCommandMenu.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenNavigationMenuItemInCommandMenu.ts deleted file mode 100644 index 513b8b118a..0000000000 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenNavigationMenuItemInCommandMenu.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { CommandMenuPages } from 'twenty-shared/types'; -import type { IconComponent } from 'twenty-ui/display'; - -export const useOpenNavigationMenuItemInCommandMenu = () => { - const { navigateCommandMenu } = useNavigateCommandMenu(); - - const openNavigationMenuItemInCommandMenu = ({ - pageTitle, - pageIcon, - focusTitleInput = false, - }: { - pageTitle: string; - pageIcon: IconComponent; - focusTitleInput?: boolean; - }) => { - navigateCommandMenu({ - page: CommandMenuPages.NavigationMenuItemEdit, - pageTitle, - pageIcon, - resetNavigationStack: true, - focusTitleInput, - }); - }; - - return { - openNavigationMenuItemInCommandMenu, - }; -}; diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenNavigationMenuItemInSidePanel.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenNavigationMenuItemInSidePanel.ts new file mode 100644 index 0000000000..d1bdc920e5 --- /dev/null +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useOpenNavigationMenuItemInSidePanel.ts @@ -0,0 +1,29 @@ +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { SidePanelPages } from 'twenty-shared/types'; +import type { IconComponent } from 'twenty-ui/display'; + +export const useOpenNavigationMenuItemInSidePanel = () => { + const { navigateSidePanel } = useNavigateSidePanel(); + + const openNavigationMenuItemInSidePanel = ({ + pageTitle, + pageIcon, + focusTitleInput = false, + }: { + pageTitle: string; + pageIcon: IconComponent; + focusTitleInput?: boolean; + }) => { + navigateSidePanel({ + page: SidePanelPages.NavigationMenuItemEdit, + pageTitle, + pageIcon, + resetNavigationStack: true, + focusTitleInput, + }); + }; + + return { + openNavigationMenuItemInSidePanel, + }; +}; diff --git a/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx b/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx index 8c9ccc6699..7be1c23635 100644 --- a/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx +++ b/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx @@ -1,7 +1,7 @@ import { useCreateNewAIChatThread } from '@/ai/hooks/useCreateNewAIChatThread'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useOpenRecordsSearchPageInCommandMenu } from '@/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useOpenRecordsSearchPageInSidePanel } from '@/side-panel/hooks/useOpenRecordsSearchPageInSidePanel'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePath'; @@ -28,9 +28,9 @@ type NavigationBarItemName = 'main' | 'search' | 'newAIChat'; export const MobileNavigationBar = () => { const navigate = useNavigate(); const { defaultHomePagePath } = useDefaultHomePagePath(); - const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState); - const { closeCommandMenu } = useCommandMenu(); - const { openRecordsSearchPage } = useOpenRecordsSearchPageInCommandMenu(); + const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState); + const { closeSidePanelMenu } = useSidePanelMenu(); + const { openRecordsSearchPage } = useOpenRecordsSearchPageInSidePanel(); const isSettingsPage = useIsSettingsPage(); const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] = useAtomState(isNavigationDrawerExpandedState); @@ -48,7 +48,7 @@ export const MobileNavigationBar = () => { const activeItemName = isNavigationDrawerExpanded ? currentMobileNavigationDrawer - : isCommandMenuOpened + : isSidePanelOpened ? 'search' : 'main'; @@ -61,7 +61,7 @@ export const MobileNavigationBar = () => { name: 'main', Icon: IconList, onClick: () => { - closeCommandMenu(); + closeSidePanelMenu(); setIsNavigationDrawerExpanded( (previousIsOpen) => activeItemName !== 'main' || !previousIsOpen, ); @@ -77,7 +77,7 @@ export const MobileNavigationBar = () => { Icon: IconSearch, onClick: () => { setIsNavigationDrawerExpanded(false); - closeCommandMenu(); + closeSidePanelMenu(); if (isSettingsPage) { const firstObjectMetadataItem = @@ -99,7 +99,7 @@ export const MobileNavigationBar = () => { Icon: IconMessageCirclePlus, onClick: () => { setIsNavigationDrawerExpanded(false); - closeCommandMenu(); + closeSidePanelMenu(); createChatThread(); }, }, diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuColumn.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelColumn.tsx similarity index 79% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuColumn.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelColumn.tsx index 0da8660aa9..f50afda9c0 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuColumn.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelColumn.tsx @@ -8,4 +8,4 @@ const StyledColumn = styled.div` gap: ${themeCssVariables.spacing[1]}; `; -export const AdvancedFilterCommandMenuColumn = StyledColumn; +export const AdvancedFilterSidePanelColumn = StyledColumn; diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelContainer.tsx similarity index 80% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelContainer.tsx index b6e8d57535..5433c29ff2 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelContainer.tsx @@ -1,7 +1,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { AdvancedFilterCommandMenuCreateRootFilterButton } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuCreateRootFilterButton'; -import { AdvancedFilterCommandMenuRecordFilterColumn } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterColumn'; -import { AdvancedFilterCommandMenuRecordFilterGroupColumn } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterGroupColumn'; +import { AdvancedFilterSidePanelCreateRootFilterButton } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelCreateRootFilterButton'; +import { AdvancedFilterSidePanelRecordFilterColumn } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterColumn'; +import { AdvancedFilterSidePanelRecordFilterGroupColumn } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterGroupColumn'; import { AdvancedFilterAddFilterRuleSelect } from '@/object-record/advanced-filter/components/AdvancedFilterAddFilterRuleSelect'; import { useChildRecordFiltersAndRecordFilterGroups } from '@/object-record/advanced-filter/hooks/useChildRecordFiltersAndRecordFilterGroups'; import { AdvancedFilterContext } from '@/object-record/advanced-filter/states/context/AdvancedFilterContext'; @@ -27,7 +27,7 @@ const StyledChildContainer = styled.div` width: 100%; `; -export type AdvancedFilterCommandMenuContainerProps = { +export type AdvancedFilterSidePanelContainerProps = { readonly?: boolean; onUpdate?: () => void; objectMetadataItem: ObjectMetadataItem; @@ -35,13 +35,13 @@ export type AdvancedFilterCommandMenuContainerProps = { isWorkflowFindRecords?: boolean; }; -export const AdvancedFilterCommandMenuContainer = ({ +export const AdvancedFilterSidePanelContainer = ({ readonly, onUpdate, objectMetadataItem, VariablePicker, isWorkflowFindRecords, -}: AdvancedFilterCommandMenuContainerProps) => { +}: AdvancedFilterSidePanelContainerProps) => { const rootRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); @@ -69,14 +69,14 @@ export const AdvancedFilterCommandMenuContainer = ({ isRecordFilterGroupChildARecordFilterGroup( recordFilterGroupChild, ) ? ( - ) : ( - ) : ( - )} diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuCreateRootFilterButton.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelCreateRootFilterButton.tsx similarity index 98% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuCreateRootFilterButton.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelCreateRootFilterButton.tsx index 5345462be9..3779820792 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuCreateRootFilterButton.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelCreateRootFilterButton.tsx @@ -17,7 +17,7 @@ import { IconFilter } from 'twenty-ui/display'; import { Button } from 'twenty-ui/input'; import { v4 } from 'uuid'; -export const AdvancedFilterCommandMenuCreateRootFilterButton = ({ +export const AdvancedFilterSidePanelCreateRootFilterButton = ({ objectMetadataItem, }: { objectMetadataItem: ObjectMetadataItem; diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuFieldSelectDisabled.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelFieldSelectDisabled.tsx similarity index 70% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuFieldSelectDisabled.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelFieldSelectDisabled.tsx index 684eb00ce6..f7760643b7 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuFieldSelectDisabled.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelFieldSelectDisabled.tsx @@ -1,13 +1,13 @@ import { useRecordFilterField } from '@/object-record/advanced-filter/hooks/useRecordFilterField'; import { SelectControl } from '@/ui/input/components/SelectControl'; -type AdvancedFilterCommandMenuFieldSelectDisabledProps = { +type AdvancedFilterSidePanelFieldSelectDisabledProps = { recordFilterId: string; }; -export const AdvancedFilterCommandMenuFieldSelectDisabled = ({ +export const AdvancedFilterSidePanelFieldSelectDisabled = ({ recordFilterId, -}: AdvancedFilterCommandMenuFieldSelectDisabledProps) => { +}: AdvancedFilterSidePanelFieldSelectDisabledProps) => { const { label, icon } = useRecordFilterField(recordFilterId); return ( diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuLogicalOperatorCell.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelLogicalOperatorCell.tsx similarity index 92% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuLogicalOperatorCell.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelLogicalOperatorCell.tsx index 1971f86575..381902574b 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuLogicalOperatorCell.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelLogicalOperatorCell.tsx @@ -26,15 +26,15 @@ const StyledContainer = styled.div` color: ${themeCssVariables.font.color.tertiary}; `; -type AdvancedFilterCommandMenuLogicalOperatorCellProps = { +type AdvancedFilterSidePanelLogicalOperatorCellProps = { index: number; recordFilterGroup: RecordFilterGroup; }; -export const AdvancedFilterCommandMenuLogicalOperatorCell = ({ +export const AdvancedFilterSidePanelLogicalOperatorCell = ({ index, recordFilterGroup, -}: AdvancedFilterCommandMenuLogicalOperatorCellProps) => { +}: AdvancedFilterSidePanelLogicalOperatorCellProps) => { const { readonly } = useContext(AdvancedFilterContext); return ( diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterColumn.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterColumn.tsx similarity index 64% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterColumn.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterColumn.tsx index 974768556f..b21c4d616e 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterColumn.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterColumn.tsx @@ -1,9 +1,9 @@ -import { AdvancedFilterCommandMenuColumn } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuColumn'; -import { AdvancedFilterCommandMenuFieldSelectDisabled } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuFieldSelectDisabled'; -import { AdvancedFilterCommandMenuLogicalOperatorCell } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuLogicalOperatorCell'; +import { AdvancedFilterSidePanelColumn } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelColumn'; +import { AdvancedFilterSidePanelFieldSelectDisabled } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelFieldSelectDisabled'; +import { AdvancedFilterSidePanelLogicalOperatorCell } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelLogicalOperatorCell'; -import { AdvancedFilterCommandMenuRecordFilterOperandSelect } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect'; -import { AdvancedFilterCommandMenuValueFormInput } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormInput'; +import { AdvancedFilterSidePanelRecordFilterOperandSelect } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterOperandSelect'; +import { AdvancedFilterSidePanelValueFormInput } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormInput'; import { AdvancedFilterFieldSelectDropdownButton } from '@/object-record/advanced-filter/components/AdvancedFilterFieldSelectDropdownButton'; import { AdvancedFilterRecordFilterOptionsDropdown } from '@/object-record/advanced-filter/components/AdvancedFilterRecordFilterOptionsDropdown'; import { AdvancedFilterContext } from '@/object-record/advanced-filter/states/context/AdvancedFilterContext'; @@ -22,17 +22,17 @@ const StyledContainer = styled.div` gap: ${themeCssVariables.spacing[1]}; `; -type AdvancedFilterCommandMenuRecordFilterColumnProps = { +type AdvancedFilterSidePanelRecordFilterColumnProps = { recordFilterGroup: RecordFilterGroup; recordFilter: RecordFilter; recordFilterIndex: number; }; -export const AdvancedFilterCommandMenuRecordFilterColumn = ({ +export const AdvancedFilterSidePanelRecordFilterColumn = ({ recordFilterGroup, recordFilter, recordFilterIndex, -}: AdvancedFilterCommandMenuRecordFilterColumnProps) => { +}: AdvancedFilterSidePanelRecordFilterColumnProps) => { const { readonly } = useContext(AdvancedFilterContext); return ( @@ -43,9 +43,9 @@ export const AdvancedFilterCommandMenuRecordFilterColumn = ({ ), }} > - + - @@ -56,7 +56,7 @@ export const AdvancedFilterCommandMenuRecordFilterColumn = ({ )} {readonly ? ( - ) : ( @@ -64,13 +64,13 @@ export const AdvancedFilterCommandMenuRecordFilterColumn = ({ recordFilterId={recordFilter.id} /> )} - - - + ); }; diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterGroupChildren.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterGroupChildren.tsx similarity index 83% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterGroupChildren.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterGroupChildren.tsx index bb50b019c0..0a5bb48c3e 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterGroupChildren.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterGroupChildren.tsx @@ -1,4 +1,4 @@ -import { AdvancedFilterCommandMenuRecordFilterColumn } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterColumn'; +import { AdvancedFilterSidePanelRecordFilterColumn } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterColumn'; import { AdvancedFilterAddFilterRuleSelect } from '@/object-record/advanced-filter/components/AdvancedFilterAddFilterRuleSelect'; import { useChildRecordFiltersAndRecordFilterGroups } from '@/object-record/advanced-filter/hooks/useChildRecordFiltersAndRecordFilterGroups'; @@ -23,13 +23,13 @@ const StyledContainer = styled.div<{ isGrayBackground?: boolean }>` padding: ${themeCssVariables.spacing[2]}; `; -type AdvancedFilterCommandMenuRecordFilterGroupChildrenProps = { +type AdvancedFilterSidePanelRecordFilterGroupChildrenProps = { recordFilterGroupId: string; }; -export const AdvancedFilterCommandMenuRecordFilterGroupChildren = ({ +export const AdvancedFilterSidePanelRecordFilterGroupChildren = ({ recordFilterGroupId, -}: AdvancedFilterCommandMenuRecordFilterGroupChildrenProps) => { +}: AdvancedFilterSidePanelRecordFilterGroupChildrenProps) => { const { readonly } = useContext(AdvancedFilterContext); const { currentRecordFilterGroup, childRecordFilters } = useChildRecordFiltersAndRecordFilterGroups({ @@ -47,7 +47,7 @@ export const AdvancedFilterCommandMenuRecordFilterGroupChildren = ({ return ( {childRecordFilters.map((childRecordFilter, childRecordFilterIndex) => ( - + - @@ -40,9 +40,9 @@ export const AdvancedFilterCommandMenuRecordFilterGroupColumn = ({ /> )} - - + ); }; diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterOperandSelect.tsx similarity index 91% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterOperandSelect.tsx index 49eb6b4a90..0ad8c582cd 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterOperandSelect.tsx @@ -9,13 +9,13 @@ import { t } from '@lingui/core/macro'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; -type AdvancedFilterCommandMenuRecordFilterOperandSelectProps = { +type AdvancedFilterSidePanelRecordFilterOperandSelectProps = { recordFilterId: string; }; -export const AdvancedFilterCommandMenuRecordFilterOperandSelect = ({ +export const AdvancedFilterSidePanelRecordFilterOperandSelect = ({ recordFilterId, -}: AdvancedFilterCommandMenuRecordFilterOperandSelectProps) => { +}: AdvancedFilterSidePanelRecordFilterOperandSelectProps) => { const { readonly, isWorkflowFindRecords } = useContext(AdvancedFilterContext); const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormCompositeFieldInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormCompositeFieldInput.tsx similarity index 98% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormCompositeFieldInput.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormCompositeFieldInput.tsx index 071f221624..6a2e2a968e 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormCompositeFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormCompositeFieldInput.tsx @@ -21,7 +21,7 @@ const ACTOR_SOURCE_OPTIONS: SelectOption[] = Object.values( value: source, })); -export const AdvancedFilterCommandMenuValueFormCompositeFieldInput = ({ +export const AdvancedFilterSidePanelValueFormCompositeFieldInput = ({ recordFilter, onChange, onClear, diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormInput.tsx similarity index 96% rename from packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormInput.tsx rename to packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormInput.tsx index 7d54223493..fd96611817 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormInput.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormInput.tsx @@ -1,5 +1,5 @@ import { formatFieldMetadataItemAsFieldDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsFieldDefinition'; -import { AdvancedFilterCommandMenuValueFormCompositeFieldInput } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormCompositeFieldInput'; +import { AdvancedFilterSidePanelValueFormCompositeFieldInput } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelValueFormCompositeFieldInput'; import { AdvancedFilterContext } from '@/object-record/advanced-filter/states/context/AdvancedFilterContext'; import { getAdvancedFilterObjectFilterDropdownComponentInstanceId } from '@/object-record/advanced-filter/utils/getAdvancedFilterObjectFilterDropdownComponentInstanceId'; import { shouldShowFilterTextInput } from '@/object-record/advanced-filter/utils/shouldShowFilterTextInput'; @@ -31,7 +31,7 @@ import { isDefined, type RelativeDateFilter } from 'twenty-shared/utils'; import { parseBooleanFromStringValue } from 'twenty-shared/workflow'; import { type JsonValue } from 'type-fest'; -export const AdvancedFilterCommandMenuValueFormInput = ({ +export const AdvancedFilterSidePanelValueFormInput = ({ recordFilterId, }: { recordFilterId: string; @@ -152,7 +152,7 @@ export const AdvancedFilterCommandMenuValueFormInput = ({ if (isDefined(subFieldNameUsedInDropdown)) { return ( - { +}: MainContainerLayoutWithSidePanelProps) => { const isMobile = useIsMobile(); useCommandMenuHotKeys(); @@ -60,7 +60,7 @@ export const MainContainerLayoutWithCommandMenu = ({ return ( {children} - + ); }; diff --git a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx index 657621f110..8160063546 100644 --- a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx +++ b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx @@ -1,4 +1,4 @@ -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { getLinkToShowPage } from '@/object-metadata/utils/getLinkToShowPage'; import { useRecordChipData } from '@/object-record/hooks/useRecordChipData'; @@ -55,7 +55,7 @@ export const RecordChip = ({ record, }); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const recordIndexOpenRecordIn = useAtomStateValue( recordIndexOpenRecordInState, @@ -70,7 +70,7 @@ export const RecordChip = ({ ? onClick : isSidePanelViewOpenRecordInType ? (_event: MouseEvent) => { - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId: record.id, objectNameSingular, }); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts index 82b0f0212c..c424ba0839 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts @@ -1,4 +1,4 @@ -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext'; import { useActiveRecordBoardCard } from '@/object-record/record-board/hooks/useActiveRecordBoardCard'; import { useFocusedRecordBoardCard } from '@/object-record/record-board/hooks/useFocusedRecordBoardCard'; @@ -20,7 +20,7 @@ export const useRecordBoardCardHotkeys = (focusId: string) => { RecordBoardCardContext, ); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const { activateBoardCard } = useActiveRecordBoardCard(); const { setRecordAsSelected } = useRecordBoardSelection(); @@ -43,8 +43,8 @@ export const useRecordBoardCardHotkeys = (focusId: string) => { setRecordAsSelected(recordId, !isRecordBoardCardSelected); }; - const handleOpenRecordInCommandMenu = () => { - openRecordInCommandMenu({ + const handleOpenRecordInSidePanel = () => { + openRecordInSidePanel({ recordId, objectNameSingular: objectMetadataItem.nameSingular, isNewRecord: false, @@ -77,9 +77,9 @@ export const useRecordBoardCardHotkeys = (focusId: string) => { `${Key.Control}+${Key.Enter}`, `${Key.Meta}+${Key.Enter}`, ], - callback: handleOpenRecordInCommandMenu, + callback: handleOpenRecordInSidePanel, focusId, - dependencies: [handleOpenRecordInCommandMenu], + dependencies: [handleOpenRecordInSidePanel], }); useHotkeysOnFocusedElement({ diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardDeactivateBoardCardEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardDeactivateBoardCardEffect.tsx index d42769b8bb..e5e8ba8cd1 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardDeactivateBoardCardEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardDeactivateBoardCardEffect.tsx @@ -1,6 +1,6 @@ import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext'; import { useActiveRecordBoardCard } from '@/object-record/record-board/hooks/useActiveRecordBoardCard'; -import { useListenToSidePanelClosing } from '@/ui/layout/right-drawer/hooks/useListenToSidePanelClosing'; +import { useListenToSidePanelClosing } from '@/ui/layout/side-panel/hooks/useListenToSidePanelClosing'; import { useContext } from 'react'; export const RecordBoardDeactivateBoardCardEffect = () => { diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection.tsx index 033f61902e..3f553e66d5 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/RecordDetailDuplicatesSection.tsx @@ -1,4 +1,4 @@ -import { useOpenMergeRecordsPageInCommandMenu } from '@/command-menu/hooks/useOpenMergeRecordsPageInCommandMenu'; +import { useOpenMergeRecordsPageInSidePanel } from '@/side-panel/hooks/useOpenMergeRecordsPageInSidePanel'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { RecordChip } from '@/object-record/components/RecordChip'; import { useFindDuplicateRecords } from '@/object-record/hooks/useFindDuplicateRecords'; @@ -34,8 +34,8 @@ export const RecordDetailDuplicatesSection = ({ objectRecordId, ]; - const { openMergeRecordsPageInCommandMenu } = - useOpenMergeRecordsPageInCommandMenu({ + const { openMergeRecordsPageInSidePanel } = + useOpenMergeRecordsPageInSidePanel({ objectNameSingular, objectRecordIds: duplicateRecordIds, }); @@ -51,7 +51,7 @@ export const RecordDetailDuplicatesSection = ({ className="displayOnHover" Icon={IconArrowMerge} accent="tertiary" - onClick={openMergeRecordsPageInCommandMenu} + onClick={openMergeRecordsPageInSidePanel} /> } > diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/__stories__/RecordDetailDuplicatesSection.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/__stories__/RecordDetailDuplicatesSection.stories.tsx index 49b64aecfe..d6f600a85a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/__stories__/RecordDetailDuplicatesSection.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/duplicate/components/__stories__/RecordDetailDuplicatesSection.stories.tsx @@ -24,7 +24,7 @@ const meta: Meta = { targetObjectNameSingular: 'company', }, layoutType: PageLayoutType.RECORD_PAGE, - isInRightDrawer: false, + isInSidePanel: false, }} > diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToMany.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToMany.tsx index 5ff26ea966..16ea58cf02 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToMany.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToMany.tsx @@ -5,7 +5,7 @@ import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadat import { getFieldMetadataItemById } from '@/object-metadata/utils/getFieldMetadataItemById'; import { useRecordFieldsScopeContextOrThrow } from '@/object-record/record-field-list/contexts/RecordFieldsScopeContext'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; -import { useAddNewRecordAndOpenRightDrawer } from '@/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer'; +import { useAddNewRecordAndOpenSidePanel } from '@/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenSidePanel'; import { useUpdateRelationOneToManyFieldInput } from '@/object-record/record-field/ui/meta-types/input/hooks/useUpdateRelationOneToManyFieldInput'; import { type FieldRelationMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; import { MultipleRecordPicker } from '@/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker'; @@ -118,15 +118,14 @@ export const RecordDetailRelationSectionDropdownToMany = ({ const { updateRelation } = useUpdateRelationOneToManyFieldInput(); - const { createNewRecordAndOpenRightDrawer } = - useAddNewRecordAndOpenRightDrawer({ - fieldMetadataItem, - objectMetadataItem, - relationObjectMetadataNameSingular, - relationObjectMetadataItem, - relationFieldMetadataItem, - recordId, - }); + const { createNewRecordAndOpenSidePanel } = useAddNewRecordAndOpenSidePanel({ + fieldMetadataItem, + objectMetadataItem, + relationObjectMetadataNameSingular, + relationObjectMetadataItem, + relationFieldMetadataItem, + recordId, + }); const handleOpenRelationPickerDropdown = () => { setMultipleRecordPickerSearchableObjectMetadataItems([ @@ -160,7 +159,7 @@ export const RecordDetailRelationSectionDropdownToMany = ({ const handleCreateNew = (searchString?: string) => { closeDropdown(dropdownId); - createNewRecordAndOpenRightDrawer?.(searchString); + createNewRecordAndOpenSidePanel?.(searchString); }; return ( @@ -183,7 +182,7 @@ export const RecordDetailRelationSectionDropdownToMany = ({ focusId={dropdownId} componentInstanceId={dropdownId} onCreate={ - isDefined(createNewRecordAndOpenRightDrawer) + isDefined(createNewRecordAndOpenSidePanel) ? handleCreateNew : undefined } diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToOne.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToOne.tsx index 856a50b4f4..91b2de4234 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToOne.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToOne.tsx @@ -5,7 +5,7 @@ import { CoreObjectNameSingular, FieldMetadataType } from 'twenty-shared/types'; import { useRecordFieldsScopeContextOrThrow } from '@/object-record/record-field-list/contexts/RecordFieldsScopeContext'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { FieldInputEventContext } from '@/object-record/record-field/ui/contexts/FieldInputEventContext'; -import { useAddNewRecordAndOpenRightDrawer } from '@/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer'; +import { useAddNewRecordAndOpenSidePanel } from '@/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenSidePanel'; import { SingleRecordPicker } from '@/object-record/record-picker/single-record-picker/components/SingleRecordPicker'; import { useSingleRecordPickerOpen } from '@/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerOpen'; import { singleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState'; @@ -128,15 +128,14 @@ export const RecordDetailRelationSectionDropdownToOne = ({ onSubmit?.({ newValue: { id: selectedMorphItem.recordId } }); }; - const { createNewRecordAndOpenRightDrawer } = - useAddNewRecordAndOpenRightDrawer({ - fieldMetadataItem, - objectMetadataItem, - relationObjectMetadataNameSingular, - relationObjectMetadataItem, - relationFieldMetadataItem, - recordId, - }); + const { createNewRecordAndOpenSidePanel } = useAddNewRecordAndOpenSidePanel({ + fieldMetadataItem, + objectMetadataItem, + relationObjectMetadataNameSingular, + relationObjectMetadataItem, + relationFieldMetadataItem, + recordId, + }); const { openSingleRecordPicker } = useSingleRecordPickerOpen(); @@ -152,7 +151,7 @@ export const RecordDetailRelationSectionDropdownToOne = ({ const handleCreateNew = (searchString?: string) => { closeDropdown(dropdownId); - createNewRecordAndOpenRightDrawer?.(searchString); + createNewRecordAndOpenSidePanel?.(searchString); }; const shouldAllowCreateNew = diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/__stories__/RecordDetailRelationSection.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/__stories__/RecordDetailRelationSection.stories.tsx index a467ec6c4e..3e6b10aceb 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/__stories__/RecordDetailRelationSection.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/__stories__/RecordDetailRelationSection.stories.tsx @@ -13,7 +13,7 @@ import { RecordDetailRelationSection } from '@/object-record/record-field-list/r import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext'; import { ComponentDecorator } from 'twenty-ui/testing'; import { PageLayoutType } from '~/generated-metadata/graphql'; -import { RightDrawerDecorator } from '~/testing/decorators/RightDrawerDecorator'; +import { SidePanelDecorator } from '~/testing/decorators/SidePanelDecorator'; import { mockedCompanyRecords } from '~/testing/mock-data/generated/data/companies/mock-companies-data'; import { getRecordFromRecordNode } from '@/object-record/cache/utils/getRecordFromRecordNode'; import { mockedPersonRecords } from '~/testing/mock-data/generated/data/people/mock-people-data'; @@ -40,7 +40,7 @@ const meta: Meta = { targetObjectNameSingular: 'company', }, layoutType: PageLayoutType.RECORD_PAGE, - isInRightDrawer: false, + isInSidePanel: false, }} > = { ), - RightDrawerDecorator, + SidePanelDecorator, ComponentDecorator, ObjectMetadataItemsDecorator, SnackBarDecorator, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput.tsx index 5500d67e89..ef4b3510d0 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput.tsx @@ -4,7 +4,7 @@ import { useRelationField } from '@/object-record/record-field/ui/meta-types/hoo import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { getFieldMetadataItemById } from '@/object-metadata/utils/getFieldMetadataItemById'; -import { useAddNewRecordAndOpenRightDrawer } from '@/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer'; +import { useAddNewRecordAndOpenSidePanel } from '@/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenSidePanel'; import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; import { recordFieldInputLayoutDirectionComponentState } from '@/object-record/record-field/ui/states/recordFieldInputLayoutDirectionComponentState'; import { recordFieldInputLayoutDirectionLoadingComponentState } from '@/object-record/record-field/ui/states/recordFieldInputLayoutDirectionLoadingComponentState'; @@ -66,16 +66,15 @@ export const RelationManyToOneFieldInput = () => { ); } - const { createNewRecordAndOpenRightDrawer } = - useAddNewRecordAndOpenRightDrawer({ - fieldMetadataItem, - objectMetadataItem, - relationObjectMetadataNameSingular: - fieldDefinition.metadata.relationObjectMetadataNameSingular, - relationObjectMetadataItem, - relationFieldMetadataItem, - recordId, - }); + const { createNewRecordAndOpenSidePanel } = useAddNewRecordAndOpenSidePanel({ + fieldMetadataItem, + objectMetadataItem, + relationObjectMetadataNameSingular: + fieldDefinition.metadata.relationObjectMetadataNameSingular, + relationObjectMetadataItem, + relationFieldMetadataItem, + recordId, + }); const recordFieldInputLayoutDirection = useAtomComponentStateValue( recordFieldInputLayoutDirectionComponentState, @@ -92,7 +91,7 @@ export const RelationManyToOneFieldInput = () => { ); const handleCreateNew = async (searchInput?: string) => { - const newRecordId = await createNewRecordAndOpenRightDrawer?.(searchInput); + const newRecordId = await createNewRecordAndOpenSidePanel?.(searchInput); if (isDefined(newRecordId)) { setSingleRecordPickerSelectedId(newRecordId); @@ -112,9 +111,7 @@ export const RelationManyToOneFieldInput = () => { emptyLabel={t`No ${fieldLabel}`} onCancel={onCancel} onCreate={ - isDefined(createNewRecordAndOpenRightDrawer) - ? handleCreateNew - : undefined + isDefined(createNewRecordAndOpenSidePanel) ? handleCreateNew : undefined } onMorphItemSelected={handleMorphItemSelected} objectNameSingulars={[ diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput.tsx index 4eaba43bab..f1478b5605 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput.tsx @@ -16,7 +16,7 @@ import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldCont import { FieldInputEventContext } from '@/object-record/record-field/ui/contexts/FieldInputEventContext'; import { useUpdateJunctionRelationFromCell } from '@/object-record/record-field/ui/hooks/useUpdateJunctionRelationFromCell'; import { useRelationField } from '@/object-record/record-field/ui/meta-types/hooks/useRelationField'; -import { useAddNewRecordAndOpenRightDrawer } from '@/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer'; +import { useAddNewRecordAndOpenSidePanel } from '@/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenSidePanel'; import { useUpdateRelationOneToManyFieldInput } from '@/object-record/record-field/ui/meta-types/input/hooks/useUpdateRelationOneToManyFieldInput'; import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; import { recordFieldInputLayoutDirectionComponentState } from '@/object-record/record-field/ui/states/recordFieldInputLayoutDirectionComponentState'; @@ -136,16 +136,15 @@ export const RelationOneToManyFieldInput = () => { ); } - const { createNewRecordAndOpenRightDrawer } = - useAddNewRecordAndOpenRightDrawer({ - fieldMetadataItem, - objectMetadataItem, - relationObjectMetadataNameSingular: - relationFieldDefinition.metadata.relationObjectMetadataNameSingular, - relationObjectMetadataItem, - relationFieldMetadataItem, - recordId, - }); + const { createNewRecordAndOpenSidePanel } = useAddNewRecordAndOpenSidePanel({ + fieldMetadataItem, + objectMetadataItem, + relationObjectMetadataNameSingular: + relationFieldDefinition.metadata.relationObjectMetadataNameSingular, + relationObjectMetadataItem, + relationFieldMetadataItem, + recordId, + }); const { createOneRecord: createTargetRecord } = useCreateOneRecord({ objectNameSingular: @@ -267,8 +266,7 @@ export const RelationOneToManyFieldInput = () => { return; } - const newRecordId = - await createNewRecordAndOpenRightDrawer?.(searchInput); + const newRecordId = await createNewRecordAndOpenSidePanel?.(searchInput); if (isDefined(newRecordId)) { updatePickerState(newRecordId, relationObjectMetadataItem.id, [ @@ -277,7 +275,7 @@ export const RelationOneToManyFieldInput = () => { } }, [ - createNewRecordAndOpenRightDrawer, + createNewRecordAndOpenSidePanel, createTargetRecord, createJunctionRecord, fieldName, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldInput.tsx index b1beee6870..97cfcf7a20 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RichTextFieldInput.tsx @@ -1,5 +1,5 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader'; -import { useRichTextCommandMenu } from '@/command-menu/hooks/useRichTextCommandMenu'; +import { useOpenRichTextInSidePanel } from '@/side-panel/hooks/useOpenRichTextInSidePanel'; import { type CoreObjectNameSingular } from 'twenty-shared/types'; import { useRegisterInputEvents } from '@/object-record/record-field/ui/meta-types/input/hooks/useRegisterInputEvents'; import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; @@ -66,7 +66,7 @@ export const RichTextFieldInput = () => { | CoreObjectNameSingular.Task, }; - const { editRichText } = useRichTextCommandMenu(); + const { openRichTextInSidePanel } = useOpenRichTextInSidePanel(); const containerRef = useRef(null); const instanceId = useAvailableComponentInstanceIdOrThrow( RecordFieldComponentInstanceContext, @@ -104,7 +104,7 @@ export const RichTextFieldInput = () => { size="small" onClick={() => { onEscape?.({ skipPersist: true }); - editRichText( + openRichTextInSidePanel( targetableObject.id, targetableObject.targetObjectNameSingular, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenSidePanel.ts similarity index 85% rename from packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts rename to packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenSidePanel.ts index 1f417587fd..47db6520cc 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenSidePanel.ts @@ -1,22 +1,22 @@ import { v4 } from 'uuid'; import { SEARCH_QUERY } from '@/command-menu/graphql/queries/search'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; -import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; -import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState'; +import { viewableRecordIdState } from '@/object-record/record-side-panel/states/viewableRecordIdState'; +import { viewableRecordNameSingularState } from '@/object-record/record-side-panel/states/viewableRecordNameSingularState'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { buildRecordLabelPayload } from '@/object-record/utils/buildRecordLabelPayload'; import { getOperationName } from '@apollo/client/utilities'; import { computeMorphRelationFieldName, isDefined } from 'twenty-shared/utils'; import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql'; -type useAddNewRecordAndOpenRightDrawerProps = { +type useAddNewRecordAndOpenSidePanelProps = { fieldMetadataItem: FieldMetadataItem; objectMetadataItem: ObjectMetadataItem; relationObjectMetadataNameSingular: string; @@ -25,14 +25,14 @@ type useAddNewRecordAndOpenRightDrawerProps = { recordId: string; }; -export const useAddNewRecordAndOpenRightDrawer = ({ +export const useAddNewRecordAndOpenSidePanel = ({ fieldMetadataItem, objectMetadataItem, relationObjectMetadataNameSingular, relationObjectMetadataItem, relationFieldMetadataItem, recordId, -}: useAddNewRecordAndOpenRightDrawerProps) => { +}: useAddNewRecordAndOpenSidePanelProps) => { const setViewableRecordId = useSetAtomState(viewableRecordIdState); const setViewableRecordNameSingular = useSetAtomState( viewableRecordNameSingularState, @@ -44,7 +44,7 @@ export const useAddNewRecordAndOpenRightDrawer = ({ const { updateOneRecord } = useUpdateOneRecord(); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const apolloCoreClient = useApolloCoreClient(); @@ -53,14 +53,14 @@ export const useAddNewRecordAndOpenRightDrawer = ({ !isDefined(objectMetadataItem.nameSingular) ) { return { - createNewRecordAndOpenRightDrawer: undefined, + createNewRecordAndOpenSidePanel: undefined, }; } const relationFieldMetadataItemRelationType = relationFieldMetadataItem.settings?.relationType; return { - createNewRecordAndOpenRightDrawer: async (searchInput?: string) => { + createNewRecordAndOpenSidePanel: async (searchInput?: string) => { const newRecordId = v4(); const createRecordPayload = buildRecordLabelPayload({ @@ -104,7 +104,7 @@ export const useAddNewRecordAndOpenRightDrawer = ({ include: [getOperationName(SEARCH_QUERY) ?? ''], }); - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId: newRecordId, objectNameSingular: relationObjectMetadataNameSingular, }); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainerGater.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainerGater.tsx index edbdf87899..4eafa3f74c 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainerGater.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainerGater.tsx @@ -3,7 +3,7 @@ import { RecordIndexContextProvider } from '@/object-record/record-index/context import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; import { getActionMenuIdFromRecordIndexId } from '@/action-menu/utils/getActionMenuIdFromRecordIndexId'; import { getObjectPermissionsForObject } from '@/object-metadata/utils/getObjectPermissionsForObject'; -import { MainContainerLayoutWithCommandMenu } from '@/object-record/components/MainContainerLayoutWithCommandMenu'; +import { MainContainerLayoutWithSidePanel } from '@/object-record/components/MainContainerLayoutWithSidePanel'; import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; import { lastShowPageRecordIdState } from '@/object-record/record-field/ui/states/lastShowPageRecordId'; @@ -95,14 +95,14 @@ export const RecordIndexContainerGater = () => { > - + - + diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx index c2cfff8ef8..0778086a91 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx @@ -5,7 +5,7 @@ import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-sto import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; import { RecordIndexPageHeaderIcon } from '@/object-record/record-index/components/RecordIndexPageHeaderIcon'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { PageHeaderToggleCommandMenuButton } from '@/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton'; +import { PageHeaderToggleSidePanelButton } from '@/ui/layout/page-header/components/PageHeaderToggleSidePanelButton'; import { PageHeader } from '@/ui/layout/page/components/PageHeader'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { styled } from '@linaria/react'; @@ -72,7 +72,7 @@ export const RecordIndexPageHeader = () => { {isDefined(contextStoreCurrentViewId) && ( <> - + )} diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts index 9da955b8d3..0ba2924abf 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts @@ -1,5 +1,5 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreRecordShowParentViewComponentState } from '@/context-store/states/contextStoreRecordShowParentViewComponentState'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; @@ -22,7 +22,7 @@ export const useOpenRecordFromIndexView = () => { const { objectNameSingular } = useRecordIndexContextOrThrow(); const navigate = useNavigateApp(); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const isMobile = useIsMobile(); @@ -41,7 +41,7 @@ export const useOpenRecordFromIndexView = () => { recordIndexId, ); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const store = useStore(); @@ -75,13 +75,13 @@ export const useOpenRecordFromIndexView = () => { recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL && canOpenObjectInSidePanel(objectNameSingular) ) { - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId, objectNameSingular, resetNavigationStack: true, }); } else { - closeCommandMenu(); + closeSidePanelMenu(); navigate(AppPath.RecordShowPage, { objectNameSingular, objectRecordId: recordId, @@ -95,9 +95,9 @@ export const useOpenRecordFromIndexView = () => { recordIndexId, objectNameSingular, navigate, - openRecordInCommandMenu, + openRecordInSidePanel, isMobile, - closeCommandMenu, + closeSidePanelMenu, store, ], ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useResetFocusStackToRecordIndex.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useResetFocusStackToRecordIndex.ts index d68a5117fc..cb7b7392dc 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useResetFocusStackToRecordIndex.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useResetFocusStackToRecordIndex.ts @@ -1,4 +1,4 @@ -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { PageFocusId } from '@/types/PageFocusId'; import { useResetFocusStackToFocusItem } from '@/ui/utilities/focus/hooks/useResetFocusStackToFocusItem'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; @@ -10,9 +10,9 @@ export const useResetFocusStackToRecordIndex = () => { const store = useStore(); const resetFocusStackToRecordIndex = () => { - const isCommandMenuOpen = store.get(isCommandMenuOpenedState.atom); + const isSidePanelOpen = store.get(isSidePanelOpenedState.atom); - const shouldEnableGlobalHotkeys = !isCommandMenuOpen; + const shouldEnableGlobalHotkeys = !isSidePanelOpen; resetFocusStackToFocusItem({ focusStackItem: { diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellAnchoredPortal.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellAnchoredPortal.tsx index 9c8bcb497f..fc9b03db19 100644 --- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellAnchoredPortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellAnchoredPortal.tsx @@ -14,7 +14,7 @@ import { FieldFocusContextProvider } from '@/object-record/record-field/ui/conte import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; import { isJunctionRelationForbidden } from '@/object-record/record-field/ui/utils/junction/isJunctionRelationForbidden'; import { RecordInlineCellAnchoredPortalContext } from '@/object-record/record-inline-cell/components/RecordInlineCellAnchoredPortalContext'; -import { RecordInlineCellCloseOnCommandMenuOpeningEffect } from '@/object-record/record-inline-cell/components/RecordInlineCellCloseOnCommandMenuOpeningEffect'; +import { RecordInlineCellCloseOnSidePanelOpeningEffect } from '@/object-record/record-inline-cell/components/RecordInlineCellCloseOnSidePanelOpeningEffect'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; import { createPortal } from 'react-dom'; import { isDefined } from 'twenty-shared/utils'; @@ -123,7 +123,7 @@ export const RecordInlineCellAnchoredPortal = ({ {children} - + , anchorElement, diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellCloseOnCommandMenuOpeningEffect.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellCloseOnSidePanelOpeningEffect.tsx similarity index 72% rename from packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellCloseOnCommandMenuOpeningEffect.tsx rename to packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellCloseOnSidePanelOpeningEffect.tsx index c23a830543..8bf840d9f8 100644 --- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellCloseOnCommandMenuOpeningEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellCloseOnSidePanelOpeningEffect.tsx @@ -1,11 +1,11 @@ import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell'; -import { useListenToSidePanelOpening } from '@/ui/layout/right-drawer/hooks/useListenToSidePanelOpening'; +import { useListenToSidePanelOpening } from '@/ui/layout/side-panel/hooks/useListenToSidePanelOpening'; -// TODO: This is a temporary solution to close the inline cell when the command menu is opened. +// TODO: This is a temporary solution to close the inline cell when the side panel is opened. // This is because the useInlineCell hook doesn't work correctly for field inputs when used outside of the field context. // We should refactor field inputs, and remove this listener afterwards. -// TODO: create a new hook useCloseAnyOpenedFieldInput which uses the focus stack to close all the field inputs, and call it inside openCommandMenu -export const RecordInlineCellCloseOnCommandMenuOpeningEffect = () => { +// TODO: create a new hook useCloseAnyOpenedFieldInput which uses the focus stack to close all the field inputs, and call it inside openSidePanelMenu +export const RecordInlineCellCloseOnSidePanelOpeningEffect = () => { const { closeInlineCell } = useInlineCell(); useListenToSidePanelOpening(closeInlineCell); diff --git a/packages/twenty-front/src/modules/object-record/record-merge/components/MergePreviewTab.tsx b/packages/twenty-front/src/modules/object-record/record-merge/components/MergePreviewTab.tsx index d4cfdca1bd..46dab38975 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/components/MergePreviewTab.tsx +++ b/packages/twenty-front/src/modules/object-record/record-merge/components/MergePreviewTab.tsx @@ -32,14 +32,14 @@ export const MergePreviewTab = ({ targetObjectNameSingular: objectNameSingular, }, layoutType: PageLayoutType.RECORD_PAGE, - isInRightDrawer: true, + isInSidePanel: true, }} >
{getCardComponent(CardType.FieldCard, { diff --git a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordTab.tsx b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordTab.tsx index c085d15c72..8ba8ce3d82 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordTab.tsx +++ b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordTab.tsx @@ -6,7 +6,7 @@ import { Section } from 'twenty-ui/layout'; import { PageLayoutType } from '~/generated-metadata/graphql'; type MergeRecordTabProps = { - isInRightDrawer?: boolean; + isInSidePanel?: boolean; objectNameSingular: string; recordId: string; }; @@ -23,14 +23,14 @@ export const MergeRecordTab = ({ targetObjectNameSingular: objectNameSingular, }, layoutType: PageLayoutType.RECORD_PAGE, - isInRightDrawer: true, + isInSidePanel: true, }} >
{getCardComponent(CardType.FieldCard, { diff --git a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx index 5f852e76b7..018d94ee87 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx @@ -2,13 +2,13 @@ import { styled } from '@linaria/react'; import { themeCssVariables } from 'twenty-ui/theme-constants'; import { ShowPageContainer } from '@/ui/layout/page/components/ShowPageContainer'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { useMergeRecordsSelectedRecords } from '@/object-record/record-merge/hooks/useMergeRecordsSelectedRecords'; import { MergeRecordsTabId } from '@/object-record/record-merge/types/MergeRecordsTabId'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; @@ -51,7 +51,7 @@ export const MergeRecordsContainer = ({ const { tabs } = useMergeRecordsContainerTabs(selectedRecords); const instanceId = useAvailableComponentInstanceIdOrThrow( - CommandMenuPageComponentInstanceContext, + SidePanelPageComponentInstanceContext, ); const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, @@ -59,7 +59,7 @@ export const MergeRecordsContainer = ({ ); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsFooter.tsx b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsFooter.tsx index 4c2896ccc0..b4bb7e2c58 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsFooter.tsx +++ b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsFooter.tsx @@ -1,4 +1,4 @@ -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; import { useMergeRecordsActions } from '@/object-record/record-merge/hooks/useMergeRecordsActions'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { styled } from '@linaria/react'; diff --git a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts index 056d1e6fe3..8cd1f774cf 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts +++ b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts @@ -1,6 +1,6 @@ import { useLingui } from '@lingui/react/macro'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { useMergeManyRecords } from '@/object-record/hooks/useMergeManyRecords'; import { useMergeRecordsSelectedRecords } from '@/object-record/record-merge/hooks/useMergeRecordsSelectedRecords'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; @@ -30,7 +30,7 @@ export const useMergeRecordsActions = ({ const { t } = useLingui(); const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const navigate = useNavigateApp(); const handleMergeRecords = async () => { @@ -51,7 +51,7 @@ export const useMergeRecordsActions = ({ enqueueSuccessSnackBar({ message: t`Successfully merged ${recordCount} records`, }); - closeCommandMenu(); + closeSidePanelMenu(); navigate(AppPath.RecordShowPage, { objectNameSingular, diff --git a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSelectedRecords.ts b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSelectedRecords.ts index 28be68cce1..091059b5a2 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSelectedRecords.ts +++ b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSelectedRecords.ts @@ -1,5 +1,5 @@ -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { recordStoreRecordsSelector } from '@/object-record/record-store/states/selectors/recordStoreRecordsSelector'; import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext'; import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; @@ -7,15 +7,15 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState export const useMergeRecordsSelectedRecords = () => { const mergeRecordsPageInstanceId = useComponentInstanceStateContext( - CommandMenuPageComponentInstanceContext, + SidePanelPageComponentInstanceContext, )?.instanceId; - const commandMenuNavigationMorphItemsByPage = useAtomStateValue( - commandMenuNavigationMorphItemsByPageState, + const sidePanelNavigationMorphItemsByPage = useAtomStateValue( + sidePanelNavigationMorphItemsByPageState, ); const selectedRecordIds = - commandMenuNavigationMorphItemsByPage + sidePanelNavigationMorphItemsByPage .get(mergeRecordsPageInstanceId ?? '') ?.map((morphItem) => morphItem.recordId) ?? []; diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/FieldsCard.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/FieldsCard.tsx index 1d78990c31..1257799bcc 100644 --- a/packages/twenty-front/src/modules/object-record/record-show/components/FieldsCard.tsx +++ b/packages/twenty-front/src/modules/object-record/record-show/components/FieldsCard.tsx @@ -10,9 +10,9 @@ type FieldsCardProps = { export const FieldsCard = ({ configuration }: FieldsCardProps) => { const targetRecord = useTargetRecord(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); - const instanceId = `fields-card-${targetRecord.id}${isInRightDrawer ? '-right-drawer' : ''}`; + const instanceId = `fields-card-${targetRecord.id}${isInSidePanel ? '-side-panel' : ''}`; return ( diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/PageLayoutRecordPageRenderer.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/PageLayoutRecordPageRenderer.tsx index 2745165808..5607ad67ef 100644 --- a/packages/twenty-front/src/modules/object-record/record-show/components/PageLayoutRecordPageRenderer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-show/components/PageLayoutRecordPageRenderer.tsx @@ -1,5 +1,5 @@ -import { RecordShowRightDrawerActionMenu } from '@/action-menu/components/RecordShowRightDrawerActionMenu'; -import { RecordShowRightDrawerOpenRecordButton } from '@/action-menu/components/RecordShowRightDrawerOpenRecordButton'; +import { RecordShowSidePanelActionMenu } from '@/action-menu/components/RecordShowSidePanelActionMenu'; +import { RecordShowSidePanelOpenRecordButton } from '@/action-menu/components/RecordShowSidePanelOpenRecordButton'; import { InformationBannerDeletedRecord } from '@/information-banner/components/deleted-record/InformationBannerDeletedRecord'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { RecordShowContainerContextStoreTargetedRecordsEffect } from '@/object-record/record-show/components/RecordShowContainerContextStoreTargetedRecordsEffect'; @@ -9,7 +9,7 @@ import { PageLayoutRenderer } from '@/page-layout/components/PageLayoutRenderer' import { usePageLayoutIdForRecord } from '@/page-layout/hooks/usePageLayoutIdForRecord'; import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext'; import { type TargetRecordIdentifier } from '@/ui/layout/contexts/TargetRecordIdentifier'; -import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter'; +import { SidePanelFooter } from '@/ui/layout/side-panel/components/SidePanelFooter'; import { styled } from '@linaria/react'; import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; @@ -29,20 +29,20 @@ const StyledShowPageRightContainer = styled.div` overflow: auto; `; -const StyledContentContainer = styled.div<{ isInRightDrawer: boolean }>` +const StyledContentContainer = styled.div<{ isInSidePanel: boolean }>` flex: 1; overflow-y: auto; background: ${themeCssVariables.background.primary}; - padding-bottom: ${({ isInRightDrawer }) => - isInRightDrawer ? themeCssVariables.spacing[16] : 0}; + padding-bottom: ${({ isInSidePanel }) => + isInSidePanel ? themeCssVariables.spacing[16] : 0}; `; export const PageLayoutRecordPageRenderer = ({ targetRecordIdentifier, - isInRightDrawer, + isInSidePanel, }: { targetRecordIdentifier: TargetRecordIdentifier; - isInRightDrawer: boolean; + isInSidePanel: boolean; }) => { const recordDeletedAt = useAtomFamilySelectorValue( recordStoreFamilySelector, @@ -78,7 +78,7 @@ export const PageLayoutRecordPageRenderer = ({ )} - + {isDefined(pageLayoutId) && ( @@ -100,11 +100,11 @@ export const PageLayoutRecordPageRenderer = ({ - {isInRightDrawer && ( - , - , + { const { recordLoading, isPrefetchLoading } = useRecordShowContainerData({ objectRecordId, @@ -51,7 +51,7 @@ export const SummaryCard = ({ const { onUploadPicture } = usePersonAvatarUpload(objectRecordId); - const isMobile = useIsMobile() || isInRightDrawer; + const isMobile = useIsMobile() || isInSidePanel; const recordIdentifier = useAtomFamilySelectorValue( recordStoreIdentifierFamilySelector, diff --git a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts b/packages/twenty-front/src/modules/object-record/record-side-panel/states/viewableRecordIdState.ts similarity index 100% rename from packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts rename to packages/twenty-front/src/modules/object-record/record-side-panel/states/viewableRecordIdState.ts diff --git a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts b/packages/twenty-front/src/modules/object-record/record-side-panel/states/viewableRecordNameSingularState.ts similarity index 100% rename from packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts rename to packages/twenty-front/src/modules/object-record/record-side-panel/states/viewableRecordNameSingularState.ts diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableDeactivateRecordTableRowEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableDeactivateRecordTableRowEffect.tsx index f666a32297..66bc3d4028 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableDeactivateRecordTableRowEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableDeactivateRecordTableRowEffect.tsx @@ -1,5 +1,5 @@ import { useActiveRecordTableRow } from '@/object-record/record-table/hooks/useActiveRecordTableRow'; -import { useListenToSidePanelClosing } from '@/ui/layout/right-drawer/hooks/useListenToSidePanelClosing'; +import { useListenToSidePanelClosing } from '@/ui/layout/side-panel/hooks/useListenToSidePanelClosing'; export const RecordTableDeactivateRecordTableRowEffect = () => { const { deactivateRecordTableRow } = useActiveRecordTableRow(); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewIndexRecord.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewIndexRecord.ts index f8d831bbe6..7592043707 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewIndexRecord.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewIndexRecord.ts @@ -1,5 +1,5 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { getLabelIdentifierFieldMetadataItem } from '@/object-metadata/utils/getLabelIdentifierFieldMetadataItem'; import { useBuildRecordInputFromRLSPredicates } from '@/object-record/hooks/useBuildRecordInputFromRLSPredicates'; @@ -44,9 +44,9 @@ export const useCreateNewIndexRecord = ({ recordIndexGroupFieldMetadataItemComponentState, ); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const { createOneRecord } = useCreateOneRecord({ objectNameSingular: objectMetadataItem.nameSingular, @@ -91,7 +91,7 @@ export const useCreateNewIndexRecord = ({ recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL && canOpenObjectInSidePanel(objectMetadataItem.nameSingular) ) { - openRecordInCommandMenu({ + openRecordInSidePanel({ recordId, objectNameSingular: objectMetadataItem.nameSingular, isNewRecord: true, @@ -100,7 +100,7 @@ export const useCreateNewIndexRecord = ({ const labelIdentifierFieldMetadataItem = getLabelIdentifierFieldMetadataItem(objectMetadataItem); - closeCommandMenu(); + closeSidePanelMenu(); navigate( AppPath.RecordShowPage, { @@ -160,12 +160,12 @@ export const useCreateNewIndexRecord = ({ createOneRecord, navigate, objectMetadataItem, - openRecordInCommandMenu, + openRecordInSidePanel, recordGroupDefinitions, recordIndexGroupFieldMetadataItem, recordIndexRecordIdsByGroupCallbackState, upsertRecordsInStore, - closeCommandMenu, + closeSidePanelMenu, ], ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHotkeysEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHotkeysEffect.tsx index fe424bfb37..f1cadf38e0 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHotkeysEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHotkeysEffect.tsx @@ -10,7 +10,7 @@ import { useRecordTableBodyContextOrThrow } from '@/object-record/record-table/c import { useSelectAllRows } from '@/object-record/record-table/hooks/internal/useSelectAllRows'; import { useFocusedRecordTableRow } from '@/object-record/record-table/hooks/useFocusedRecordTableRow'; import { useOpenRecordTableCellFromCell } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellFromCell'; -import { useListenToSidePanelOpening } from '@/ui/layout/right-drawer/hooks/useListenToSidePanelOpening'; +import { useListenToSidePanelOpening } from '@/ui/layout/side-panel/hooks/useListenToSidePanelOpening'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey'; diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTriggerActionMenuDropdown.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTriggerActionMenuDropdown.ts index 361aa83255..c7c8ffcc97 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTriggerActionMenuDropdown.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTriggerActionMenuDropdown.ts @@ -4,7 +4,7 @@ import { useStore } from 'jotai'; import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; import { recordIndexActionMenuDropdownPositionComponentState } from '@/action-menu/states/recordIndexActionMenuDropdownPositionComponentState'; import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getActionMenuDropdownIdFromActionMenuId'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; @@ -35,7 +35,7 @@ export const useTriggerActionMenuDropdown = ({ ); const { openDropdown } = useOpenDropdown(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const store = useStore(); const triggerActionMenuDropdown = useCallback( @@ -53,7 +53,7 @@ export const useTriggerActionMenuDropdown = ({ store.set(isRowSelectedFamilyState(recordId), true); } - closeCommandMenu(); + closeSidePanelMenu(); openDropdown({ dropdownComponentInstanceIdFromProps: actionMenuDropdownId, @@ -62,7 +62,7 @@ export const useTriggerActionMenuDropdown = ({ [ recordIndexActionMenuDropdownPositionCallbackState, isRowSelectedFamilyState, - closeCommandMenu, + closeSidePanelMenu, openDropdown, actionMenuDropdownId, store, diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts index 3c7d2f1480..731a821eb5 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts @@ -1,4 +1,4 @@ -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { useRecordTableRowContextOrThrow } from '@/object-record/record-table/contexts/RecordTableRowContext'; import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection'; @@ -23,7 +23,7 @@ export const useRecordTableRowHotkeys = (focusId: string) => { const { setCurrentRowSelected } = useSetCurrentRowSelected(); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const { activateRecordTableRow } = useActiveRecordTableRow(); @@ -50,8 +50,8 @@ export const useRecordTableRowHotkeys = (focusId: string) => { }); }; - const handleOpenRecordInCommandMenu = () => { - openRecordInCommandMenu({ + const handleOpenRecordInSidePanel = () => { + openRecordInSidePanel({ recordId: recordId, objectNameSingular: objectNameSingular, isNewRecord: false, @@ -114,9 +114,9 @@ export const useRecordTableRowHotkeys = (focusId: string) => { useHotkeysOnFocusedElement({ keys: [`${Key.Control}+${Key.Enter}`, `${Key.Meta}+${Key.Enter}`], - callback: handleOpenRecordInCommandMenu, + callback: handleOpenRecordInSidePanel, focusId, - dependencies: [handleOpenRecordInCommandMenu], + dependencies: [handleOpenRecordInSidePanel], }); useHotkeysOnFocusedElement({ diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx index 702e6bb508..74562a1eeb 100644 --- a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx @@ -1,10 +1,10 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { UpdateMultipleRecordsFooter } from '@/object-record/record-update-multiple/components/UpdateMultipleRecordsFooter'; import { UpdateMultipleRecordsForm } from '@/object-record/record-update-multiple/components/UpdateMultipleRecordsForm'; import { useUpdateMultipleRecordsActions } from '@/object-record/record-update-multiple/hooks/useUpdateMultipleRecordsActions'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ShowPageContainer } from '@/ui/layout/page/components/ShowPageContainer'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; import { useLingui } from '@lingui/react/macro'; import { useState } from 'react'; @@ -43,7 +43,7 @@ export const UpdateMultipleRecordsContainer = ({ const { t } = useLingui(); const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const [fieldUpdates, setFieldUpdates] = useState( {}, @@ -56,7 +56,7 @@ export const UpdateMultipleRecordsContainer = ({ enqueueSuccessSnackBar({ message: t`Successfully updated ${count} records`, }); - closeCommandMenu(); + closeSidePanelMenu(); } } catch (error) { enqueueErrorSnackBar({ @@ -70,7 +70,7 @@ export const UpdateMultipleRecordsContainer = ({ const handleCancel = () => { cancel(); - closeCommandMenu(); + closeSidePanelMenu(); }; const hasChanges = Object.values(fieldUpdates).some( @@ -85,7 +85,7 @@ export const UpdateMultipleRecordsContainer = ({ }; return ( - + @@ -105,6 +105,6 @@ export const UpdateMultipleRecordsContainer = ({ /> - + ); }; diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsFooter.tsx b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsFooter.tsx index 22e70768f2..2300e6c537 100644 --- a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsFooter.tsx +++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsFooter.tsx @@ -1,5 +1,5 @@ import { computeProgressText } from '@/action-menu/utils/computeProgressText'; -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; import { type ObjectRecordQueryProgress } from '@/object-record/types/ObjectRecordQueryProgress'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { styled } from '@linaria/react'; diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx index 0f36d4421b..3ccb716ca5 100644 --- a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx @@ -58,7 +58,7 @@ const meta: Meta = { actions: [], actionMenuType: 'index-page-action-menu-dropdown', displayType: 'dropdownItem', - isInRightDrawer: true, + isInSidePanel: true, }} > diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutLeftPanel.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutLeftPanel.tsx index ea87c7beff..dfd73f9543 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutLeftPanel.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutLeftPanel.tsx @@ -32,7 +32,7 @@ export const PageLayoutLeftPanel = ({ }: PageLayoutLeftPanelProps) => { const { currentPageLayout } = useCurrentPageLayout(); const targetRecordIdentifier = useTargetRecord(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const pinnedTab = usePageLayoutTabWithVisibleWidgetsOrThrow(pinnedLeftTabId); if (currentPageLayout?.type !== PageLayoutType.RECORD_PAGE) { @@ -49,7 +49,7 @@ export const PageLayoutLeftPanel = ({ { const { currentPageLayout } = useCurrentPageLayout(); - const { isInRightDrawer, layoutType, targetRecordIdentifier } = + const { isInSidePanel, layoutType, targetRecordIdentifier } = useLayoutRenderingContext(); const isPageLayoutInEditMode = useAtomComponentStateValue( @@ -67,7 +67,7 @@ export const PageLayoutRendererContent = () => { const setPageLayoutTabSettingsOpenTabId = useSetAtomComponentState( pageLayoutTabSettingsOpenTabIdComponentState, ); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); const isMobile = useIsMobile(); @@ -81,8 +81,8 @@ export const PageLayoutRendererContent = () => { ? () => { const newTabId = createPageLayoutTab(t`Untitled`); setPageLayoutTabSettingsOpenTabId(newTabId); - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutTabSettings, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutTabSettings, focusTitleInput: true, }); } @@ -95,7 +95,7 @@ export const PageLayoutRendererContent = () => { const tabsWithVisibleWidgets = getTabsWithVisibleWidgets({ tabs: currentPageLayout.tabs, isMobile, - isInRightDrawer, + isInSidePanel, isEditMode: isPageLayoutInEditMode, }); @@ -103,7 +103,7 @@ export const PageLayoutRendererContent = () => { tabs: tabsWithVisibleWidgets, pageLayoutType: currentPageLayout.type, isMobile, - isInRightDrawer, + isInSidePanel, }); const tabListInstanceId = getTabListInstanceIdFromPageLayoutAndRecord({ @@ -132,7 +132,7 @@ export const PageLayoutRendererContent = () => { {(sortedTabs.length > 1 || isPageLayoutInEditMode) && ( { setPageLayoutTabSettingsOpenTabId(tabId); - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutTabSettings, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutTabSettings, resetNavigationStack: true, }); }, - [setPageLayoutTabSettingsOpenTabId, navigatePageLayoutCommandMenu], + [setPageLayoutTabSettingsOpenTabId, navigatePageLayoutSidePanel], ); const isTabSettingsOpen = isDefined(pageLayoutTabSettingsOpenTabId); @@ -324,7 +324,7 @@ export const PageLayoutTabList = ({ value={{ instanceId: componentInstanceId }} > tab.id)} /> diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx index 782af52011..0192fd2e82 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx @@ -27,14 +27,14 @@ export const PageLayoutTabListEffect = ({ ); const isMobile = useIsMobile(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const initialActiveTabId = getPageLayoutTabListInitialActiveTabId({ activeTabId, tabs, defaultTabToFocusOnMobileAndSidePanelId, isMobile, - isInRightDrawer, + isInSidePanel, }); useEffect(() => { diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx index e398c645f7..1f1946fef1 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx @@ -7,7 +7,7 @@ import { Droppable, } from '@hello-pangea/dnd'; -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; import { PAGE_LAYOUT_TAB_LIST_DROPPABLE_IDS } from '@/page-layout/components/PageLayoutTabListDroppableIds'; import { PageLayoutTabListDroppableMoreButton } from '@/page-layout/components/PageLayoutTabListDroppableMoreButton'; import { PageLayoutTabMenuItemSelectAvatar } from '@/page-layout/components/PageLayoutTabMenuItemSelectAvatar'; @@ -27,7 +27,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useContext } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { type PageLayoutType } from '~/generated-metadata/graphql'; import { ThemeContext } from 'twenty-ui/theme-constants'; @@ -96,7 +96,7 @@ export const PageLayoutTabListReorderableOverflowDropdown = ({ pageLayoutId, ); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); const handleClose = () => { if (!isPageLayoutTabDragging) { @@ -112,8 +112,8 @@ export const PageLayoutTabListReorderableOverflowDropdown = ({ const handleEditClick = (tabId: string) => { setPageLayoutTabSettingsOpenTabId(tabId); - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutTabSettings, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutTabSettings, }); onClose(); }; diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListEditor.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListEditor.tsx index 77c0d68d29..129ad8d25f 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListEditor.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListEditor.tsx @@ -56,14 +56,14 @@ export const PageLayoutVerticalListEditor = ({ }: PageLayoutVerticalListEditorProps) => { const droppableId = `page-layout-vertical-list-${useId()}`; - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const isMobile = useIsMobile(); const { isInPinnedTab } = useIsInPinnedTab(); const variant = getPageLayoutVerticalListViewerVariant({ isInPinnedTab, isMobile, - isInRightDrawer, + isInSidePanel, }); const setPageLayoutDraggingWidgetId = useSetAtomComponentState( @@ -85,7 +85,7 @@ export const PageLayoutVerticalListEditor = ({ diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListViewer.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListViewer.tsx index cc882ff2a4..1d5f78d512 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListViewer.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListViewer.tsx @@ -32,20 +32,20 @@ type PageLayoutVerticalListViewerProps = { export const PageLayoutVerticalListViewer = ({ widgets, }: PageLayoutVerticalListViewerProps) => { - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const isMobile = useIsMobile(); const { isInPinnedTab } = useIsInPinnedTab(); const variant = getPageLayoutVerticalListViewerVariant({ isInPinnedTab, isMobile, - isInRightDrawer, + isInSidePanel, }); return ( {widgets.map((widget) => (
diff --git a/packages/twenty-front/src/modules/page-layout/components/__stories__/PageLayoutRenderer.stories.tsx b/packages/twenty-front/src/modules/page-layout/components/__stories__/PageLayoutRenderer.stories.tsx index c9018573bd..95a5180d01 100644 --- a/packages/twenty-front/src/modules/page-layout/components/__stories__/PageLayoutRenderer.stories.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/__stories__/PageLayoutRenderer.stories.tsx @@ -277,7 +277,7 @@ const meta: Meta = { { getPageLayoutVerticalListViewerVariant({ isInPinnedTab: true, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('side-column'); }); @@ -16,17 +16,17 @@ describe('getPageLayoutVerticalListViewerVariant', () => { getPageLayoutVerticalListViewerVariant({ isInPinnedTab: false, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('side-column'); }); - it('should return side-column when isInRightDrawer is true', () => { + it('should return side-column when isInSidePanel is true', () => { expect( getPageLayoutVerticalListViewerVariant({ isInPinnedTab: false, isMobile: false, - isInRightDrawer: true, + isInSidePanel: true, }), ).toBe('side-column'); }); @@ -36,7 +36,7 @@ describe('getPageLayoutVerticalListViewerVariant', () => { getPageLayoutVerticalListViewerVariant({ isInPinnedTab: false, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('default'); }); diff --git a/packages/twenty-front/src/modules/page-layout/components/utils/getPageLayoutVerticalListViewerVariant.ts b/packages/twenty-front/src/modules/page-layout/components/utils/getPageLayoutVerticalListViewerVariant.ts index 8b06737691..be1f33bfcb 100644 --- a/packages/twenty-front/src/modules/page-layout/components/utils/getPageLayoutVerticalListViewerVariant.ts +++ b/packages/twenty-front/src/modules/page-layout/components/utils/getPageLayoutVerticalListViewerVariant.ts @@ -3,15 +3,15 @@ import { type PageLayoutVerticalListViewerVariant } from '@/page-layout/types/Pa type GetPageLayoutVerticalListViewerVariantParams = { isInPinnedTab: boolean; isMobile: boolean; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const getPageLayoutVerticalListViewerVariant = ({ isInPinnedTab, isMobile, - isInRightDrawer, + isInSidePanel, }: GetPageLayoutVerticalListViewerVariantParams): PageLayoutVerticalListViewerVariant => { - if (isInPinnedTab || isMobile || isInRightDrawer) { + if (isInPinnedTab || isMobile || isInSidePanel) { return 'side-column'; } diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreateWidgetFromClick.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreateWidgetFromClick.test.tsx index f9d89093dd..3b4ebcff7e 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreateWidgetFromClick.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreateWidgetFromClick.test.tsx @@ -1,27 +1,27 @@ -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; import { useCreateWidgetFromClick } from '@/page-layout/hooks/useCreateWidgetFromClick'; import { pageLayoutDraggedAreaComponentState } from '@/page-layout/states/pageLayoutDraggedAreaComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { act, renderHook } from '@testing-library/react'; import { type ReactNode } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { PAGE_LAYOUT_TEST_INSTANCE_ID, PageLayoutTestWrapper, } from './PageLayoutTestWrapper'; jest.mock( - '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu', + '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel', ); describe('useCreateWidgetFromClick', () => { - const mockNavigatePageLayoutCommandMenu = jest.fn(); + const mockNavigatePageLayoutSidePanel = jest.fn(); beforeEach(() => { jest.clearAllMocks(); - (useNavigatePageLayoutCommandMenu as jest.Mock).mockReturnValue({ - navigatePageLayoutCommandMenu: mockNavigatePageLayoutCommandMenu, + (useNavigatePageLayoutSidePanel as jest.Mock).mockReturnValue({ + navigatePageLayoutSidePanel: mockNavigatePageLayoutSidePanel, }); }); @@ -51,8 +51,8 @@ describe('useCreateWidgetFromClick', () => { expect(result.current.draggedArea).toEqual({ x: 2, y: 3, w: 1, h: 1 }); expect(result.current.editingWidgetId).toBeNull(); - expect(mockNavigatePageLayoutCommandMenu).toHaveBeenCalledWith({ - commandMenuPage: CommandMenuPages.PageLayoutWidgetTypeSelect, + expect(mockNavigatePageLayoutSidePanel).toHaveBeenCalledWith({ + sidePanelPage: SidePanelPages.PageLayoutWidgetTypeSelect, resetNavigationStack: true, }); }); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useEndPageLayoutDragSelection.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useEndPageLayoutDragSelection.test.tsx index c14ecb9a71..0c8590d06a 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useEndPageLayoutDragSelection.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useEndPageLayoutDragSelection.test.tsx @@ -1,4 +1,4 @@ -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; import { useEndPageLayoutDragSelection } from '@/page-layout/hooks/useEndPageLayoutDragSelection'; import { pageLayoutDraggedAreaComponentState } from '@/page-layout/states/pageLayoutDraggedAreaComponentState'; import { pageLayoutSelectedCellsComponentState } from '@/page-layout/states/pageLayoutSelectedCellsComponentState'; @@ -7,7 +7,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use import { act, renderHook } from '@testing-library/react'; import { createStore } from 'jotai'; import { type ReactNode } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { PAGE_LAYOUT_TEST_INSTANCE_ID, @@ -15,7 +15,7 @@ import { } from './PageLayoutTestWrapper'; jest.mock( - '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu', + '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel', ); jest.mock('../../utils/calculateGridBoundsFromSelectedCells'); @@ -44,12 +44,12 @@ const createTestStore = ( }; describe('useEndPageLayoutDragSelection', () => { - const mockNavigatePageLayoutCommandMenu = jest.fn(); + const mockNavigatePageLayoutSidePanel = jest.fn(); beforeEach(() => { jest.clearAllMocks(); - (useNavigatePageLayoutCommandMenu as jest.Mock).mockReturnValue({ - navigatePageLayoutCommandMenu: mockNavigatePageLayoutCommandMenu, + (useNavigatePageLayoutSidePanel as jest.Mock).mockReturnValue({ + navigatePageLayoutSidePanel: mockNavigatePageLayoutSidePanel, }); }); @@ -101,8 +101,8 @@ describe('useEndPageLayoutDragSelection', () => { expect(result.current.draggedArea).toEqual(mockBounds); expect(result.current.selectedCells.size).toBe(0); - expect(mockNavigatePageLayoutCommandMenu).toHaveBeenCalledWith({ - commandMenuPage: CommandMenuPages.PageLayoutWidgetTypeSelect, + expect(mockNavigatePageLayoutSidePanel).toHaveBeenCalledWith({ + sidePanelPage: SidePanelPages.PageLayoutWidgetTypeSelect, resetNavigationStack: true, }); }); @@ -140,7 +140,7 @@ describe('useEndPageLayoutDragSelection', () => { }); expect(calculateGridBoundsFromSelectedCells).not.toHaveBeenCalled(); - expect(mockNavigatePageLayoutCommandMenu).not.toHaveBeenCalled(); + expect(mockNavigatePageLayoutSidePanel).not.toHaveBeenCalled(); expect(result.current.draggedArea).toBeNull(); expect(result.current.selectedCells.size).toBe(0); }); @@ -180,7 +180,7 @@ describe('useEndPageLayoutDragSelection', () => { expect(calculateGridBoundsFromSelectedCells).toHaveBeenCalledWith([ 'invalid-cell', ]); - expect(mockNavigatePageLayoutCommandMenu).not.toHaveBeenCalled(); + expect(mockNavigatePageLayoutSidePanel).not.toHaveBeenCalled(); expect(result.current.draggedArea).toBeNull(); expect(result.current.selectedCells.size).toBe(0); }); @@ -229,7 +229,7 @@ describe('useEndPageLayoutDragSelection', () => { result.current.endDragSelection.endPageLayoutDragSelection(); }); - expect(mockNavigatePageLayoutCommandMenu).toHaveBeenCalled(); + expect(mockNavigatePageLayoutSidePanel).toHaveBeenCalled(); }); it('should clear selected cells after successful navigation', () => { diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutGraphWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutGraphWidget.ts index 4ae3691cc9..5c6e16fd04 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutGraphWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutGraphWidget.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { useDateTimeFormat } from '@/localization/hooks/useDateTimeFormat'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { pageLayoutCurrentLayoutsComponentState } from '@/page-layout/states/pageLayoutCurrentLayoutsComponentState'; diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCreateWidgetFromClick.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCreateWidgetFromClick.ts index 83fd4f9d98..bdb8fdc591 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCreateWidgetFromClick.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCreateWidgetFromClick.ts @@ -1,11 +1,11 @@ -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; import { pageLayoutDraggedAreaComponentState } from '@/page-layout/states/pageLayoutDraggedAreaComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { parseCellIdToCoordinates } from '@/page-layout/utils/parseCellIdToCoordinates'; import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; export const useCreateWidgetFromClick = () => { const pageLayoutDraggedAreaState = useAtomComponentStateCallbackState( @@ -16,7 +16,7 @@ export const useCreateWidgetFromClick = () => { pageLayoutEditingWidgetIdComponentState, ); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); const store = useStore(); @@ -28,13 +28,13 @@ export const useCreateWidgetFromClick = () => { store.set(pageLayoutDraggedAreaState, bounds); store.set(pageLayoutEditingWidgetIdState, null); - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutWidgetTypeSelect, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutWidgetTypeSelect, resetNavigationStack: true, }); }, [ - navigatePageLayoutCommandMenu, + navigatePageLayoutSidePanel, pageLayoutDraggedAreaState, pageLayoutEditingWidgetIdState, store, diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutWidget.ts index be0775cc49..b0a3071399 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutWidget.ts @@ -1,4 +1,4 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; @@ -26,13 +26,13 @@ export const useDeletePageLayoutWidget = (pageLayoutIdFromProps?: string) => { pageLayoutId, ); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const store = useStore(); const deletePageLayoutWidget = useCallback( (widgetId: string) => { - closeCommandMenu(); + closeSidePanelMenu(); const pageLayoutDraft = store.get(pageLayoutDraftState); const allTabLayouts = store.get(pageLayoutCurrentLayoutsState); @@ -57,7 +57,7 @@ export const useDeletePageLayoutWidget = (pageLayoutIdFromProps?: string) => { } }, [ - closeCommandMenu, + closeSidePanelMenu, pageLayoutCurrentLayoutsState, pageLayoutDraftState, store, diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutTab.ts b/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutTab.ts index 3a9d4c8599..912e211c27 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutTab.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutTab.ts @@ -1,6 +1,6 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; +import { SidePanelPages } from 'twenty-shared/types'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { pageLayoutCurrentLayoutsComponentState } from '@/page-layout/states/pageLayoutCurrentLayoutsComponentState'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; @@ -48,9 +48,9 @@ export const useDuplicatePageLayoutTab = (pageLayoutIdFromProps?: string) => { pageLayoutId, ); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const duplicateTab = useCallback( (tabId: string): string => { @@ -124,14 +124,14 @@ export const useDuplicatePageLayoutTab = (pageLayoutIdFromProps?: string) => { tabs: [...prev.tabs, newTab], }); - closeCommandMenu(); + closeSidePanelMenu(); setActiveTabId(newTabId); setPageLayoutTabSettingsOpenTabId(newTabId); - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutTabSettings, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutTabSettings, pageTitle: newTab.title, focusTitleInput: true, }); @@ -139,8 +139,8 @@ export const useDuplicatePageLayoutTab = (pageLayoutIdFromProps?: string) => { return newTabId; }, [ - closeCommandMenu, - navigatePageLayoutCommandMenu, + closeSidePanelMenu, + navigatePageLayoutSidePanel, pageLayoutCurrentLayouts, pageLayoutDraft, setActiveTabId, diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useEditPageLayoutWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useEditPageLayoutWidget.ts index ea01d45d91..155850ad1c 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useEditPageLayoutWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useEditPageLayoutWidget.ts @@ -1,11 +1,11 @@ import { useCallback } from 'react'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; @@ -24,9 +24,9 @@ export const useEditPageLayoutWidget = (pageLayoutIdFromProps?: string) => { pageLayoutId, ); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); - const { closeCommandMenu } = useCommandMenu(); - const setCommandMenuPage = useSetAtomState(commandMenuPageState); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); + const { closeSidePanelMenu } = useSidePanelMenu(); + const setSidePanelPage = useSetAtomState(sidePanelPageState); const handleEditWidget = useCallback( ({ @@ -39,8 +39,8 @@ export const useEditPageLayoutWidget = (pageLayoutIdFromProps?: string) => { setPageLayoutEditingWidgetId(widgetId); if (widgetType === WidgetType.IFRAME) { - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutIframeSettings, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutIframeSettings, pageTitle: t`Edit iFrame`, resetNavigationStack: true, }); @@ -48,8 +48,8 @@ export const useEditPageLayoutWidget = (pageLayoutIdFromProps?: string) => { } if (widgetType === WidgetType.GRAPH) { - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutGraphTypeSelect, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutGraphTypeSelect, pageTitle: t`Edit Graph`, resetNavigationStack: true, }); @@ -57,22 +57,22 @@ export const useEditPageLayoutWidget = (pageLayoutIdFromProps?: string) => { } if (widgetType === WidgetType.FIELDS) { - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutFieldsSettings, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutFieldsSettings, pageTitle: t`Edit Fields`, resetNavigationStack: true, }); return; } - setCommandMenuPage(CommandMenuPages.Root); - closeCommandMenu(); + setSidePanelPage(SidePanelPages.Root); + closeSidePanelMenu(); }, [ setPageLayoutEditingWidgetId, - navigatePageLayoutCommandMenu, - closeCommandMenu, - setCommandMenuPage, + navigatePageLayoutSidePanel, + closeSidePanelMenu, + setSidePanelPage, ], ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useEndPageLayoutDragSelection.ts b/packages/twenty-front/src/modules/page-layout/hooks/useEndPageLayoutDragSelection.ts index 797af731c3..7d0b48917b 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useEndPageLayoutDragSelection.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useEndPageLayoutDragSelection.ts @@ -1,4 +1,4 @@ -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { pageLayoutDraggedAreaComponentState } from '@/page-layout/states/pageLayoutDraggedAreaComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; @@ -8,7 +8,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; export const useEndPageLayoutDragSelection = ( @@ -33,7 +33,7 @@ export const useEndPageLayoutDragSelection = ( pageLayoutId, ); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); const store = useStore(); @@ -49,8 +49,8 @@ export const useEndPageLayoutDragSelection = ( store.set(pageLayoutDraggedAreaState, draggedBounds); store.set(pageLayoutEditingWidgetIdState, null); - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutWidgetTypeSelect, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutWidgetTypeSelect, resetNavigationStack: true, }); } @@ -58,7 +58,7 @@ export const useEndPageLayoutDragSelection = ( store.set(pageLayoutSelectedCellsState, new Set()); }, [ - navigatePageLayoutCommandMenu, + navigatePageLayoutSidePanel, pageLayoutDraggedAreaState, pageLayoutEditingWidgetIdState, pageLayoutSelectedCellsState, diff --git a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow.ts b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow.ts index b92d35579b..ebf4199510 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow.ts @@ -13,7 +13,7 @@ export const usePageLayoutTabWithVisibleWidgetsOrThrow = ( ): PageLayoutTab => { const { currentPageLayout } = useCurrentPageLayout(); const isMobile = useIsMobile(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); @@ -32,7 +32,7 @@ export const usePageLayoutTabWithVisibleWidgetsOrThrow = ( return tab; } - const context = buildWidgetVisibilityContext({ isMobile, isInRightDrawer }); + const context = buildWidgetVisibilityContext({ isMobile, isInSidePanel }); return { ...tab, diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useSetIsPageLayoutInEditMode.ts b/packages/twenty-front/src/modules/page-layout/hooks/useSetIsPageLayoutInEditMode.ts index 8ea6a2e1e1..bbbbb7c200 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useSetIsPageLayoutInEditMode.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useSetIsPageLayoutInEditMode.ts @@ -1,5 +1,5 @@ -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; @@ -37,12 +37,12 @@ export const useSetIsPageLayoutInEditMode = (pageLayoutIdFromProps: string) => { store.set(currentPageLayoutIdState.atom, value ? pageLayoutId : null); - const isCommandMenuOpened = store.get(isCommandMenuOpenedState.atom); + const isSidePanelOpened = store.get(isSidePanelOpenedState.atom); - if (isCommandMenuOpened) { + if (isSidePanelOpened) { store.set( contextStoreIsPageInEditModeComponentState.atomFamily({ - instanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, + instanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, }), value, ); diff --git a/packages/twenty-front/src/modules/page-layout/utils/__tests__/getPageLayoutTabListInitialActiveTabId.test.ts b/packages/twenty-front/src/modules/page-layout/utils/__tests__/getPageLayoutTabListInitialActiveTabId.test.ts index 2b478ef292..c900d8d97e 100644 --- a/packages/twenty-front/src/modules/page-layout/utils/__tests__/getPageLayoutTabListInitialActiveTabId.test.ts +++ b/packages/twenty-front/src/modules/page-layout/utils/__tests__/getPageLayoutTabListInitialActiveTabId.test.ts @@ -26,7 +26,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'tab-3', isMobile: true, - isInRightDrawer: true, + isInSidePanel: true, }); expect(result).toBe('tab-2'); @@ -38,7 +38,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'tab-3', isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-1'); @@ -46,38 +46,38 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { }); describe('when activeTabId does not exist in tabs', () => { - describe('on mobile or in right drawer', () => { + describe('on mobile or in side panel', () => { it('should return defaultTabToFocusOnMobileAndSidePanelId when on mobile and default exists', () => { const result = getPageLayoutTabListInitialActiveTabId({ activeTabId: 'non-existent-tab', tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'tab-3', isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-3'); }); - it('should return defaultTabToFocusOnMobileAndSidePanelId when in right drawer and default exists', () => { + it('should return defaultTabToFocusOnMobileAndSidePanelId when in side panel and default exists', () => { const result = getPageLayoutTabListInitialActiveTabId({ activeTabId: null, tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'tab-2', isMobile: false, - isInRightDrawer: true, + isInSidePanel: true, }); expect(result).toBe('tab-2'); }); - it('should return defaultTabToFocusOnMobileAndSidePanelId when on mobile and in right drawer', () => { + it('should return defaultTabToFocusOnMobileAndSidePanelId when on mobile and in side panel', () => { const result = getPageLayoutTabListInitialActiveTabId({ activeTabId: null, tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'tab-1', isMobile: true, - isInRightDrawer: true, + isInSidePanel: true, }); expect(result).toBe('tab-1'); @@ -89,7 +89,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'non-existent-tab', isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-1'); @@ -101,21 +101,21 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: undefined, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-1'); }); }); - describe('not on mobile and not in right drawer', () => { + describe('not on mobile and not in side panel', () => { it('should return first tab when default is provided', () => { const result = getPageLayoutTabListInitialActiveTabId({ activeTabId: null, tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'tab-3', isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-1'); @@ -127,7 +127,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: undefined, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-1'); @@ -142,7 +142,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: [], defaultTabToFocusOnMobileAndSidePanelId: 'tab-1', isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe(null); @@ -154,7 +154,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: [], defaultTabToFocusOnMobileAndSidePanelId: 'tab-1', isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe(null); @@ -166,7 +166,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: undefined, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-1'); @@ -180,7 +180,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: singleTab, defaultTabToFocusOnMobileAndSidePanelId: undefined, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('only-tab'); @@ -194,7 +194,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'tab-2', isMobile: true, - isInRightDrawer: true, + isInSidePanel: true, }); expect(result).toBe('tab-1'); @@ -206,7 +206,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'tab-3', isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-3'); @@ -218,7 +218,7 @@ describe('getPageLayoutTabListInitialActiveTabId', () => { tabs: mockTabs, defaultTabToFocusOnMobileAndSidePanelId: 'invalid-tab', isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('tab-1'); diff --git a/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts b/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts index 242e686636..bf550e6298 100644 --- a/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts +++ b/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsByDisplayMode.test.ts @@ -39,7 +39,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.tabsToRenderInTabList).toEqual(tabs); @@ -54,7 +54,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.pinnedLeftTab).toBeUndefined(); @@ -67,7 +67,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.tabsToRenderInTabList).toEqual([]); @@ -82,7 +82,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.tabsToRenderInTabList).toEqual(tabs); @@ -90,7 +90,7 @@ describe('getTabsByDisplayMode', () => { }); }); - describe('when isInRightDrawer is true', () => { + describe('when isInSidePanel is true', () => { it('should return all tabs in tabsToRenderInTabList', () => { const tabs = [ createMockTab('tab-1'), @@ -103,7 +103,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: true, + isInSidePanel: true, }); expect(result.tabsToRenderInTabList).toEqual(tabs); @@ -118,7 +118,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: true, + isInSidePanel: true, }); expect(result.pinnedLeftTab).toBeUndefined(); @@ -131,7 +131,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: true, + isInSidePanel: true, }); expect(result.tabsToRenderInTabList).toEqual([]); @@ -146,7 +146,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: true, + isInSidePanel: true, }); expect(result.tabsToRenderInTabList).toEqual(tabs); @@ -154,7 +154,7 @@ describe('getTabsByDisplayMode', () => { }); }); - describe('when isMobile is false and isInRightDrawer is false', () => { + describe('when isMobile is false and isInSidePanel is false', () => { it('should return first tab as pinnedLeftTab and rest in tabsToRenderInTabList', () => { const tabs = [ createMockTab('tab-1'), @@ -167,7 +167,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.pinnedLeftTab).toBeDefined(); @@ -188,7 +188,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.pinnedLeftTab).toBeDefined(); @@ -202,7 +202,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.pinnedLeftTab).toBeUndefined(); @@ -217,7 +217,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.pinnedLeftTab).toBeUndefined(); @@ -232,7 +232,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.tabsToRenderInTabList).toEqual([]); @@ -247,7 +247,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.pinnedLeftTab?.id).toBe('tab-1'); @@ -265,13 +265,13 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); const resultDesktop = getTabsByDisplayMode({ tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(resultMobile.tabsToRenderInTabList).toEqual(tabs); @@ -289,13 +289,13 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); const resultDesktop = getTabsByDisplayMode({ tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(resultMobile.tabsToRenderInTabList).toEqual(tabs); @@ -314,7 +314,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(pageLayout.tabs).toHaveLength(originalTabsLength); @@ -332,7 +332,7 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result.pinnedLeftTab).toBeUndefined(); @@ -351,13 +351,13 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); const result2 = getTabsByDisplayMode({ tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(result1).toEqual(result2); @@ -371,13 +371,13 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); const desktopResult = getTabsByDisplayMode({ tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(mobileResult.tabsToRenderInTabList.length).toBe(2); @@ -395,13 +395,13 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); const desktopResult = getTabsByDisplayMode({ tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }); expect(mobileResult.tabsToRenderInTabList).toEqual(tabs); @@ -412,7 +412,7 @@ describe('getTabsByDisplayMode', () => { }); }); - describe('when both isMobile and isInRightDrawer are true', () => { + describe('when both isMobile and isInSidePanel are true', () => { it('should behave the same as when only one is true', () => { const tabs = [createMockTab('tab-1'), createMockTab('tab-2')]; const pageLayout = createMockPageLayout(tabs); @@ -421,23 +421,23 @@ describe('getTabsByDisplayMode', () => { tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: true, + isInSidePanel: true, }); const resultOnlyMobile = getTabsByDisplayMode({ tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }); - const resultOnlyRightDrawer = getTabsByDisplayMode({ + const resultOnlySidePanel = getTabsByDisplayMode({ tabs: pageLayout.tabs, pageLayoutType: pageLayout.type, isMobile: false, - isInRightDrawer: true, + isInSidePanel: true, }); expect(resultBothTrue).toEqual(resultOnlyMobile); - expect(resultBothTrue).toEqual(resultOnlyRightDrawer); + expect(resultBothTrue).toEqual(resultOnlySidePanel); expect(resultBothTrue.tabsToRenderInTabList).toEqual(tabs); expect(resultBothTrue.pinnedLeftTab).toBeUndefined(); }); diff --git a/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsWithVisibleWidgets.test.ts b/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsWithVisibleWidgets.test.ts index 5bd5bc7c03..fcecd44894 100644 --- a/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsWithVisibleWidgets.test.ts +++ b/packages/twenty-front/src/modules/page-layout/utils/__tests__/getTabsWithVisibleWidgets.test.ts @@ -65,7 +65,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: false, }); @@ -89,7 +89,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: false, }); @@ -115,7 +115,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: false, }); @@ -133,7 +133,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: false, }); @@ -148,7 +148,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: false, }); @@ -173,7 +173,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: true, }); @@ -194,7 +194,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: true, }); @@ -210,7 +210,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: true, }); @@ -234,7 +234,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: true, }); @@ -249,7 +249,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs: [], isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: false, }); @@ -270,7 +270,7 @@ describe('getTabsWithVisibleWidgets', () => { getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: false, }); @@ -306,7 +306,7 @@ describe('getTabsWithVisibleWidgets', () => { const result = getTabsWithVisibleWidgets({ tabs, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, isEditMode: false, }); diff --git a/packages/twenty-front/src/modules/page-layout/utils/buildWidgetVisibilityContext.ts b/packages/twenty-front/src/modules/page-layout/utils/buildWidgetVisibilityContext.ts index d9e412fde9..1941287d73 100644 --- a/packages/twenty-front/src/modules/page-layout/utils/buildWidgetVisibilityContext.ts +++ b/packages/twenty-front/src/modules/page-layout/utils/buildWidgetVisibilityContext.ts @@ -2,14 +2,14 @@ import { type WidgetVisibilityContext } from '@/page-layout/types/WidgetVisibili type BuildWidgetVisibilityContextParams = { isMobile: boolean; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const buildWidgetVisibilityContext = ({ isMobile, - isInRightDrawer, + isInSidePanel, }: BuildWidgetVisibilityContextParams): WidgetVisibilityContext => { return { - device: isMobile || isInRightDrawer ? 'MOBILE' : 'DESKTOP', + device: isMobile || isInSidePanel ? 'MOBILE' : 'DESKTOP', }; }; diff --git a/packages/twenty-front/src/modules/page-layout/utils/getPageLayoutTabListInitialActiveTabId.ts b/packages/twenty-front/src/modules/page-layout/utils/getPageLayoutTabListInitialActiveTabId.ts index 5a9b62944f..ca0c35927f 100644 --- a/packages/twenty-front/src/modules/page-layout/utils/getPageLayoutTabListInitialActiveTabId.ts +++ b/packages/twenty-front/src/modules/page-layout/utils/getPageLayoutTabListInitialActiveTabId.ts @@ -6,7 +6,7 @@ type GetPageLayoutTabListInitialActiveTabIdParams = { tabs: PageLayoutTab[]; defaultTabToFocusOnMobileAndSidePanelId?: string; isMobile: boolean; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const getPageLayoutTabListInitialActiveTabId = ({ @@ -14,7 +14,7 @@ export const getPageLayoutTabListInitialActiveTabId = ({ tabs, defaultTabToFocusOnMobileAndSidePanelId, isMobile, - isInRightDrawer, + isInSidePanel, }: GetPageLayoutTabListInitialActiveTabIdParams): string | null => { const activeTabExists = tabs.some((tab) => tab.id === activeTabId); @@ -22,7 +22,7 @@ export const getPageLayoutTabListInitialActiveTabId = ({ return activeTabId; } - const isOnMobileOrSidePanel = isMobile || isInRightDrawer; + const isOnMobileOrSidePanel = isMobile || isInSidePanel; if ( isOnMobileOrSidePanel && diff --git a/packages/twenty-front/src/modules/page-layout/utils/getTabsByDisplayMode.ts b/packages/twenty-front/src/modules/page-layout/utils/getTabsByDisplayMode.ts index 29911c6b49..f49c5ec6aa 100644 --- a/packages/twenty-front/src/modules/page-layout/utils/getTabsByDisplayMode.ts +++ b/packages/twenty-front/src/modules/page-layout/utils/getTabsByDisplayMode.ts @@ -5,18 +5,18 @@ type GetTabsByDisplayModeParams = { tabs: PageLayoutTab[]; pageLayoutType: PageLayoutType; isMobile: boolean; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const getTabsByDisplayMode = ({ tabs, pageLayoutType, isMobile, - isInRightDrawer, + isInSidePanel, }: GetTabsByDisplayModeParams) => { if ( isMobile || - isInRightDrawer || + isInSidePanel || pageLayoutType !== PageLayoutType.RECORD_PAGE ) { return { diff --git a/packages/twenty-front/src/modules/page-layout/utils/getTabsWithVisibleWidgets.ts b/packages/twenty-front/src/modules/page-layout/utils/getTabsWithVisibleWidgets.ts index 907b112773..bbe685c8b8 100644 --- a/packages/twenty-front/src/modules/page-layout/utils/getTabsWithVisibleWidgets.ts +++ b/packages/twenty-front/src/modules/page-layout/utils/getTabsWithVisibleWidgets.ts @@ -5,21 +5,21 @@ import { filterVisibleWidgets } from '@/page-layout/utils/filterVisibleWidgets'; type GetTabsWithVisibleWidgetsParams = { tabs: PageLayoutTab[]; isMobile: boolean; - isInRightDrawer: boolean; + isInSidePanel: boolean; isEditMode: boolean; }; export const getTabsWithVisibleWidgets = ({ tabs, isMobile, - isInRightDrawer, + isInSidePanel, isEditMode, }: GetTabsWithVisibleWidgetsParams): PageLayoutTab[] => { if (isEditMode) { return tabs; } - const context = buildWidgetVisibilityContext({ isMobile, isInRightDrawer }); + const context = buildWidgetVisibilityContext({ isMobile, isInSidePanel }); const tabsWithFilteredWidgets = tabs.map((tab) => ({ ...tab, diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar/components/CalendarWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/calendar/components/CalendarWidget.tsx index 4e26e93782..adf18931e4 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/calendar/components/CalendarWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar/components/CalendarWidget.tsx @@ -1,7 +1,7 @@ import { CalendarEventsCard } from '@/activities/calendar/components/CalendarEventsCard'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; const StyledContainer = styled.div` @@ -16,13 +16,13 @@ type CalendarWidgetProps = { }; export const CalendarWidget = ({ widget: _widget }: CalendarWidgetProps) => { - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/DashboardWidgetPlaceholder.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/DashboardWidgetPlaceholder.tsx index 563cc34940..223eed5eb8 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/components/DashboardWidgetPlaceholder.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/components/DashboardWidgetPlaceholder.tsx @@ -1,4 +1,4 @@ -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPageLayoutInEditModeComponentState'; @@ -8,7 +8,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { Trans } from '@lingui/react/macro'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { AnimatedPlaceholder, AnimatedPlaceholderEmptyContainer, @@ -30,14 +30,14 @@ export const DashboardWidgetPlaceholder = () => { const { setIsPageLayoutInEditMode } = useSetIsPageLayoutInEditMode(pageLayoutId); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); const handleClick = () => { if (!isPageLayoutInEditMode) { setIsPageLayoutInEditMode(true); } - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutWidgetTypeSelect, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutWidgetTypeSelect, resetNavigationStack: true, }); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldEdit.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldEdit.tsx index a9bf914243..8242d5ffb7 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldEdit.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldEdit.tsx @@ -29,7 +29,7 @@ import { assertIsDefinedOrThrow } from 'twenty-shared/utils'; export const WidgetActionFieldEdit = () => { const widget = useCurrentWidget(); const targetRecord = useTargetRecord(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const { objectMetadataItem } = useObjectMetadataItem({ objectNameSingular: targetRecord.targetObjectNameSingular, @@ -75,7 +75,7 @@ export const WidgetActionFieldEdit = () => { widgetId: widget.id, recordId: targetRecord.id, fieldName: fieldMetadataItem.name, - isInRightDrawer, + isInSidePanel, }); if (isRelationField) { diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx index de86928696..8373cd54ae 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx @@ -76,7 +76,7 @@ export const WidgetRenderer = ({ widget }: WidgetRendererProps) => { const { layoutMode } = usePageLayoutContentContext(); const { isInPinnedTab } = useIsInPinnedTab(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const isMobile = useIsMobile(); const { currentPageLayout } = useCurrentPageLayoutOrThrow(); @@ -127,7 +127,7 @@ export const WidgetRenderer = ({ widget }: WidgetRendererProps) => { isInPinnedTab, pageLayoutType: currentPageLayout.type, isMobile, - isInRightDrawer, + isInSidePanel, }); const actions = useWidgetActions({ widget }); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/DashboardWidgetPlaceholder.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/DashboardWidgetPlaceholder.stories.tsx index afc910a47c..996e9d9814 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/DashboardWidgetPlaceholder.stories.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/DashboardWidgetPlaceholder.stories.tsx @@ -49,7 +49,7 @@ const meta: Meta = { = { { - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx index d276ab4f58..d7ee459307 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx @@ -16,7 +16,7 @@ import { FieldWidgetRelationField } from '@/page-layout/widgets/field/components import { assertFieldWidgetOrThrow } from '@/page-layout/widgets/field/utils/assertFieldWidgetOrThrow'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { useTargetRecord } from '@/ui/layout/contexts/useTargetRecord'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; import { t } from '@lingui/core/macro'; import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; @@ -43,7 +43,7 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { assertFieldWidgetOrThrow(widget); const targetRecord = useTargetRecord(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const { isPrefetchLoading } = useRecordShowContainerData({ objectRecordId: targetRecord.id, @@ -69,17 +69,17 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { if (isPrefetchLoading) { return ( - + - + ); } if (!isDefined(fieldMetadataItem) || !fieldMetadataItem.isActive) { return ( - + { - + ); } @@ -116,7 +116,7 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { ); } @@ -125,7 +125,7 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { ); } @@ -136,7 +136,7 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { ); } @@ -145,7 +145,7 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { ); } @@ -156,7 +156,7 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { fieldMetadataItem={fieldMetadataItem} objectMetadataItem={objectMetadataItem} recordId={targetRecord.id} - isInRightDrawer={isInRightDrawer} + isInSidePanel={isInSidePanel} /> ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetDisplay.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetDisplay.tsx index 5cb31a5af6..26a0f662e0 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetDisplay.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetDisplay.tsx @@ -16,7 +16,7 @@ import { fieldWidgetHoverComponentState } from '@/page-layout/widgets/field/stat import { generateFieldWidgetInstanceId } from '@/page-layout/widgets/field/utils/generateFieldWidgetInstanceId'; import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget'; import { getObjectPermissionsFromMapByObjectMetadataId } from '@/settings/roles/role-permissions/objects-permissions/utils/getObjectPermissionsFromMapByObjectMetadataId'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { styled } from '@linaria/react'; @@ -29,7 +29,7 @@ type FieldWidgetDisplayProps = { fieldMetadataItem: FieldMetadataItem; objectMetadataItem: ObjectMetadataItem; recordId: string; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const FieldWidgetDisplay = ({ @@ -37,7 +37,7 @@ export const FieldWidgetDisplay = ({ fieldMetadataItem, objectMetadataItem, recordId, - isInRightDrawer, + isInSidePanel, }: FieldWidgetDisplayProps) => { const widget = useCurrentWidget(); @@ -49,7 +49,7 @@ export const FieldWidgetDisplay = ({ widgetId: widget.id, recordId, fieldName: fieldMetadataItem.name, - isInRightDrawer, + isInSidePanel, }); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); @@ -68,7 +68,7 @@ export const FieldWidgetDisplay = ({ return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetMorphRelationCard.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetMorphRelationCard.tsx index ef82ad4f4b..148a0cfaaa 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetMorphRelationCard.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetMorphRelationCard.tsx @@ -23,7 +23,7 @@ import { FIELD_WIDGET_RELATION_CARD_LOAD_MORE_INCREMENT } from '@/page-layout/wi import { generateFieldWidgetInstanceId } from '@/page-layout/widgets/field/utils/generateFieldWidgetInstanceId'; import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget'; import { useTargetRecord } from '@/ui/layout/contexts/useTargetRecord'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { isDefined } from 'twenty-shared/utils'; import { themeCssVariables } from 'twenty-ui/theme-constants'; @@ -34,13 +34,13 @@ const StyledShowMoreButtonContainer = styled.div` type FieldWidgetMorphRelationCardProps = { fieldDefinition: FieldDefinition; recordId: string; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const FieldWidgetMorphRelationCard = ({ fieldDefinition, recordId, - isInRightDrawer, + isInSidePanel, }: FieldWidgetMorphRelationCardProps) => { const widget = useCurrentWidget(); @@ -54,7 +54,7 @@ export const FieldWidgetMorphRelationCard = ({ widgetId: widget.id, recordId: targetRecord.id, fieldName: fieldDefinition.metadata.fieldName, - isInRightDrawer, + isInSidePanel, }); const handleItemClick = (id: string) => @@ -132,7 +132,7 @@ export const FieldWidgetMorphRelationCard = ({ const hasMoreRecords = remainingCount > 0; return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetMorphRelationField.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetMorphRelationField.tsx index c8cc564c17..5448250791 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetMorphRelationField.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetMorphRelationField.tsx @@ -2,7 +2,7 @@ import { RecordChip } from '@/object-record/components/RecordChip'; import { useGetMorphRelationRelatedRecordsWithObjectNameSingular } from '@/object-record/record-field-list/record-detail-section/relation/components/hooks/useGetMorphRelationRelatedRecordsWithObjectNameSingular'; import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition'; import { type FieldMorphRelationMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; import { themeCssVariables } from 'twenty-ui/theme-constants'; @@ -21,13 +21,13 @@ const StyledRelationChipsContainer = styled.div` type FieldWidgetMorphRelationFieldProps = { fieldDefinition: FieldDefinition; recordId: string; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const FieldWidgetMorphRelationField = ({ fieldDefinition, recordId, - isInRightDrawer, + isInSidePanel, }: FieldWidgetMorphRelationFieldProps) => { const fieldMetadata = fieldDefinition.metadata; @@ -42,7 +42,7 @@ export const FieldWidgetMorphRelationField = ({ } return ( - + {recordsWithObjectNameSingular.map((morphItem, index) => ( @@ -54,6 +54,6 @@ export const FieldWidgetMorphRelationField = ({ ))} - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationCard.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationCard.tsx index 187ef4cb3c..d762334665 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationCard.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationCard.tsx @@ -21,7 +21,7 @@ import { FIELD_WIDGET_RELATION_CARD_LOAD_MORE_INCREMENT } from '@/page-layout/wi import { generateFieldWidgetInstanceId } from '@/page-layout/widgets/field/utils/generateFieldWidgetInstanceId'; import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget'; import { useTargetRecord } from '@/ui/layout/contexts/useTargetRecord'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { isDefined } from 'twenty-shared/utils'; import { themeCssVariables } from 'twenty-ui/theme-constants'; @@ -32,13 +32,13 @@ const StyledShowMoreButtonContainer = styled.div` type FieldWidgetRelationCardProps = { fieldDefinition: FieldDefinition; relationValue: any; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const FieldWidgetRelationCard = ({ fieldDefinition, relationValue, - isInRightDrawer, + isInSidePanel, }: FieldWidgetRelationCardProps) => { const widget = useCurrentWidget(); @@ -52,7 +52,7 @@ export const FieldWidgetRelationCard = ({ widgetId: widget.id, recordId: targetRecord.id, fieldName: fieldDefinition.metadata.fieldName, - isInRightDrawer, + isInSidePanel, }); const handleItemClick = (recordId: string) => @@ -129,7 +129,7 @@ export const FieldWidgetRelationCard = ({ const hasMoreRecords = remainingCount > 0; return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationField.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationField.tsx index f2a7347bab..32bbe3c7e1 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationField.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationField.tsx @@ -1,7 +1,7 @@ import { RecordChip } from '@/object-record/components/RecordChip'; import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition'; import { type FieldRelationMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; import { isDefined } from 'twenty-shared/utils'; import { themeCssVariables } from 'twenty-ui/theme-constants'; @@ -21,13 +21,13 @@ const StyledRelationChipsContainer = styled.div` type FieldWidgetRelationFieldProps = { fieldDefinition: FieldDefinition; relationValue: any; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const FieldWidgetRelationField = ({ fieldDefinition, relationValue, - isInRightDrawer, + isInSidePanel, }: FieldWidgetRelationFieldProps) => { const fieldMetadata = fieldDefinition.metadata; const isOneToMany = fieldMetadata.relationType === 'ONE_TO_MANY'; @@ -44,7 +44,7 @@ export const FieldWidgetRelationField = ({ if (isOneToMany) { return ( - + {relationValue.map((relatedRecord: any) => ( @@ -56,12 +56,12 @@ export const FieldWidgetRelationField = ({ ))} - + ); } return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/__stories__/FieldWidget.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/__stories__/FieldWidget.stories.tsx index 94f74be4e8..21cda4dc30 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/__stories__/FieldWidget.stories.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/__stories__/FieldWidget.stories.tsx @@ -387,7 +387,7 @@ export const TextFieldWidget: Story = { { - it('should generate an instance id without right drawer suffix', () => { + it('should generate an instance id without side panel suffix', () => { const result = generateFieldWidgetInstanceId({ widgetId: 'widget-1', recordId: 'record-1', fieldName: 'name', - isInRightDrawer: false, + isInSidePanel: false, }); expect(result).toBe('widget-1-field-widget-record-1-name'); }); - it('should append right drawer suffix when isInRightDrawer is true', () => { + it('should append side panel suffix when isInSidePanel is true', () => { const result = generateFieldWidgetInstanceId({ widgetId: 'widget-1', recordId: 'record-1', fieldName: 'name', - isInRightDrawer: true, + isInSidePanel: true, }); - expect(result).toBe('widget-1-field-widget-record-1-name-right-drawer'); + expect(result).toBe('widget-1-field-widget-record-1-name-side-panel'); }); }); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/utils/generateFieldWidgetInstanceId.ts b/packages/twenty-front/src/modules/page-layout/widgets/field/utils/generateFieldWidgetInstanceId.ts index 51c3266549..743ff65ec4 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/utils/generateFieldWidgetInstanceId.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/utils/generateFieldWidgetInstanceId.ts @@ -2,12 +2,12 @@ export const generateFieldWidgetInstanceId = ({ widgetId, recordId, fieldName, - isInRightDrawer, + isInSidePanel, }: { widgetId: string; recordId: string; fieldName: string; - isInRightDrawer: boolean; + isInSidePanel: boolean; }): string => { - return `${widgetId}-field-widget-${recordId}-${fieldName}${isInRightDrawer ? '-right-drawer' : ''}`; + return `${widgetId}-field-widget-${recordId}-${fieldName}${isInSidePanel ? '-side-panel' : ''}`; }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidget.tsx index 2226aac027..1193244daa 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidget.tsx @@ -9,7 +9,7 @@ import { FieldsWidgetGroupContainer } from '@/page-layout/widgets/fields/compone import { useFieldsWidgetGroupsForDisplay } from '@/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsForDisplay'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { useTargetRecord } from '@/ui/layout/contexts/useTargetRecord'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; import { t } from '@lingui/core/macro'; import { @@ -51,9 +51,9 @@ type FieldsWidgetProps = { export const FieldsWidget = ({ widget }: FieldsWidgetProps) => { const targetRecord = useTargetRecord(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); - const instanceId = `fields-${widget.id}-${targetRecord.id}${isInRightDrawer ? '-right-drawer' : ''}`; + const instanceId = `fields-${widget.id}-${targetRecord.id}${isInSidePanel ? '-side-panel' : ''}`; const { objectMetadataItem } = useObjectMetadataItem({ objectNameSingular: targetRecord.targetObjectNameSingular, @@ -75,7 +75,7 @@ export const FieldsWidget = ({ widget }: FieldsWidgetProps) => { if (!hasFieldsToDisplay) { return ( - + { - + ); } diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/__stories__/FieldsWidget.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/__stories__/FieldsWidget.stories.tsx index e3e44fa8dc..67d47e403d 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/__stories__/FieldsWidget.stories.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/__stories__/FieldsWidget.stories.tsx @@ -341,7 +341,7 @@ export const WithViewFieldGroups: Story = { { - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx index befa252314..14757587d1 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx @@ -3,7 +3,7 @@ import { Suspense, lazy } from 'react'; import { isDefined } from 'twenty-shared/utils'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPageLayoutInEditModeComponentState'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx index b360d64813..9253ec5446 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx @@ -1,4 +1,4 @@ -import { isSidePanelAnimatingState } from '@/command-menu/states/isSidePanelAnimatingState'; +import { isSidePanelAnimatingState } from '@/side-panel/states/isSidePanelAnimatingState'; import { pageLayoutDraggingWidgetIdComponentState } from '@/page-layout/states/pageLayoutDraggingWidgetIdComponentState'; import { pageLayoutResizingWidgetIdComponentState } from '@/page-layout/states/pageLayoutResizingWidgetIdComponentState'; import { GraphWidgetChartContainer } from '@/page-layout/widgets/graph/components/GraphWidgetChartContainer'; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertAggregateChartWidget.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertAggregateChartWidget.ts index 8b2f0f3c3d..e2907c1b65 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertAggregateChartWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertAggregateChartWidget.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { assertIsDefinedOrThrow } from 'twenty-shared/utils'; import { type AggregateChartConfiguration } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertBarChartWidget.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertBarChartWidget.ts index 90a6c1ec57..35ed695541 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertBarChartWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertBarChartWidget.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { assertIsDefinedOrThrow } from 'twenty-shared/utils'; import { type BarChartConfiguration } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertPieChartWidget.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertPieChartWidget.ts index cb5f8c612f..9d37ccfe97 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertPieChartWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/assertPieChartWidget.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { assertIsDefinedOrThrow } from 'twenty-shared/utils'; import { type PieChartConfiguration } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/hasMinimalRequiredConfigForGraph.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/hasMinimalRequiredConfigForGraph.ts index 56f0ac1cb6..803b594d14 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/hasMinimalRequiredConfigForGraph.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/hasMinimalRequiredConfigForGraph.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type FieldConfiguration } from '@/page-layout/types/FieldConfiguration'; import { isDefined } from 'twenty-shared/utils'; import { diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/normalizeChartConfigurationFields.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/normalizeChartConfigurationFields.ts index 699e8dd39b..9c0bdb0125 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/normalizeChartConfigurationFields.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/utils/normalizeChartConfigurationFields.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type BarChartConfiguration, type GraphOrderBy, diff --git a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts index ba525bc582..78659267f7 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts @@ -10,7 +10,7 @@ import { isDefined } from 'twenty-shared/utils'; export const useIsCurrentWidgetLastOfTab = (widgetId: string): boolean => { const { currentPageLayout } = useCurrentPageLayout(); const isMobile = useIsMobile(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); @@ -31,7 +31,7 @@ export const useIsCurrentWidgetLastOfTab = (widgetId: string): boolean => { ? tab.widgets : filterVisibleWidgets({ widgets: tab.widgets, - context: buildWidgetVisibilityContext({ isMobile, isInRightDrawer }), + context: buildWidgetVisibilityContext({ isMobile, isInSidePanel }), }); if (visibleWidgets.length === 0) { diff --git a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsInPinnedTab.ts b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsInPinnedTab.ts index a71e78da60..39b1f49e55 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsInPinnedTab.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsInPinnedTab.ts @@ -12,7 +12,7 @@ export const useIsInPinnedTab = () => { const isMobile = useIsMobile(); const { tabId } = usePageLayoutContentContext(); - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); const { currentPageLayout } = useCurrentPageLayoutOrThrow(); const isPageLayoutInEditMode = useAtomComponentStateValue( @@ -22,7 +22,7 @@ export const useIsInPinnedTab = () => { const tabsWithVisibleWidgets = getTabsWithVisibleWidgets({ tabs: currentPageLayout.tabs, isMobile, - isInRightDrawer, + isInSidePanel, isEditMode: isPageLayoutInEditMode, }); @@ -30,7 +30,7 @@ export const useIsInPinnedTab = () => { tabs: tabsWithVisibleWidgets, pageLayoutType: currentPageLayout.type, isMobile, - isInRightDrawer, + isInSidePanel, }); return { diff --git a/packages/twenty-front/src/modules/page-layout/widgets/notes/components/NoteWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/notes/components/NoteWidget.tsx index d65478bef0..e803356185 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/notes/components/NoteWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/notes/components/NoteWidget.tsx @@ -1,7 +1,7 @@ import { NotesCard } from '@/activities/notes/components/NotesCard'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; const StyledContainer = styled.div` @@ -16,13 +16,13 @@ type NoteWidgetProps = { }; export const NoteWidget = ({ widget: _widget }: NoteWidgetProps) => { - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/tasks/components/TaskWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/tasks/components/TaskWidget.tsx index c64fcecc99..f9cd291891 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/tasks/components/TaskWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/tasks/components/TaskWidget.tsx @@ -1,7 +1,7 @@ import { TasksCard } from '@/activities/tasks/components/TasksCard'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; const StyledContainer = styled.div` @@ -16,13 +16,13 @@ type TaskWidgetProps = { }; export const TaskWidget = ({ widget: _widget }: TaskWidgetProps) => { - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/timeline/components/TimelineWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/timeline/components/TimelineWidget.tsx index b9eb019051..bd58feafad 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/timeline/components/TimelineWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/timeline/components/TimelineWidget.tsx @@ -1,7 +1,7 @@ import { TimelineCard } from '@/activities/timeline-activities/components/TimelineCard'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; import { styled } from '@linaria/react'; const StyledContainer = styled.div` @@ -16,13 +16,13 @@ type TimelineWidgetProps = { }; export const TimelineWidget = ({ widget: _widget }: TimelineWidgetProps) => { - const { isInRightDrawer } = useLayoutRenderingContext(); + const { isInSidePanel } = useLayoutRenderingContext(); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardVariant.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardVariant.test.ts index 44ceccac1d..98f4dbbeab 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardVariant.test.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardVariant.test.ts @@ -12,7 +12,7 @@ describe('getWidgetCardVariant', () => { isInPinnedTab: false, pageLayoutType: PageLayoutType.DASHBOARD, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('dashboard'); }); @@ -24,7 +24,7 @@ describe('getWidgetCardVariant', () => { isInPinnedTab: false, pageLayoutType: PageLayoutType.RECORD_PAGE, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('canvas'); }); @@ -36,7 +36,7 @@ describe('getWidgetCardVariant', () => { isInPinnedTab: true, pageLayoutType: PageLayoutType.RECORD_PAGE, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('side-column'); }); @@ -48,19 +48,19 @@ describe('getWidgetCardVariant', () => { isInPinnedTab: false, pageLayoutType: PageLayoutType.RECORD_PAGE, isMobile: true, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('side-column'); }); - it('should return side-column when isInRightDrawer is true', () => { + it('should return side-column when isInSidePanel is true', () => { expect( getWidgetCardVariant({ layoutMode: PageLayoutTabLayoutMode.GRID, isInPinnedTab: false, pageLayoutType: PageLayoutType.RECORD_PAGE, isMobile: false, - isInRightDrawer: true, + isInSidePanel: true, }), ).toBe('side-column'); }); @@ -72,7 +72,7 @@ describe('getWidgetCardVariant', () => { isInPinnedTab: false, pageLayoutType: PageLayoutType.RECORD_PAGE, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('record-page'); }); @@ -84,7 +84,7 @@ describe('getWidgetCardVariant', () => { isInPinnedTab: false, pageLayoutType: PageLayoutType.DASHBOARD, isMobile: false, - isInRightDrawer: false, + isInSidePanel: false, }), ).toBe('dashboard'); }); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardVariant.ts b/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardVariant.ts index 3a929fa205..3ee8a5c3ec 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardVariant.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardVariant.ts @@ -9,7 +9,7 @@ type GetWidgetCardVariantParams = { isInPinnedTab: boolean; pageLayoutType: PageLayoutType | null; isMobile: boolean; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const getWidgetCardVariant = ({ @@ -17,7 +17,7 @@ export const getWidgetCardVariant = ({ isInPinnedTab, pageLayoutType, isMobile, - isInRightDrawer, + isInSidePanel, }: GetWidgetCardVariantParams): WidgetCardVariant => { if (pageLayoutType === PageLayoutType.DASHBOARD) { return 'dashboard'; @@ -27,7 +27,7 @@ export const getWidgetCardVariant = ({ return 'canvas'; } - if (isInPinnedTab || isMobile || isInRightDrawer) { + if (isInPinnedTab || isMobile || isInSidePanel) { return 'side-column'; } diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterRow.tsx index 92007b00c2..66a883de19 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterRow.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterRow.tsx @@ -2,7 +2,7 @@ import { styled } from '@linaria/react'; -import { AdvancedFilterCommandMenuRecordFilterOperandSelect } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect'; +import { AdvancedFilterSidePanelRecordFilterOperandSelect } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelRecordFilterOperandSelect'; import { AdvancedFilterRecordFilterOptionsDropdown } from '@/object-record/advanced-filter/components/AdvancedFilterRecordFilterOptionsDropdown'; import { getAdvancedFilterObjectFilterDropdownComponentInstanceId } from '@/object-record/advanced-filter/utils/getAdvancedFilterObjectFilterDropdownComponentInstanceId'; import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; @@ -53,7 +53,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterRow = recordFilterId={recordFilter.id} /> - diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuAddToNavDraggablePlaceholder.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelAddToNavigationDraggablePlaceholder.tsx similarity index 73% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuAddToNavDraggablePlaceholder.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelAddToNavigationDraggablePlaceholder.tsx index ff3b6a201d..53398ae897 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuAddToNavDraggablePlaceholder.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelAddToNavigationDraggablePlaceholder.tsx @@ -1,15 +1,15 @@ import { Draggable } from '@hello-pangea/dnd'; import { type ReactNode } from 'react'; -type CommandMenuAddToNavDraggablePlaceholderProps = { +type SidePanelAddToNavigationDraggablePlaceholderProps = { index: number; children: ReactNode; }; -export const CommandMenuAddToNavDraggablePlaceholder = ({ +export const SidePanelAddToNavigationDraggablePlaceholder = ({ index, children, -}: CommandMenuAddToNavDraggablePlaceholderProps) => ( +}: SidePanelAddToNavigationDraggablePlaceholderProps) => ( ReactNode; }; -export const CommandMenuAddToNavDroppable = ({ +export const SidePanelAddToNavigationDroppable = ({ children, -}: CommandMenuAddToNavDroppableProps) => { +}: SidePanelAddToNavigationDroppableProps) => { const { sourceDroppableId } = useContext(NavigationDragSourceContext); const isDropDisabled = sourceDroppableId === ADD_TO_NAV_SOURCE_DROPPABLE_ID; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuAskAIInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelAskAIInfo.tsx similarity index 95% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuAskAIInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelAskAIInfo.tsx index 77d5e8b573..6707da8f6b 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuAskAIInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelAskAIInfo.tsx @@ -11,7 +11,7 @@ const StyledPageTitle = styled.div` font-weight: ${themeCssVariables.font.weight.semiBold}; `; -export const CommandMenuAskAIInfo = () => { +export const SidePanelAskAIInfo = () => { const currentAIChatThreadTitle = useAtomStateValue( currentAIChatThreadTitleState, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuBackButton.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelBackButton.tsx similarity index 75% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuBackButton.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelBackButton.tsx index 167574498e..3e2d9ad1a1 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuBackButton.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelBackButton.tsx @@ -1,6 +1,6 @@ -import { COMMAND_MENU_NAVIGATION_HISTORY_DROPDOWN_ID } from '@/command-menu/constants/CommandMenuNavigationHistoryDropdownId'; -import { useCommandMenuContextChips } from '@/command-menu/hooks/useCommandMenuContextChips'; -import { useCommandMenuHistory } from '@/command-menu/hooks/useCommandMenuHistory'; +import { SIDE_PANEL_NAVIGATION_HISTORY_DROPDOWN_ID } from '@/side-panel/constants/SidePanelNavigationHistoryDropdownId'; +import { useSidePanelContextChips } from '@/side-panel/hooks/useSidePanelContextChips'; +import { useSidePanelHistory } from '@/side-panel/hooks/useSidePanelHistory'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; @@ -23,10 +23,10 @@ const StyledIconChevronLeft = styled(IconChevronLeft)` color: ${themeCssVariables.font.color.secondary}; `; -export const CommandMenuBackButton = () => { - const { goBackFromCommandMenu } = useCommandMenuHistory(); +export const SidePanelBackButton = () => { + const { goBackFromSidePanel } = useSidePanelHistory(); - const { contextChips } = useCommandMenuContextChips(); + const { contextChips } = useSidePanelContextChips(); const { openDropdown } = useOpenDropdown(); @@ -44,7 +44,7 @@ export const CommandMenuBackButton = () => { openDropdown({ dropdownComponentInstanceIdFromProps: - COMMAND_MENU_NAVIGATION_HISTORY_DROPDOWN_ID, + SIDE_PANEL_NAVIGATION_HISTORY_DROPDOWN_ID, }); }; @@ -56,7 +56,7 @@ export const CommandMenuBackButton = () => { Icon={StyledIconChevronLeft} size="small" variant="tertiary" - onClick={goBackFromCommandMenu} + onClick={goBackFromSidePanel} /> } @@ -68,7 +68,7 @@ export const CommandMenuBackButton = () => { key={index} LeftComponent={chip.Icons} onClick={() => { - closeDropdown(COMMAND_MENU_NAVIGATION_HISTORY_DROPDOWN_ID); + closeDropdown(SIDE_PANEL_NAVIGATION_HISTORY_DROPDOWN_ID); chip.onClick?.(); }} text={chip.text} @@ -77,7 +77,7 @@ export const CommandMenuBackButton = () => { } - dropdownId={COMMAND_MENU_NAVIGATION_HISTORY_DROPDOWN_ID} + dropdownId={SIDE_PANEL_NAVIGATION_HISTORY_DROPDOWN_ID} dropdownPlacement="bottom-start" disableClickForClickableComponent={true} /> diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelContainer.tsx similarity index 80% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelContainer.tsx index 6e54677cdc..bbcc47545e 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelContainer.tsx @@ -1,6 +1,6 @@ import { styled } from '@linaria/react'; import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; @@ -12,7 +12,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { themeCssVariables } from 'twenty-ui/theme-constants'; -const StyledCommandMenuContainer = styled.div<{ isMobile: boolean }>` +const StyledSidePanelContainer = styled.div<{ isMobile: boolean }>` max-height: ${({ isMobile }) => { const mobileOffset = isMobile ? themeCssVariables.spacing[16] : '0px'; @@ -23,16 +23,14 @@ const StyledCommandMenuContainer = styled.div<{ isMobile: boolean }>` flex: 1; `; -type CommandMenuContainerProps = { +type SidePanelContainerProps = { children: React.ReactNode; }; -export const CommandMenuContainer = ({ - children, -}: CommandMenuContainerProps) => { +export const SidePanelContainer = ({ children }: SidePanelContainerProps) => { const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); const isMobile = useIsMobile(); @@ -45,7 +43,7 @@ export const CommandMenuContainer = ({ const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, - COMMAND_MENU_COMPONENT_INSTANCE_ID, + SIDE_PANEL_COMPONENT_INSTANCE_ID, ); const recordIndexId = getRecordIndexIdFromObjectNamePluralAndViewId( @@ -56,14 +54,14 @@ export const CommandMenuContainer = ({ return ( - + {children} - + diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextChip.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelContextChip.tsx similarity index 92% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuContextChip.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelContextChip.tsx index e5aa80897b..d5c7c25cd7 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextChip.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelContextChip.tsx @@ -2,7 +2,7 @@ import { styled } from '@linaria/react'; import { t } from '@lingui/core/macro'; import { isNonEmptyString } from '@sniptt/guards'; import { Fragment } from 'react/jsx-runtime'; -import { type CommandMenuPages } from 'twenty-shared/types'; +import { type SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { OverflowingTextWithTooltip } from 'twenty-ui/display'; import { themeCssVariables } from 'twenty-ui/theme-constants'; @@ -51,7 +51,7 @@ const StyledEmptyText = styled.div` color: ${themeCssVariables.font.color.tertiary}; `; -export type CommandMenuContextChipProps = { +export type SidePanelContextChipProps = { Icons: React.ReactNode[]; text?: string; onClick?: () => void; @@ -59,19 +59,19 @@ export type CommandMenuContextChipProps = { maxWidth?: string; forceEmptyText?: boolean; page?: { - page: CommandMenuPages; + page: SidePanelPages; pageId: string; }; }; -export const CommandMenuContextChip = ({ +export const SidePanelContextChip = ({ Icons, text, onClick, testId, maxWidth, forceEmptyText = false, -}: CommandMenuContextChipProps) => { +}: SidePanelContextChipProps) => { return ( ` justify-content: center; `; -export const CommandMenuContextRecordChipAvatars = ({ +export const SidePanelContextRecordChipAvatars = ({ objectMetadataItem, record, }: { diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordsChip.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelContextRecordsChip.tsx similarity index 75% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordsChip.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelContextRecordsChip.tsx index 6fffcf5eeb..44da5a8bc7 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordsChip.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelContextRecordsChip.tsx @@ -1,12 +1,12 @@ -import { CommandMenuContextChip } from '@/command-menu/components/CommandMenuContextChip'; -import { CommandMenuContextRecordChipAvatars } from '@/command-menu/components/CommandMenuContextRecordChipAvatars'; -import { getSelectedRecordsContextText } from '@/command-menu/utils/getRecordContextText'; +import { SidePanelContextChip } from '@/side-panel/components/SidePanelContextChip'; +import { SidePanelContextRecordChipAvatars } from '@/side-panel/components/SidePanelContextRecordChipAvatars'; +import { getSelectedRecordsContextText } from '@/side-panel/utils/getSelectedRecordsContextText'; import { useFindManyRecordsSelectedInContextStore } from '@/context-store/hooks/useFindManyRecordsSelectedInContextStore'; import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; -export const CommandMenuContextRecordsChip = ({ +export const SidePanelContextRecordsChip = ({ objectMetadataItemId, instanceId, }: { @@ -31,7 +31,7 @@ export const CommandMenuContextRecordsChip = ({ } const Avatars = records.map((record) => ( - { + const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); + + if (!isDefined(pageLayoutId)) { + return null; + } + + return ; +}; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuDefaultSelectionEffect.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelDefaultSelectionEffect.tsx similarity index 66% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuDefaultSelectionEffect.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelDefaultSelectionEffect.tsx index 713c02da51..adcec7aa15 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuDefaultSelectionEffect.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelDefaultSelectionEffect.tsx @@ -1,5 +1,5 @@ -import { COMMAND_MENU_LIST_SELECTABLE_LIST_ID } from '@/command-menu/constants/CommandMenuListSelectableListId'; -import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; +import { SIDE_PANEL_SELECTABLE_LIST_ID } from '@/side-panel/constants/SidePanelSelectableListId'; +import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; @@ -7,27 +7,29 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; -export const CommandMenuDefaultSelectionEffect = ({ +export const SidePanelDefaultSelectionEffect = ({ selectableItemIds, }: { selectableItemIds: string[]; }) => { const { setSelectedItemId } = useSelectableList( - COMMAND_MENU_LIST_SELECTABLE_LIST_ID, + SIDE_PANEL_SELECTABLE_LIST_ID, ); const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, - COMMAND_MENU_LIST_SELECTABLE_LIST_ID, + SIDE_PANEL_SELECTABLE_LIST_ID, ); - const hasUserSelectedCommand = useAtomStateValue(hasUserSelectedCommandState); + const hasUserSelectedSidePanelListItem = useAtomStateValue( + hasUserSelectedSidePanelListItemState, + ); useEffect(() => { if ( isDefined(selectedItemId) && selectableItemIds.includes(selectedItemId) && - hasUserSelectedCommand + hasUserSelectedSidePanelListItem ) { return; } @@ -36,7 +38,7 @@ export const CommandMenuDefaultSelectionEffect = ({ setSelectedItemId(selectableItemIds[0]); } }, [ - hasUserSelectedCommand, + hasUserSelectedSidePanelListItem, selectableItemIds, selectedItemId, setSelectedItemId, diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuFolderInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelFolderInfo.tsx similarity index 78% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuFolderInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelFolderInfo.tsx index dbbf679ea6..a28185ce1d 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuFolderInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelFolderInfo.tsx @@ -2,9 +2,9 @@ import { styled } from '@linaria/react'; import { useLingui } from '@lingui/react/macro'; import { useIcons } from 'twenty-ui/display'; -import { CommandMenuPageInfoLayout } from '@/command-menu/components/CommandMenuPageInfoLayout'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuShouldFocusTitleInputComponentState } from '@/command-menu/states/commandMenuShouldFocusTitleInputComponentState'; +import { SidePanelPageInfoLayout } from '@/side-panel/components/SidePanelPageInfoLayout'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelShouldFocusTitleInputComponentState } from '@/side-panel/states/sidePanelShouldFocusTitleInputComponentState'; import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/NavigationMenuItemStyleIcon'; import { FOLDER_ICON_DEFAULT } from '@/navigation-menu-item/constants/FolderIconDefault'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; @@ -20,17 +20,15 @@ const StyledClickableIconWrapper = styled.div` cursor: pointer; `; -export const CommandMenuFolderInfo = () => { +export const SidePanelFolderInfo = () => { const { t } = useLingui(); const { getIcon } = useIcons(); - const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState); - const [ - commandMenuShouldFocusTitleInput, - setCommandMenuShouldFocusTitleInput, - ] = useAtomComponentState( - commandMenuShouldFocusTitleInputComponentState, - commandMenuPageInfo.instanceId, - ); + const sidePanelPageInfo = useAtomStateValue(sidePanelPageInfoState); + const [sidePanelShouldFocusTitleInput, setSidePanelShouldFocusTitleInput] = + useAtomComponentState( + sidePanelShouldFocusTitleInputComponentState, + sidePanelPageInfo.instanceId, + ); const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeState, ); @@ -70,10 +68,10 @@ export const CommandMenuFolderInfo = () => { const FolderIconComponent = getIcon(selectedIconKey); return ( - updateFolderInDraft(itemId, { icon: iconKey }) @@ -100,8 +98,8 @@ export const CommandMenuFolderInfo = () => { onClickOutside={handleSave} onTab={handleSave} onShiftTab={handleSave} - shouldFocus={commandMenuShouldFocusTitleInput} - onFocus={() => setCommandMenuShouldFocusTitleInput(false)} + shouldFocus={sidePanelShouldFocusTitleInput} + onFocus={() => setSidePanelShouldFocusTitleInput(false)} /> } label={t`Folder`} diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuSidePanelForDesktop.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelForDesktop.tsx similarity index 61% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuSidePanelForDesktop.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelForDesktop.tsx index 3116a2e63a..5082ec355f 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuSidePanelForDesktop.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelForDesktop.tsx @@ -1,17 +1,17 @@ -import { CommandMenuRouter } from '@/command-menu/components/CommandMenuRouter'; -import { CommandMenuWidthEffect } from '@/command-menu/components/CommandMenuWidthEffect'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useCommandMenuCloseAnimationCompleteCleanup } from '@/command-menu/hooks/useCommandMenuCloseAnimationCompleteCleanup'; +import { SidePanelRouter } from '@/side-panel/components/SidePanelRouter'; +import { SidePanelWidthEffect } from '@/side-panel/components/SidePanelWidthEffect'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useSidePanelCloseAnimationCompleteCleanup } from '@/side-panel/hooks/useSidePanelCloseAnimationCompleteCleanup'; import { - COMMAND_MENU_WIDTH_VAR, - commandMenuWidthState, -} from '@/command-menu/states/commandMenuWidthState'; -import { isCommandMenuClosingState } from '@/command-menu/states/isCommandMenuClosingState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; + SIDE_PANEL_WIDTH_VAR, + sidePanelWidthState, +} from '@/side-panel/states/sidePanelWidthState'; +import { isSidePanelClosingState } from '@/side-panel/states/isSidePanelClosingState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { tableWidthResizeIsActiveState } from '@/object-record/record-table/states/tableWidthResizeIsActivedState'; import { ModalContainerContext } from '@/ui/layout/modal/contexts/ModalContainerContext'; import { ResizablePanelGap } from '@/ui/layout/resizable-panel/components/ResizablePanelGap'; -import { COMMAND_MENU_CONSTRAINTS } from '@/ui/layout/resizable-panel/constants/CommandMenuConstraints'; +import { SIDE_PANEL_CONSTRAINTS } from '@/side-panel/constants/SidePanelConstraints'; import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; @@ -26,7 +26,7 @@ const StyledSidePanelWrapper = styled.div<{ flex-shrink: 0; min-width: 0; overflow: hidden; - width: ${({ isOpen }) => (isOpen ? `var(${COMMAND_MENU_WIDTH_VAR})` : '0px')}; + width: ${({ isOpen }) => (isOpen ? `var(${SIDE_PANEL_WIDTH_VAR})` : '0px')}; transition: ${({ isResizing }) => isResizing ? 'none' @@ -58,38 +58,36 @@ const StyledModalContainer = styled.div` const GAP_WIDTH = 8; -export const CommandMenuSidePanelForDesktop = () => { - const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState); - const isCommandMenuClosing = useAtomStateValue(isCommandMenuClosingState); - const [commandMenuWidth, setCommandMenuWidth] = useAtomState( - commandMenuWidthState, - ); - const { closeCommandMenu } = useCommandMenu(); - const { commandMenuCloseAnimationCompleteCleanup } = - useCommandMenuCloseAnimationCompleteCleanup(); +export const SidePanelForDesktop = () => { + const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState); + const isSidePanelClosing = useAtomStateValue(isSidePanelClosingState); + const [sidePanelWidth, setSidePanelWidth] = useAtomState(sidePanelWidthState); + const { closeSidePanelMenu } = useSidePanelMenu(); + const { sidePanelCloseAnimationCompleteCleanup } = + useSidePanelCloseAnimationCompleteCleanup(); const [modalContainer, setModalContainer] = useState( null, ); const [isResizing, setIsResizing] = useState(false); const [shouldRenderContent, setShouldRenderContent] = - useState(isCommandMenuOpened); + useState(isSidePanelOpened); const setTableWidthResizeIsActive = useSetAtomState( tableWidthResizeIsActiveState, ); - const shouldShowContent = isCommandMenuOpened || shouldRenderContent; + const shouldShowContent = isSidePanelOpened || shouldRenderContent; const handleTransitionEnd = () => { - if (isCommandMenuOpened) { + if (isSidePanelOpened) { // Open animation completed - ensure content persists for close animation setShouldRenderContent(true); } else { // Close animation completed setShouldRenderContent(false); - if (isCommandMenuClosing) { - commandMenuCloseAnimationCompleteCleanup(); + if (isSidePanelClosing) { + sidePanelCloseAnimationCompleteCleanup(); } } }; @@ -103,11 +101,11 @@ export const CommandMenuSidePanelForDesktop = () => { const handleWidthChange = useCallback( (width: number) => { - setCommandMenuWidth(width); + setSidePanelWidth(width); setIsResizing(false); setTableWidthResizeIsActive(true); }, - [setCommandMenuWidth, setTableWidthResizeIsActive], + [setSidePanelWidth, setTableWidthResizeIsActive], ); const handleResizeStart = useCallback(() => { @@ -116,35 +114,35 @@ export const CommandMenuSidePanelForDesktop = () => { }, [setTableWidthResizeIsActive]); const handleCollapse = useCallback(() => { - closeCommandMenu(); + closeSidePanelMenu(); setIsResizing(false); setTableWidthResizeIsActive(true); - }, [closeCommandMenu, setTableWidthResizeIsActive]); + }, [closeSidePanelMenu, setTableWidthResizeIsActive]); return ( <> - + - {shouldShowContent && } + {shouldShowContent && } diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandGroup.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelGroup.tsx similarity index 88% rename from packages/twenty-front/src/modules/command-menu/components/CommandGroup.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelGroup.tsx index f104a9b8eb..f29c6fbb4e 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandGroup.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelGroup.tsx @@ -18,12 +18,12 @@ const StyledGroup = styled.div` gap: ${themeCssVariables.spacing[0.5]}; `; -type CommandGroupProps = { +type SidePanelGroupProps = { heading: string; children: React.ReactNode | React.ReactNode[]; }; -export const CommandGroup = ({ heading, children }: CommandGroupProps) => { +export const SidePanelGroup = ({ heading, children }: SidePanelGroupProps) => { if (!children || !React.Children.count(children)) { return null; } diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemWithAddToNavigationDrag.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelItemWithAddToNavigationDrag.tsx similarity index 94% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuItemWithAddToNavigationDrag.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelItemWithAddToNavigationDrag.tsx index ed0876310e..9f014786e9 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemWithAddToNavigationDrag.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelItemWithAddToNavigationDrag.tsx @@ -10,7 +10,16 @@ import { addToNavPayloadRegistryState } from '@/navigation-menu-item/states/addT import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import type { AddToNavigationDragPayload } from '@/navigation-menu-item/types/add-to-navigation-drag-payload'; -type CommandMenuItemWithAddToNavigationDragProps = { +const StyledDraggableMenuItem = styled.div` + cursor: grab; + width: 100%; + + &:active { + cursor: grabbing; + } +`; + +type SidePanelItemWithAddToNavigationDragProps = { icon?: IconComponent; customIconContent?: ReactNode; label: string; @@ -21,16 +30,7 @@ type CommandMenuItemWithAddToNavigationDragProps = { dragIndex?: number; }; -const StyledDraggableMenuItem = styled.div` - cursor: grab; - width: 100%; - - &:active { - cursor: grabbing; - } -`; - -export const CommandMenuItemWithAddToNavigationDrag = ({ +export const SidePanelItemWithAddToNavigationDrag = ({ icon, customIconContent, label, @@ -39,7 +39,7 @@ export const CommandMenuItemWithAddToNavigationDrag = ({ onClick, payload, dragIndex, -}: CommandMenuItemWithAddToNavigationDragProps) => { +}: SidePanelItemWithAddToNavigationDragProps) => { const { t } = useLingui(); const setAddToNavPayloadRegistry = useSetAtomState( addToNavPayloadRegistryState, diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuLinkInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelLinkInfo.tsx similarity index 75% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuLinkInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelLinkInfo.tsx index 57a585dae9..e356762056 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuLinkInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelLinkInfo.tsx @@ -1,9 +1,9 @@ import { useLingui } from '@lingui/react/macro'; import { IconLink } from 'twenty-ui/display'; -import { CommandMenuPageInfoLayout } from '@/command-menu/components/CommandMenuPageInfoLayout'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuShouldFocusTitleInputComponentState } from '@/command-menu/states/commandMenuShouldFocusTitleInputComponentState'; +import { SidePanelPageInfoLayout } from '@/side-panel/components/SidePanelPageInfoLayout'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelShouldFocusTitleInputComponentState } from '@/side-panel/states/sidePanelShouldFocusTitleInputComponentState'; import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/NavigationMenuItemStyleIcon'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { useUpdateLinkInDraft } from '@/navigation-menu-item/hooks/useUpdateLinkInDraft'; @@ -13,16 +13,14 @@ import { TitleInput } from '@/ui/input/components/TitleInput'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; -export const CommandMenuLinkInfo = () => { +export const SidePanelLinkInfo = () => { const { t } = useLingui(); - const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState); - const [ - commandMenuShouldFocusTitleInput, - setCommandMenuShouldFocusTitleInput, - ] = useAtomComponentState( - commandMenuShouldFocusTitleInputComponentState, - commandMenuPageInfo.instanceId, - ); + const sidePanelPageInfo = useAtomStateValue(sidePanelPageInfoState); + const [sidePanelShouldFocusTitleInput, setSidePanelShouldFocusTitleInput] = + useAtomComponentState( + sidePanelShouldFocusTitleInputComponentState, + sidePanelPageInfo.instanceId, + ); const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeState, ); @@ -59,7 +57,7 @@ export const CommandMenuLinkInfo = () => { }; return ( - { onClickOutside={handleSave} onTab={handleSave} onShiftTab={handleSave} - shouldFocus={commandMenuShouldFocusTitleInput} - onFocus={() => setCommandMenuShouldFocusTitleInput(false)} + shouldFocus={sidePanelShouldFocusTitleInput} + onFocus={() => setSidePanelShouldFocusTitleInput(false)} /> } label={t`Link`} diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelList.tsx similarity index 55% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelList.tsx index 9bd04b200e..f5e367abce 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelList.tsx @@ -1,12 +1,12 @@ import { ActionComponent } from '@/action-menu/actions/display/components/ActionComponent'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; -import { type ActionGroupConfig } from '@/command-menu/components/CommandMenu'; -import { CommandMenuDefaultSelectionEffect } from '@/command-menu/components/CommandMenuDefaultSelectionEffect'; -import { COMMAND_MENU_LIST_SELECTABLE_LIST_ID } from '@/command-menu/constants/CommandMenuListSelectableListId'; -import { COMMAND_MENU_SEARCH_BAR_HEIGHT } from '@/command-menu/constants/CommandMenuSearchBarHeight'; -import { COMMAND_MENU_SEARCH_BAR_PADDING } from '@/command-menu/constants/CommandMenuSearchBarPadding'; -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; -import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; +import { SidePanelDefaultSelectionEffect } from '@/side-panel/components/SidePanelDefaultSelectionEffect'; +import { SIDE_PANEL_SELECTABLE_LIST_ID } from '@/side-panel/constants/SidePanelSelectableListId'; +import { SIDE_PANEL_TOP_BAR_HEIGHT } from '@/side-panel/constants/SidePanelTopBarHeight'; +import { SIDE_PANEL_LIST_PADDING } from '@/side-panel/constants/SidePanelListPadding'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; +import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState'; +import { type SidePanelActionGroupConfig } from '@/side-panel/types/SidePanelActionGroupConfig'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; @@ -14,8 +14,8 @@ import { styled } from '@linaria/react'; import { t } from '@lingui/core/macro'; import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants'; -export type CommandMenuListProps = { - commandGroups: ActionGroupConfig[]; +export type SidePanelListProps = { + commandGroups: SidePanelActionGroupConfig[]; selectableItemIds: string[]; children?: React.ReactNode; loading?: boolean; @@ -25,8 +25,7 @@ export type CommandMenuListProps = { const StyledInnerList = styled.div` max-height: calc( - 100dvh - ${COMMAND_MENU_SEARCH_BAR_HEIGHT}px - - ${COMMAND_MENU_SEARCH_BAR_PADDING * 2}px + 100dvh - ${SIDE_PANEL_TOP_BAR_HEIGHT}px - ${SIDE_PANEL_LIST_PADDING * 2}px ); padding-left: ${themeCssVariables.spacing[2]}; padding-right: ${themeCssVariables.spacing[2]}; @@ -35,13 +34,12 @@ const StyledInnerList = styled.div` @media (min-width: ${MOBILE_VIEWPORT}px) { max-height: calc( - 100dvh - ${COMMAND_MENU_SEARCH_BAR_HEIGHT}px - - ${COMMAND_MENU_SEARCH_BAR_PADDING * 2}px + 100dvh - ${SIDE_PANEL_TOP_BAR_HEIGHT}px - ${SIDE_PANEL_LIST_PADDING * 2}px ); } `; -const StyledCommandMenuList = styled.div` +const StyledSidePanelList = styled.div` overflow-y: hidden; `; @@ -55,41 +53,39 @@ const StyledEmpty = styled.div` white-space: pre-wrap; `; -export const CommandMenuList = ({ +export const SidePanelList = ({ commandGroups, selectableItemIds, children, loading = false, noResults = false, noResultsText, -}: CommandMenuListProps) => { - const setHasUserSelectedCommand = useSetAtomState( - hasUserSelectedCommandState, +}: SidePanelListProps) => { + const setHasUserSelectedSidePanelListItem = useSetAtomState( + hasUserSelectedSidePanelListItemState, ); return ( - - - + + + { - setHasUserSelectedCommand(true); + setHasUserSelectedSidePanelListItem(true); }} > {children} {commandGroups.map(({ heading, items }) => items?.length ? ( - + {items.map((item) => ( ))} - + ) : null, )} {noResults && !loading && ( @@ -98,6 +94,6 @@ export const CommandMenuList = ({ - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuMultipleRecordsInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelMultipleRecordsInfo.tsx similarity index 73% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuMultipleRecordsInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelMultipleRecordsInfo.tsx index 48faba1b78..1215f23fb8 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuMultipleRecordsInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelMultipleRecordsInfo.tsx @@ -1,22 +1,22 @@ import { DEFAULT_RECORD_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/constants/DefaultRecordActionsConfig'; import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/multiple-records/types/MultipleRecordsActionKeys'; import { getActionLabel } from '@/action-menu/utils/getActionLabel'; -import { CommandMenuPageInfoLayout } from '@/command-menu/components/CommandMenuPageInfoLayout'; +import { SidePanelPageInfoLayout } from '@/side-panel/components/SidePanelPageInfoLayout'; import { useFindManyRecordsSelectedInContextStore } from '@/context-store/hooks/useFindManyRecordsSelectedInContextStore'; import { t } from '@lingui/core/macro'; import { useContext } from 'react'; import { ThemeContext } from 'twenty-ui/theme-constants'; -type CommandMenuMultipleRecordsInfoProps = { - commandMenuPageInstanceId: string; +type SidePanelMultipleRecordsInfoProps = { + sidePanelPageInstanceId: string; }; -export const CommandMenuMultipleRecordsInfo = ({ - commandMenuPageInstanceId, -}: CommandMenuMultipleRecordsInfoProps) => { +export const SidePanelMultipleRecordsInfo = ({ + sidePanelPageInstanceId, +}: SidePanelMultipleRecordsInfoProps) => { const { theme } = useContext(ThemeContext); const { totalCount } = useFindManyRecordsSelectedInContextStore({ - instanceId: commandMenuPageInstanceId, + instanceId: sidePanelPageInstanceId, limit: 1, }); @@ -24,7 +24,7 @@ export const CommandMenuMultipleRecordsInfo = ({ DEFAULT_RECORD_ACTIONS_CONFIG[MultipleRecordsActionKeys.UPDATE]; return ( - } iconColor={theme.font.color.tertiary} title={getActionLabel(label)} diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuObjectViewRecordInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelObjectViewRecordInfo.tsx similarity index 90% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuObjectViewRecordInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelObjectViewRecordInfo.tsx index 2d3df58075..775d099dae 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuObjectViewRecordInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelObjectViewRecordInfo.tsx @@ -1,7 +1,7 @@ import { useLingui } from '@lingui/react/macro'; import { OverflowingTextWithTooltip } from 'twenty-ui/display'; -import { CommandMenuPageInfoLayout } from '@/command-menu/components/CommandMenuPageInfoLayout'; +import { SidePanelPageInfoLayout } from '@/side-panel/components/SidePanelPageInfoLayout'; import { NavigationMenuItemIcon } from '@/navigation-menu-item/components/NavigationMenuItemIcon'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { useSelectedNavigationMenuItemEditItem } from '@/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem'; @@ -9,7 +9,7 @@ import { useSelectedNavigationMenuItemEditItemLabel } from '@/navigation-menu-it import { useSelectedNavigationMenuItemEditItemObjectMetadata } from '@/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItemObjectMetadata'; import { ViewKey } from '@/views/types/ViewKey'; -export const CommandMenuObjectViewRecordInfo = () => { +export const SidePanelObjectViewRecordInfo = () => { const { t } = useLingui(); const { selectedItem } = useSelectedNavigationMenuItemEditItem(); const { selectedItemLabel } = useSelectedNavigationMenuItemEditItemLabel(); @@ -42,7 +42,7 @@ export const CommandMenuObjectViewRecordInfo = () => { : t`View`; return ( - } title={} label={label} diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelPageInfo.tsx similarity index 52% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelPageInfo.tsx index 5130f4018d..24a6872370 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelPageInfo.tsx @@ -5,23 +5,23 @@ import { OverflowingTextWithTooltip, } from 'twenty-ui/display'; -import { CommandMenuAskAIInfo } from '@/command-menu/components/CommandMenuAskAIInfo'; -import { CommandMenuFolderInfo } from '@/command-menu/components/CommandMenuFolderInfo'; -import { CommandMenuLinkInfo } from '@/command-menu/components/CommandMenuLinkInfo'; -import { CommandMenuMultipleRecordsInfo } from '@/command-menu/components/CommandMenuMultipleRecordsInfo'; -import { CommandMenuObjectViewRecordInfo } from '@/command-menu/components/CommandMenuObjectViewRecordInfo'; -import { CommandMenuPageInfoLayout } from '@/command-menu/components/CommandMenuPageInfoLayout'; -import { CommandMenuPageLayoutInfo } from '@/command-menu/components/CommandMenuPageLayoutInfo'; -import { CommandMenuRecordInfo } from '@/command-menu/components/CommandMenuRecordInfo'; -import { CommandMenuWorkflowStepInfo } from '@/command-menu/components/CommandMenuWorkflowStepInfo'; +import { SidePanelAskAIInfo } from '@/side-panel/components/SidePanelAskAIInfo'; +import { SidePanelFolderInfo } from '@/side-panel/components/SidePanelFolderInfo'; +import { SidePanelLinkInfo } from '@/side-panel/components/SidePanelLinkInfo'; +import { SidePanelMultipleRecordsInfo } from '@/side-panel/components/SidePanelMultipleRecordsInfo'; +import { SidePanelObjectViewRecordInfo } from '@/side-panel/components/SidePanelObjectViewRecordInfo'; +import { SidePanelPageInfoLayout } from '@/side-panel/components/SidePanelPageInfoLayout'; +import { SidePanelPageLayoutInfo } from '@/side-panel/components/SidePanelPageLayoutInfo'; +import { SidePanelRecordInfo } from '@/side-panel/components/SidePanelRecordInfo'; +import { SidePanelWorkflowStepInfo } from '@/side-panel/components/SidePanelWorkflowStepInfo'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { useWorkspaceSectionItems } from '@/navigation-menu-item/hooks/useWorkspaceSectionItems'; import { selectedNavigationMenuItemInEditModeState } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeState'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; +import { type SidePanelContextChipProps } from '@/side-panel/components/SidePanelContextChip'; import { useContext } from 'react'; -import { type CommandMenuContextChipProps } from './CommandMenuContextChip'; import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; const StyledPageTitle = styled.div` color: ${themeCssVariables.font.color.primary}; @@ -29,11 +29,11 @@ const StyledPageTitle = styled.div` font-weight: ${themeCssVariables.font.weight.semiBold}; `; -type CommandMenuPageInfoProps = { - pageChip: CommandMenuContextChipProps | undefined; +type SidePanelPageInfoProps = { + pageChip: SidePanelContextChipProps | undefined; }; -export const CommandMenuPageInfo = ({ pageChip }: CommandMenuPageInfoProps) => { +export const SidePanelPageInfo = ({ pageChip }: SidePanelPageInfoProps) => { const { theme } = useContext(ThemeContext); const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeState, @@ -45,7 +45,7 @@ export const CommandMenuPageInfo = ({ pageChip }: CommandMenuPageInfoProps) => { } const isNavigationMenuItemEditPage = - pageChip.page?.page === CommandMenuPages.NavigationMenuItemEdit; + pageChip.page?.page === SidePanelPages.NavigationMenuItemEdit; const selectedNavItem = isNavigationMenuItemEditPage ? items.find((item) => item.id === selectedNavigationMenuItemInEditMode) : undefined; @@ -54,82 +54,82 @@ export const CommandMenuPageInfo = ({ pageChip }: CommandMenuPageInfoProps) => { const itemType = selectedNavItem.itemType; if (itemType === NavigationMenuItemType.FOLDER) { - return ; + return ; } if (itemType === NavigationMenuItemType.LINK) { - return ; + return ; } if ( itemType === NavigationMenuItemType.VIEW || itemType === NavigationMenuItemType.RECORD ) { - return ; + return ; } } - const isRecordPage = pageChip.page?.page === CommandMenuPages.ViewRecord; + const isRecordPage = pageChip.page?.page === SidePanelPages.ViewRecord; if (isRecordPage && isDefined(pageChip.page?.pageId)) { return ( - + ); } const isWorkflowStepPage = pageChip.page?.page ? [ - CommandMenuPages.WorkflowStepEdit, - CommandMenuPages.WorkflowStepView, - CommandMenuPages.WorkflowRunStepView, + SidePanelPages.WorkflowStepEdit, + SidePanelPages.WorkflowStepView, + SidePanelPages.WorkflowRunStepView, ].includes(pageChip.page?.page) : false; if (isWorkflowStepPage && isDefined(pageChip.page?.pageId)) { return ( - ); } const isPageLayoutPage = pageChip.page?.page ? [ - CommandMenuPages.PageLayoutWidgetTypeSelect, - CommandMenuPages.PageLayoutGraphTypeSelect, - CommandMenuPages.PageLayoutGraphFilter, - CommandMenuPages.PageLayoutIframeSettings, - CommandMenuPages.PageLayoutTabSettings, - CommandMenuPages.PageLayoutFieldsSettings, - CommandMenuPages.PageLayoutFieldsLayout, + SidePanelPages.PageLayoutWidgetTypeSelect, + SidePanelPages.PageLayoutGraphTypeSelect, + SidePanelPages.PageLayoutGraphFilter, + SidePanelPages.PageLayoutIframeSettings, + SidePanelPages.PageLayoutTabSettings, + SidePanelPages.PageLayoutFieldsSettings, + SidePanelPages.PageLayoutFieldsLayout, ].includes(pageChip.page?.page) : false; if (isPageLayoutPage) { - return ; + return ; } const isMultipleRecordsPage = - pageChip.page?.page === CommandMenuPages.UpdateRecords; + pageChip.page?.page === SidePanelPages.UpdateRecords; if (isMultipleRecordsPage && isDefined(pageChip.page?.pageId)) { return ( - ); } - const isAskAIPage = pageChip.page?.page === CommandMenuPages.AskAI; + const isAskAIPage = pageChip.page?.page === SidePanelPages.AskAI; if (isAskAIPage) { - return ; + return ; } - if (pageChip.page?.page === CommandMenuPages.NavigationMenuAddItem) { + if (pageChip.page?.page === SidePanelPages.NavigationMenuAddItem) { return ( - { +}: SidePanelPageInfoLayoutProps) => { return ( {icon && ( diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelPageLayoutInfo.tsx similarity index 72% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelPageLayoutInfo.tsx index 8adc7bfb0f..0450c08f21 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelPageLayoutInfo.tsx @@ -1,12 +1,12 @@ -import { CommandMenuDashboardPageLayoutInfo } from '@/command-menu/components/CommandMenuDashboardPageLayoutInfo'; -import { CommandMenuRecordPageLayoutInfo } from '@/command-menu/components/CommandMenuRecordPageLayoutInfo'; +import { SidePanelDashboardPageLayoutInfo } from '@/side-panel/components/SidePanelDashboardPageLayoutInfo'; +import { SidePanelRecordPageLayoutInfo } from '@/side-panel/components/SidePanelRecordPageLayoutInfo'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; -export const CommandMenuPageLayoutInfo = () => { +export const SidePanelPageLayoutInfo = () => { const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, ); @@ -23,8 +23,8 @@ export const CommandMenuPageLayoutInfo = () => { objectMetadataItem.nameSingular === CoreObjectNameSingular.Dashboard; if (isDashboardContext) { - return ; + return ; } - return ; + return ; }; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelPageLayoutInfoContent.tsx similarity index 71% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelPageLayoutInfoContent.tsx index 76b1fddfbf..a1122a403f 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelPageLayoutInfoContent.tsx @@ -1,8 +1,8 @@ -import { usePageLayoutHeaderInfo } from '@/command-menu/components/hooks/usePageLayoutHeaderInfo'; -import { useUpdateCommandMenuPageInfo } from '@/command-menu/hooks/useUpdateCommandMenuPageInfo'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { commandMenuShouldFocusTitleInputComponentState } from '@/command-menu/states/commandMenuShouldFocusTitleInputComponentState'; +import { usePageLayoutHeaderInfo } from '@/side-panel/components/hooks/usePageLayoutHeaderInfo'; +import { useUpdateSidePanelPageInfo } from '@/side-panel/hooks/useUpdateSidePanelPageInfo'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { sidePanelShouldFocusTitleInputComponentState } from '@/side-panel/states/sidePanelShouldFocusTitleInputComponentState'; import { useUpdatePageLayoutTab } from '@/page-layout/hooks/useUpdatePageLayoutTab'; import { useUpdatePageLayoutWidget } from '@/page-layout/hooks/useUpdatePageLayoutWidget'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; @@ -14,31 +14,30 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use import { isNonEmptyString } from '@sniptt/guards'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useContext, useState } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; -import { CommandMenuPageInfoLayout } from './CommandMenuPageInfoLayout'; +import { SidePanelPageInfoLayout } from './SidePanelPageInfoLayout'; import { ThemeContext } from 'twenty-ui/theme-constants'; -export const CommandMenuPageLayoutInfoContent = ({ + +export const SidePanelPageLayoutInfoContent = ({ pageLayoutId, }: { pageLayoutId: string; }) => { const { theme } = useContext(ThemeContext); const { getIcon } = useIcons(); - const commandMenuPage = useAtomStateValue(commandMenuPageState); - const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState); + const sidePanelPage = useAtomStateValue(sidePanelPageState); + const sidePanelPageInfo = useAtomStateValue(sidePanelPageInfoState); - const [ - commandMenuShouldFocusTitleInput, - setCommandMenuShouldFocusTitleInput, - ] = useAtomComponentState( - commandMenuShouldFocusTitleInputComponentState, - commandMenuPageInfo.instanceId, - ); + const [sidePanelShouldFocusTitleInput, setSidePanelShouldFocusTitleInput] = + useAtomComponentState( + sidePanelShouldFocusTitleInputComponentState, + sidePanelPageInfo.instanceId, + ); const handleTitleInputOpen = () => { - setCommandMenuShouldFocusTitleInput(false); + setSidePanelShouldFocusTitleInput(false); }; const pageLayoutDraft = useAtomComponentStateValue( @@ -56,14 +55,14 @@ export const CommandMenuPageLayoutInfoContent = ({ pageLayoutId, ); - const { updateCommandMenuPageInfo } = useUpdateCommandMenuPageInfo(); + const { updateSidePanelPageInfo } = useUpdateSidePanelPageInfo(); const { updatePageLayoutWidget } = useUpdatePageLayoutWidget(pageLayoutId); const { updatePageLayoutTab } = useUpdatePageLayoutTab(pageLayoutId); const [editedTitle, setEditedTitle] = useState(null); const headerInfo = usePageLayoutHeaderInfo({ - commandMenuPage, + sidePanelPage, draftPageLayout: pageLayoutDraft, pageLayoutEditingWidgetId, openTabId: pageLayoutTabSettingsOpenTabId, @@ -97,13 +96,13 @@ export const CommandMenuPageLayoutInfoContent = ({ return; } - updateCommandMenuPageInfo({ + updateSidePanelPageInfo({ pageTitle: finalTitle, pageIcon: Icon, }); if ( - commandMenuPage === CommandMenuPages.PageLayoutTabSettings && + sidePanelPage === SidePanelPages.PageLayoutTabSettings && isDefined(tab) ) { updatePageLayoutTab(tab.id, { title: finalTitle }); @@ -117,7 +116,7 @@ export const CommandMenuPageLayoutInfoContent = ({ }; return ( - @@ -126,7 +125,7 @@ export const CommandMenuPageLayoutInfoContent = ({ iconColor={headerIconColor} title={ } diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelRecordInfo.tsx similarity index 90% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelRecordInfo.tsx index cf8eb4d722..48a12c156a 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelRecordInfo.tsx @@ -1,6 +1,6 @@ import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; -import { viewableRecordNameSingularComponentState } from '@/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; +import { viewableRecordNameSingularComponentState } from '@/side-panel/pages/record-page/states/viewableRecordNameSingularComponentState'; import { useLabelIdentifierFieldMetadataItem } from '@/object-metadata/hooks/useLabelIdentifierFieldMetadataItem'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { useIsRecordFieldReadOnly } from '@/object-record/read-only/hooks/useIsRecordFieldReadOnly'; @@ -20,16 +20,16 @@ import { Avatar } from 'twenty-ui/display'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { dateLocaleState } from '~/localization/states/dateLocaleState'; import { beautifyPastDateRelativeToNow } from '~/utils/date-utils'; -import { CommandMenuPageInfoLayout } from './CommandMenuPageInfoLayout'; +import { SidePanelPageInfoLayout } from './SidePanelPageInfoLayout'; -export const CommandMenuRecordInfo = ({ - commandMenuPageInstanceId, +export const SidePanelRecordInfo = ({ + sidePanelPageInstanceId, }: { - commandMenuPageInstanceId: string; + sidePanelPageInstanceId: string; }) => { const viewableRecordNameSingular = useAtomComponentStateValue( viewableRecordNameSingularComponentState, - commandMenuPageInstanceId, + sidePanelPageInstanceId, ); const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, @@ -37,7 +37,7 @@ export const CommandMenuRecordInfo = ({ const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, - commandMenuPageInstanceId, + sidePanelPageInstanceId, ); const { objectNameSingular, objectRecordId } = useRecordShowPage( @@ -98,7 +98,7 @@ export const CommandMenuRecordInfo = ({ }; return ( - { + const { pageLayoutId } = + usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord(); + + return ; +}; diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelRouter.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelRouter.tsx new file mode 100644 index 0000000000..6213b104ee --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelRouter.tsx @@ -0,0 +1,60 @@ +import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuContextProvider'; +import { SidePanelContainer } from '@/side-panel/components/SidePanelContainer'; +import { SidePanelTopBar } from '@/side-panel/components/SidePanelTopBar'; +import { SIDE_PANEL_PAGES_CONFIG } from '@/side-panel/constants/SidePanelPagesConfig'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { styled } from '@linaria/react'; +import { motion } from 'framer-motion'; +import { useContext } from 'react'; +import { isDefined } from 'twenty-shared/utils'; +import { ThemeContext } from 'twenty-ui/theme-constants'; + +const StyledSidePanelContent = styled.div` + flex: 1; + overflow-y: auto; +`; + +export const SidePanelRouter = () => { + const sidePanelPage = useAtomStateValue(sidePanelPageState); + const sidePanelPageInfo = useAtomStateValue(sidePanelPageInfoState); + + const sidePanelPageComponent = isDefined(sidePanelPage) ? ( + SIDE_PANEL_PAGES_CONFIG.get(sidePanelPage) + ) : ( + <> + ); + + const { theme } = useContext(ThemeContext); + + return ( + + + + + + + + {sidePanelPageComponent} + + + + + ); +}; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuSubViewWithSearch.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelSubViewWithSearch.tsx similarity index 88% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuSubViewWithSearch.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelSubViewWithSearch.tsx index 6b1a65c123..8c4f93b794 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuSubViewWithSearch.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelSubViewWithSearch.tsx @@ -1,7 +1,7 @@ import { styled } from '@linaria/react'; import { type ReactNode } from 'react'; -import { SidePanelSubPageNavigationHeader } from '@/command-menu/pages/common/components/SidePanelSubPageNavigationHeader'; +import { SidePanelSubPageNavigationHeader } from '@/side-panel/pages/common/components/SidePanelSubPageNavigationHeader'; import { themeCssVariables } from 'twenty-ui/theme-constants'; const StyledSubViewContainer = styled.div` @@ -49,7 +49,7 @@ const StyledScrollableListWrapper = styled.div` } `; -type CommandMenuSubViewWithSearchProps = { +type SidePanelSubViewWithSearchProps = { backBarTitle: string; onBack: () => void; searchPlaceholder: string; @@ -59,7 +59,7 @@ type CommandMenuSubViewWithSearchProps = { children?: ReactNode; }; -export const CommandMenuSubViewWithSearch = ({ +export const SidePanelSubViewWithSearch = ({ backBarTitle, onBack, searchPlaceholder, @@ -67,7 +67,7 @@ export const CommandMenuSubViewWithSearch = ({ onSearchChange, searchInputProps, children, -}: CommandMenuSubViewWithSearchProps) => ( +}: SidePanelSubViewWithSearchProps) => ( ` justify-content: space-between; font-size: ${themeCssVariables.font.size.lg}; height: ${({ isMobile }) => - isMobile - ? COMMAND_MENU_SEARCH_BAR_HEIGHT_MOBILE - : COMMAND_MENU_SEARCH_BAR_HEIGHT}px; + isMobile ? SIDE_PANEL_TOP_BAR_HEIGHT_MOBILE : SIDE_PANEL_TOP_BAR_HEIGHT}px; margin: 0; outline: none; position: relative; @@ -78,30 +76,30 @@ const StyledContentContainer = styled.div` overflow: hidden; `; -export const CommandMenuTopBar = () => { - const { theme } = useContext(ThemeContext); - const [commandMenuSearch, setCommandMenuSearch] = useAtomState( - commandMenuSearchState, - ); +export const SidePanelTopBar = () => { + const [sidePanelSearch, setSidePanelSearch] = + useAtomState(sidePanelSearchState); const inputRef = useRef(null); const { t } = useLingui(); const handleSearchChange = (event: React.ChangeEvent) => { - setCommandMenuSearch(event.target.value); + setSidePanelSearch(event.target.value); }; const isMobile = useIsMobile(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); - const commandMenuPage = useAtomStateValue(commandMenuPageState); + const sidePanelPage = useAtomStateValue(sidePanelPageState); - const commandMenuNavigationStack = useAtomStateValue( - commandMenuNavigationStackState, + const sidePanelNavigationStack = useAtomStateValue( + sidePanelNavigationStackState, ); - const { contextChips } = useCommandMenuContextChips(); + const { theme } = useContext(ThemeContext); + + const { contextChips } = useSidePanelContextChips(); const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); const { removeFocusItemFromFocusStackById } = @@ -126,10 +124,10 @@ export const CommandMenuTopBar = () => { }); }; - const canGoBack = commandMenuNavigationStack.length > 1; + const canGoBack = sidePanelNavigationStack.length > 1; const shouldShowCloseButton = - !isMobile && commandMenuNavigationStack.length === 1; + !isMobile && sidePanelNavigationStack.length === 1; const shouldShowBackButton = canGoBack; @@ -146,7 +144,7 @@ export const CommandMenuTopBar = () => { duration: theme.animation.duration.instant, }} > - + )} {shouldShowCloseButton && ( @@ -160,33 +158,33 @@ export const CommandMenuTopBar = () => { Icon={IconX} size="small" variant="tertiary" - onClick={closeCommandMenu} + onClick={closeSidePanelMenu} /> )} {lastChip && - commandMenuPage !== CommandMenuPages.Root && - commandMenuPage !== CommandMenuPages.SearchRecords && ( - + sidePanelPage !== SidePanelPages.Root && + sidePanelPage !== SidePanelPages.SearchRecords && ( + )} - {(commandMenuPage === CommandMenuPages.Root || - commandMenuPage === CommandMenuPages.SearchRecords) && ( + {(sidePanelPage === SidePanelPages.Root || + sidePanelPage === SidePanelPages.SearchRecords) && ( <> - + )} - + ); }; diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBarInputFocusEffect.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBarInputFocusEffect.tsx new file mode 100644 index 0000000000..adff6f3b2d --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBarInputFocusEffect.tsx @@ -0,0 +1,25 @@ +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useEffect } from 'react'; +import { SidePanelPages } from 'twenty-shared/types'; + +type SidePanelTopBarInputFocusEffectProps = { + inputRef: React.RefObject; +}; + +export const SidePanelTopBarInputFocusEffect = ({ + inputRef, +}: SidePanelTopBarInputFocusEffectProps) => { + const sidePanelPage = useAtomStateValue(sidePanelPageState); + + useEffect(() => { + if ( + sidePanelPage === SidePanelPages.Root || + sidePanelPage === SidePanelPages.SearchRecords + ) { + inputRef.current?.focus(); + } + }, [sidePanelPage, inputRef]); + + return null; +}; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarRightCornerIcon.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBarRightCornerIcon.tsx similarity index 72% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarRightCornerIcon.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelTopBarRightCornerIcon.tsx index 50b7cc95a4..5d2695039c 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarRightCornerIcon.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelTopBarRightCornerIcon.tsx @@ -1,10 +1,10 @@ -import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; +import { useOpenAskAIPageInSidePanel } from '@/side-panel/hooks/useOpenAskAIPageInSidePanel'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { styled } from '@linaria/react'; import { t } from '@lingui/core/macro'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconEdit, IconSparkles } from 'twenty-ui/display'; import { IconButton } from 'twenty-ui/input'; import { useIsMobile } from 'twenty-ui/utilities'; @@ -17,11 +17,11 @@ const StyledIconButton = styled(IconButton)` color: ${themeCssVariables.font.color.secondary}; `; -export const CommandMenuTopBarRightCornerIcon = () => { +export const SidePanelTopBarRightCornerIcon = () => { const isMobile = useIsMobile(); const isAiEnabled = useIsFeatureEnabled(FeatureFlagKey.IS_AI_ENABLED); - const commandMenuPage = useAtomStateValue(commandMenuPageState); - const { openAskAIPage } = useOpenAskAIPageInCommandMenu(); + const sidePanelPage = useAtomStateValue(sidePanelPageState); + const { openAskAIPage } = useOpenAskAIPageInSidePanel(); const { createChatThread } = useCreateNewAIChatThread(); if (isMobile || !isAiEnabled) { @@ -29,9 +29,9 @@ export const CommandMenuTopBarRightCornerIcon = () => { } const isOnAskAIPage = [ - CommandMenuPages.AskAI, - CommandMenuPages.ViewPreviousAIChats, - ].includes(commandMenuPage); + SidePanelPages.AskAI, + SidePanelPages.ViewPreviousAIChats, + ].includes(sidePanelPage); if (!isOnAskAIPage) { return ( diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelWidthEffect.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelWidthEffect.tsx new file mode 100644 index 0000000000..e5585df8c5 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelWidthEffect.tsx @@ -0,0 +1,20 @@ +import { useEffect } from 'react'; + +import { + SIDE_PANEL_WIDTH_VAR, + sidePanelWidthState, +} from '@/side-panel/states/sidePanelWidthState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; + +export const SidePanelWidthEffect = () => { + const sidePanelWidth = useAtomStateValue(sidePanelWidthState); + + useEffect(() => { + document.documentElement.style.setProperty( + SIDE_PANEL_WIDTH_VAR, + `${sidePanelWidth}px`, + ); + }, [sidePanelWidth]); + + return null; +}; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelWorkflowStepInfo.tsx similarity index 78% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx rename to packages/twenty-front/src/modules/side-panel/components/SidePanelWorkflowStepInfo.tsx index 60f6b5e96c..98c84e73db 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx +++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelWorkflowStepInfo.tsx @@ -1,7 +1,7 @@ -import { useUpdateCommandMenuPageInfo } from '@/command-menu/hooks/useUpdateCommandMenuPageInfo'; -import { useCommandMenuWorkflowIdOrThrow } from '@/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow'; -import { commandMenuWorkflowStepIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; +import { useUpdateSidePanelPageInfo } from '@/side-panel/hooks/useUpdateSidePanelPageInfo'; +import { useSidePanelWorkflowIdOrThrow } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow'; +import { sidePanelWorkflowStepIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowStepIdComponentState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { TitleInput } from '@/ui/input/components/TitleInput'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; @@ -19,37 +19,37 @@ import { getTriggerIcon } from '@/workflow/workflow-trigger/utils/getTriggerIcon import { getTriggerIconColor } from '@/workflow/workflow-trigger/utils/getTriggerIconColor'; import { t } from '@lingui/core/macro'; import { useContext, useState } from 'react'; -import { CommandMenuPages, CoreObjectNameSingular } from 'twenty-shared/types'; +import { CoreObjectNameSingular, SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { TRIGGER_STEP_ID } from 'twenty-shared/workflow'; import { useIcons } from 'twenty-ui/display'; -import { CommandMenuPageInfoLayout } from './CommandMenuPageInfoLayout'; +import { SidePanelPageInfoLayout } from './SidePanelPageInfoLayout'; import { ThemeContext } from 'twenty-ui/theme-constants'; -export const CommandMenuWorkflowStepInfo = ({ - commandMenuPageInstanceId, +export const SidePanelWorkflowStepInfo = ({ + sidePanelPageInstanceId, }: { - commandMenuPageInstanceId: string; + sidePanelPageInstanceId: string; }) => { const { theme } = useContext(ThemeContext); const { getIcon } = useIcons(); - const commandMenuPage = useAtomStateValue(commandMenuPageState); + const sidePanelPage = useAtomStateValue(sidePanelPageState); - const workflowId = useCommandMenuWorkflowIdOrThrow(); + const workflowId = useSidePanelWorkflowIdOrThrow(); - const commandMenuWorkflowStepId = useAtomComponentStateValue( - commandMenuWorkflowStepIdComponentState, - commandMenuPageInstanceId, + const sidePanelWorkflowStepId = useAtomComponentStateValue( + sidePanelWorkflowStepIdComponentState, + sidePanelPageInstanceId, ); const workflowWithCurrentVersion = useWorkflowWithCurrentVersion(workflowId); const isReadonly = - commandMenuPage === CommandMenuPages.WorkflowStepView || - commandMenuPage === CommandMenuPages.WorkflowRunStepView; + sidePanelPage === SidePanelPages.WorkflowStepView || + sidePanelPage === SidePanelPages.WorkflowRunStepView; - const { updateCommandMenuPageInfo } = useUpdateCommandMenuPageInfo(); + const { updateSidePanelPageInfo } = useUpdateSidePanelPageInfo(); const instanceId = getWorkflowVisualizerComponentInstanceId({ recordId: workflowId, @@ -70,13 +70,13 @@ export const CommandMenuWorkflowStepInfo = ({ id: undefined, }; - const isTriggerStep = commandMenuWorkflowStepId === TRIGGER_STEP_ID; + const isTriggerStep = sidePanelWorkflowStepId === TRIGGER_STEP_ID; const stepDefinition = - isDefined(commandMenuWorkflowStepId) && isDefined(trigger) + isDefined(sidePanelWorkflowStepId) && isDefined(trigger) ? isTriggerStep || isDefined(steps) ? getStepDefinitionOrThrow({ - stepId: commandMenuWorkflowStepId, + stepId: sidePanelWorkflowStepId, trigger, steps, }) @@ -108,7 +108,7 @@ export const CommandMenuWorkflowStepInfo = ({ if ( !isDefined(workflowId) || - !isDefined(commandMenuWorkflowStepId) || + !isDefined(sidePanelWorkflowStepId) || !isDefined(workflowWithCurrentVersion?.currentVersion) || !isDefined(stepDefinition) || !isDefined(stepDefinition.definition) @@ -133,7 +133,7 @@ export const CommandMenuWorkflowStepInfo = ({ return; } - updateCommandMenuPageInfo({ + updateSidePanelPageInfo({ pageTitle: title, pageIcon: Icon, }); @@ -167,7 +167,7 @@ export const CommandMenuWorkflowStepInfo = ({ }; return ( - @@ -176,7 +176,7 @@ export const CommandMenuWorkflowStepInfo = ({ iconColor={headerIconColor} title={ { ); }; -const meta: Meta = { - title: 'Modules/CommandMenu/CommandMenuContextRecordChip', - component: CommandMenuContextRecordsChip, +const meta: Meta = { + title: 'Modules/SidePanel/SidePanelContextRecordChip', + component: SidePanelContextRecordsChip, decorators: [ ContextStoreDecorator, ChipGeneratorsDecorator, @@ -227,7 +227,7 @@ const meta: Meta = { }; export default meta; -type Story = StoryObj; +type Story = StoryObj; export const Default: Story = {}; diff --git a/packages/twenty-front/src/modules/command-menu/components/hooks/usePageLayoutHeaderInfo.ts b/packages/twenty-front/src/modules/side-panel/components/hooks/usePageLayoutHeaderInfo.ts similarity index 82% rename from packages/twenty-front/src/modules/command-menu/components/hooks/usePageLayoutHeaderInfo.ts rename to packages/twenty-front/src/modules/side-panel/components/hooks/usePageLayoutHeaderInfo.ts index 063ff8466f..d36308d423 100644 --- a/packages/twenty-front/src/modules/command-menu/components/hooks/usePageLayoutHeaderInfo.ts +++ b/packages/twenty-front/src/modules/side-panel/components/hooks/usePageLayoutHeaderInfo.ts @@ -1,10 +1,10 @@ -import { GRAPH_TYPE_INFORMATION } from '@/command-menu/pages/page-layout/constants/GraphTypeInformation'; -import { getCurrentGraphTypeFromConfig } from '@/command-menu/pages/page-layout/utils/getCurrentGraphTypeFromConfig'; -import { isWidgetConfigurationOfTypeGraph } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph'; +import { GRAPH_TYPE_INFORMATION } from '@/side-panel/pages/page-layout/constants/GraphTypeInformation'; +import { getCurrentGraphTypeFromConfig } from '@/side-panel/pages/page-layout/utils/getCurrentGraphTypeFromConfig'; +import { isWidgetConfigurationOfTypeGraph } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph'; import { type PageLayoutTab } from '@/page-layout/types/PageLayoutTab'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { t } from '@lingui/core/macro'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { IconAppWindow, @@ -27,7 +27,7 @@ type PageLayoutHeaderInfo = { }; type UsePageLayoutHeaderInfoParams = { - commandMenuPage: CommandMenuPages; + sidePanelPage: SidePanelPages; draftPageLayout: { tabs: PageLayoutTab[]; }; @@ -37,7 +37,7 @@ type UsePageLayoutHeaderInfoParams = { }; export const usePageLayoutHeaderInfo = ({ - commandMenuPage, + sidePanelPage, draftPageLayout, pageLayoutEditingWidgetId, openTabId, @@ -46,8 +46,8 @@ export const usePageLayoutHeaderInfo = ({ const { theme } = useContext(ThemeContext); const iconColor = theme.font.color.tertiary; - switch (commandMenuPage) { - case CommandMenuPages.PageLayoutTabSettings: { + switch (sidePanelPage) { + case SidePanelPages.PageLayoutTabSettings: { if (!isDefined(openTabId)) { return null; } @@ -75,7 +75,7 @@ export const usePageLayoutHeaderInfo = ({ }; } - case CommandMenuPages.PageLayoutIframeSettings: { + case SidePanelPages.PageLayoutIframeSettings: { if (!isDefined(pageLayoutEditingWidgetId)) { return null; } @@ -105,8 +105,8 @@ export const usePageLayoutHeaderInfo = ({ }; } - case CommandMenuPages.PageLayoutGraphTypeSelect: - case CommandMenuPages.PageLayoutGraphFilter: { + case SidePanelPages.PageLayoutGraphTypeSelect: + case SidePanelPages.PageLayoutGraphFilter: { if (!isDefined(pageLayoutEditingWidgetId)) { return null; } @@ -130,7 +130,7 @@ export const usePageLayoutHeaderInfo = ({ const graphTypeLabel = t(graphTypeInfo.label); const headerType = - commandMenuPage === CommandMenuPages.PageLayoutGraphFilter + sidePanelPage === SidePanelPages.PageLayoutGraphFilter ? graphTypeLabel : t`Chart`; @@ -145,14 +145,14 @@ export const usePageLayoutHeaderInfo = ({ headerIconColor: iconColor, headerType, title, - isReadonly: commandMenuPage === CommandMenuPages.PageLayoutGraphFilter, + isReadonly: sidePanelPage === SidePanelPages.PageLayoutGraphFilter, tab: undefined, widgetInEditMode, }; } - case CommandMenuPages.PageLayoutFieldsSettings: - case CommandMenuPages.PageLayoutFieldsLayout: { + case SidePanelPages.PageLayoutFieldsSettings: + case SidePanelPages.PageLayoutFieldsLayout: { if (!isDefined(pageLayoutEditingWidgetId)) { return null; } @@ -182,7 +182,7 @@ export const usePageLayoutHeaderInfo = ({ }; } - case CommandMenuPages.PageLayoutWidgetTypeSelect: { + case SidePanelPages.PageLayoutWidgetTypeSelect: { return { headerIcon: IconPlus, headerIconColor: iconColor, diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuAnimationVariants.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelAnimationVariants.ts similarity index 70% rename from packages/twenty-front/src/modules/command-menu/constants/CommandMenuAnimationVariants.ts rename to packages/twenty-front/src/modules/side-panel/constants/SidePanelAnimationVariants.ts index 7db2daf635..16d0b1f557 100644 --- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuAnimationVariants.ts +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelAnimationVariants.ts @@ -1,6 +1,6 @@ import { themeCssVariables } from 'twenty-ui/theme-constants'; -export const COMMAND_MENU_ANIMATION_VARIANTS = { +export const SIDE_PANEL_ANIMATION_VARIANTS = { fullScreen: { x: '0%', width: '100%', @@ -10,14 +10,14 @@ export const COMMAND_MENU_ANIMATION_VARIANTS = { }, normal: { x: '0%', - width: themeCssVariables.rightDrawerWidth, + width: themeCssVariables.sidePanelWidth, height: '100%', bottom: '0', top: '0', }, closed: { x: '100%', - width: themeCssVariables.rightDrawerWidth, + width: themeCssVariables.sidePanelWidth, height: '100%', bottom: '0', top: 'auto', diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelComponentInstanceId.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelComponentInstanceId.ts new file mode 100644 index 0000000000..d8f1cc3103 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelComponentInstanceId.ts @@ -0,0 +1 @@ +export const SIDE_PANEL_COMPONENT_INSTANCE_ID = 'side-panel'; diff --git a/packages/twenty-front/src/modules/ui/layout/resizable-panel/constants/CommandMenuConstraints.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelConstraints.ts similarity index 69% rename from packages/twenty-front/src/modules/ui/layout/resizable-panel/constants/CommandMenuConstraints.ts rename to packages/twenty-front/src/modules/side-panel/constants/SidePanelConstraints.ts index 26eb6b2d8a..456654bb5d 100644 --- a/packages/twenty-front/src/modules/ui/layout/resizable-panel/constants/CommandMenuConstraints.ts +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelConstraints.ts @@ -1,6 +1,6 @@ import { type ResizablePanelConstraints } from '@/ui/layout/resizable-panel/types/ResizablePanelConstraints'; -export const COMMAND_MENU_CONSTRAINTS: ResizablePanelConstraints = { +export const SIDE_PANEL_CONSTRAINTS: ResizablePanelConstraints = { min: 320, max: 600, default: 400, diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelContextChipGroupsDropdownId.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelContextChipGroupsDropdownId.ts new file mode 100644 index 0000000000..8913ded64c --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelContextChipGroupsDropdownId.ts @@ -0,0 +1,2 @@ +export const SIDE_PANEL_CONTEXT_CHIP_GROUPS_DROPDOWN_ID = + 'side-panel-context-chip-groups-dropdown'; diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelFocusId.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelFocusId.ts new file mode 100644 index 0000000000..659768acdb --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelFocusId.ts @@ -0,0 +1 @@ +export const SIDE_PANEL_FOCUS_ID = 'side-panel-focus'; diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelListPadding.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelListPadding.ts new file mode 100644 index 0000000000..27323db4e4 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelListPadding.ts @@ -0,0 +1 @@ +export const SIDE_PANEL_LIST_PADDING = 2; diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelNavigationHistoryDropdownId.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelNavigationHistoryDropdownId.ts new file mode 100644 index 0000000000..d4f68f5c4c --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelNavigationHistoryDropdownId.ts @@ -0,0 +1,2 @@ +export const SIDE_PANEL_NAVIGATION_HISTORY_DROPDOWN_ID = + 'side-panel-navigation-history-dropdown'; diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelPagesConfig.tsx b/packages/twenty-front/src/modules/side-panel/constants/SidePanelPagesConfig.tsx new file mode 100644 index 0000000000..d8f84e0c29 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelPagesConfig.tsx @@ -0,0 +1,79 @@ +import { SidePanelAIChatThreadsPage } from '@/side-panel/pages/AIChatThreads/components/SidePanelAIChatThreadsPage'; +import { SidePanelAskAIPage } from '@/side-panel/pages/ask-ai/components/SidePanelAskAIPage'; +import { SidePanelCalendarEventPage } from '@/side-panel/pages/calendar-event/components/SidePanelCalendarEventPage'; +import { SidePanelFrontComponentPage } from '@/side-panel/pages/front-component/components/SidePanelFrontComponentPage'; +import { SidePanelMessageThreadPage } from '@/side-panel/pages/message-thread/components/SidePanelMessageThreadPage'; +import { SidePanelNavigationMenuItemEditPage } from '@/side-panel/pages/navigation-menu-item/components/SidePanelNavigationMenuItemEditPage'; +import { SidePanelNewSidebarItemPage } from '@/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemPage'; +import { SidePanelPageLayoutChartSettings } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutChartSettings'; +import { SidePanelPageLayoutFieldsLayout } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutFieldsLayout'; +import { SidePanelPageLayoutFieldsSettings } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutFieldsSettings'; +import { SidePanelPageLayoutGraphFilter } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutGraphFilter'; +import { SidePanelPageLayoutIframeSettings } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutIframeSettings'; +import { SidePanelPageLayoutTabSettings } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutTabSettings'; +import { SidePanelPageLayoutWidgetTypeSelect } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutWidgetTypeSelect'; +import { SidePanelMergeRecordPage } from '@/side-panel/pages/record-page/components/SidePanelMergeRecordPage'; +import { SidePanelRecordPage } from '@/side-panel/pages/record-page/components/SidePanelRecordPage'; +import { SidePanelUpdateMultipleRecords } from '@/side-panel/pages/record-page/components/SidePanelUpdateMultipleRecords'; +import { SidePanelEditRichTextPage } from '@/side-panel/pages/rich-text-page/components/SidePanelEditRichTextPage'; +import { SidePanelRootPage } from '@/side-panel/pages/root/components/SidePanelRootPage'; +import { SidePanelSearchRecordsPage } from '@/side-panel/pages/search/components/SidePanelSearchRecordsPage'; +import { SidePanelWorkflowCreateStep } from '@/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStep'; +import { SidePanelWorkflowEditStep } from '@/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStep'; +import { SidePanelWorkflowEditStepType } from '@/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepType'; +import { SidePanelWorkflowRunViewStep } from '@/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStep'; +import { SidePanelWorkflowViewStep } from '@/side-panel/pages/workflow/step/view/components/SidePanelWorkflowViewStep'; +import { SidePanelWorkflowSelectTriggerType } from '@/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerType'; +import { SidePanelPages } from 'twenty-shared/types'; + +export const SIDE_PANEL_PAGES_CONFIG = new Map( + [ + [SidePanelPages.Root, ], + [SidePanelPages.ViewRecord, ], + [SidePanelPages.MergeRecords, ], + [SidePanelPages.UpdateRecords, ], + [SidePanelPages.ViewEmailThread, ], + [SidePanelPages.ViewCalendarEvent, ], + [SidePanelPages.EditRichText, ], + [ + SidePanelPages.WorkflowTriggerSelectType, + , + ], + [SidePanelPages.WorkflowStepCreate, ], + [SidePanelPages.WorkflowStepEditType, ], + [SidePanelPages.WorkflowStepEdit, ], + [SidePanelPages.WorkflowStepView, ], + [SidePanelPages.WorkflowRunStepView, ], + [SidePanelPages.SearchRecords, ], + [SidePanelPages.AskAI, ], + [SidePanelPages.ViewPreviousAIChats, ], + [ + SidePanelPages.PageLayoutWidgetTypeSelect, + , + ], + [ + SidePanelPages.PageLayoutGraphTypeSelect, + , + ], + [SidePanelPages.PageLayoutGraphFilter, ], + [ + SidePanelPages.PageLayoutIframeSettings, + , + ], + [SidePanelPages.PageLayoutTabSettings, ], + [ + SidePanelPages.PageLayoutFieldsSettings, + , + ], + [ + SidePanelPages.PageLayoutFieldsLayout, + , + ], + [SidePanelPages.ViewFrontComponent, ], + [ + SidePanelPages.NavigationMenuItemEdit, + , + ], + [SidePanelPages.NavigationMenuAddItem, ], + ], +); diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelPreviousComponentInstanceId.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelPreviousComponentInstanceId.ts new file mode 100644 index 0000000000..3f78a32bde --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelPreviousComponentInstanceId.ts @@ -0,0 +1 @@ +export const SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID = 'side-panel-previous'; diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelResetContextToSelection.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelResetContextToSelection.ts new file mode 100644 index 0000000000..1c6047cb27 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelResetContextToSelection.ts @@ -0,0 +1,2 @@ +export const SIDE_PANEL_RESET_CONTEXT_TO_SELECTION = + 'reset-context-to-selection'; diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelSelectableListId.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelSelectableListId.ts new file mode 100644 index 0000000000..ecfc51699b --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelSelectableListId.ts @@ -0,0 +1 @@ +export const SIDE_PANEL_SELECTABLE_LIST_ID = 'side-panel-list'; diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeight.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeight.ts new file mode 100644 index 0000000000..574749a328 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeight.ts @@ -0,0 +1 @@ +export const SIDE_PANEL_TOP_BAR_HEIGHT = 40; diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeightMobile.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeightMobile.ts new file mode 100644 index 0000000000..df2b58b821 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeightMobile.ts @@ -0,0 +1 @@ +export const SIDE_PANEL_TOP_BAR_HEIGHT_MOBILE = 52; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useNavigateCommandMenu.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useNavigateSidePanel.test.tsx similarity index 64% rename from packages/twenty-front/src/modules/command-menu/hooks/__tests__/useNavigateCommandMenu.test.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/__tests__/useNavigateSidePanel.test.tsx index af8869bc8d..0e152c249f 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useNavigateCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useNavigateSidePanel.test.tsx @@ -1,14 +1,14 @@ import { renderHook } from '@testing-library/react'; import { act } from 'react'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { Icon123, useIcons } from 'twenty-ui/display'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -23,7 +23,7 @@ const personMockObjectMetadataItem = generatedMockObjectMetadataItems.find( const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ apolloMocks: [], - componentInstanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, + componentInstanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, contextStoreCurrentObjectMetadataNameSingular: personMockObjectMetadataItem.nameSingular, contextStoreCurrentViewId: 'my-view-id', @@ -38,12 +38,12 @@ const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ const renderHooks = () => { const { result } = renderHook( () => { - const { navigateCommandMenu } = useNavigateCommandMenu(); + const { navigateSidePanel } = useNavigateSidePanel(); const { getIcon } = useIcons(); return { - navigateCommandMenu, + navigateSidePanel, getIcon, }; }, @@ -54,7 +54,7 @@ const renderHooks = () => { return { result }; }; -describe('useNavigateCommandMenu', () => { +describe('useNavigateSidePanel', () => { beforeEach(() => { jest.clearAllMocks(); }); @@ -63,8 +63,8 @@ describe('useNavigateCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.navigateCommandMenu({ - page: CommandMenuPages.Root, + result.current.navigateSidePanel({ + page: SidePanelPages.Root, pageTitle: 'Root', pageIcon: Icon123, pageIconColor: 'red', @@ -73,19 +73,17 @@ describe('useNavigateCommandMenu', () => { }); }); - expect(jotaiStore.get(commandMenuPageState.atom)).toBe( - CommandMenuPages.Root, - ); - expect(jotaiStore.get(commandMenuNavigationStackState.atom)).toEqual([ + expect(jotaiStore.get(sidePanelPageState.atom)).toBe(SidePanelPages.Root); + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toEqual([ { - page: CommandMenuPages.Root, + page: SidePanelPages.Root, pageTitle: 'Root', pageIcon: Icon123, pageIconColor: 'red', pageId: 'mocked-uuid', }, ]); - expect(jotaiStore.get(commandMenuPageInfoState.atom)).toEqual({ + expect(jotaiStore.get(sidePanelPageInfoState.atom)).toEqual({ title: 'Root', Icon: Icon123, instanceId: 'mocked-uuid', diff --git a/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenAskAIPageInSidePanel.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenAskAIPageInSidePanel.test.tsx new file mode 100644 index 0000000000..af583b8692 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenAskAIPageInSidePanel.test.tsx @@ -0,0 +1,85 @@ +import { act, renderHook } from '@testing-library/react'; +import { Provider as JotaiProvider } from 'jotai'; +import { type ReactNode } from 'react'; + +import { useOpenAskAIPageInSidePanel } from '@/side-panel/hooks/useOpenAskAIPageInSidePanel'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; +import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; +import { SidePanelPages } from 'twenty-shared/types'; +import { IconSparkles } from 'twenty-ui/display'; + +const navigateSidePanelMenuMock = jest.fn(); + +jest.mock('@/side-panel/hooks/useSidePanelMenu', () => ({ + useSidePanelMenu: () => ({ + navigateSidePanelMenu: navigateSidePanelMenuMock, + openSidePanelMenu: jest.fn(), + closeSidePanelMenu: jest.fn(), + toggleSidePanelMenu: jest.fn(), + }), +})); + +const Wrapper = ({ children }: { children: ReactNode }) => ( + {children} +); + +describe('useOpenAskAIPageInSidePanel', () => { + beforeEach(() => { + jest.clearAllMocks(); + jotaiStore.set(isSidePanelOpenedState.atom, false); + }); + + it('should navigate to AskAI page with correct defaults', () => { + const { result } = renderHook(() => useOpenAskAIPageInSidePanel(), { + wrapper: Wrapper, + }); + + act(() => { + result.current.openAskAIPage(); + }); + + expect(navigateSidePanelMenuMock).toHaveBeenCalledWith( + expect.objectContaining({ + page: SidePanelPages.AskAI, + pageTitle: 'Ask AI', + pageIcon: IconSparkles, + }), + ); + }); + + it('should use resetNavigationStack from argument when provided', () => { + jotaiStore.set(isSidePanelOpenedState.atom, true); + + const { result } = renderHook(() => useOpenAskAIPageInSidePanel(), { + wrapper: Wrapper, + }); + + act(() => { + result.current.openAskAIPage({ resetNavigationStack: false }); + }); + + expect(navigateSidePanelMenuMock).toHaveBeenCalledWith( + expect.objectContaining({ + resetNavigationStack: false, + }), + ); + }); + + it('should default resetNavigationStack to isSidePanelOpened', () => { + jotaiStore.set(isSidePanelOpenedState.atom, true); + + const { result } = renderHook(() => useOpenAskAIPageInSidePanel(), { + wrapper: Wrapper, + }); + + act(() => { + result.current.openAskAIPage(); + }); + + expect(navigateSidePanelMenuMock).toHaveBeenCalledWith( + expect.objectContaining({ + resetNavigationStack: true, + }), + ); + }); +}); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenCalendarEventInCommandMenu.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenCalendarEventInSidePanel.test.tsx similarity index 65% rename from packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenCalendarEventInCommandMenu.test.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenCalendarEventInSidePanel.test.tsx index 9cd593244e..0cc1e96670 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenCalendarEventInCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenCalendarEventInSidePanel.test.tsx @@ -1,12 +1,12 @@ import { renderHook } from '@testing-library/react'; import { act } from 'react'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { useOpenCalendarEventInCommandMenu } from '@/command-menu/hooks/useOpenCalendarEventInCommandMenu'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { useOpenCalendarEventInSidePanel } from '@/side-panel/hooks/useOpenCalendarEventInSidePanel'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconCalendarEvent } from 'twenty-ui/display'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -15,10 +15,10 @@ jest.mock('uuid', () => ({ v4: jest.fn().mockReturnValue('mocked-uuid'), })); -const mockNavigateCommandMenu = jest.fn(); -jest.mock('@/command-menu/hooks/useNavigateCommandMenu', () => ({ - useNavigateCommandMenu: () => ({ - navigateCommandMenu: mockNavigateCommandMenu, +const mockNavigateSidePanel = jest.fn(); +jest.mock('@/side-panel/hooks/useNavigateSidePanel', () => ({ + useNavigateSidePanel: () => ({ + navigateSidePanel: mockNavigateSidePanel, }), })); @@ -28,7 +28,7 @@ const personMockObjectMetadataItem = generatedMockObjectMetadataItems.find( const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ apolloMocks: [], - componentInstanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, + componentInstanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, contextStoreCurrentObjectMetadataNameSingular: personMockObjectMetadataItem.nameSingular, contextStoreCurrentViewId: 'my-view-id', @@ -43,8 +43,8 @@ const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ const renderHooks = () => { const { result } = renderHook( () => { - const { openCalendarEventInCommandMenu } = - useOpenCalendarEventInCommandMenu(); + const { openCalendarEventInSidePanel } = + useOpenCalendarEventInSidePanel(); const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, @@ -52,7 +52,7 @@ const renderHooks = () => { ); return { - openCalendarEventInCommandMenu, + openCalendarEventInSidePanel, viewableRecordId, }; }, @@ -63,7 +63,7 @@ const renderHooks = () => { return { result }; }; -describe('useOpenCalendarEventInCommandMenu', () => { +describe('useOpenCalendarEventInSidePanel', () => { beforeEach(() => { jest.clearAllMocks(); }); @@ -74,13 +74,13 @@ describe('useOpenCalendarEventInCommandMenu', () => { const calendarEventId = 'calendar-event-123'; act(() => { - result.current.openCalendarEventInCommandMenu(calendarEventId); + result.current.openCalendarEventInSidePanel(calendarEventId); }); expect(result.current.viewableRecordId).toBe(calendarEventId); - expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.ViewCalendarEvent, + expect(mockNavigateSidePanel).toHaveBeenCalledWith({ + page: SidePanelPages.ViewCalendarEvent, pageTitle: 'Calendar Event', pageIcon: IconCalendarEvent, pageId: 'mocked-uuid', diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenEmailThreadInCommandMenu.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenEmailThreadInSidePanel.test.tsx similarity index 66% rename from packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenEmailThreadInCommandMenu.test.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenEmailThreadInSidePanel.test.tsx index 690b7fe877..c2c038ced9 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenEmailThreadInCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenEmailThreadInSidePanel.test.tsx @@ -1,12 +1,12 @@ import { renderHook } from '@testing-library/react'; import { act } from 'react'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { useOpenEmailThreadInCommandMenu } from '@/command-menu/hooks/useOpenEmailThreadInCommandMenu'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { useOpenEmailThreadInSidePanel } from '@/side-panel/hooks/useOpenEmailThreadInSidePanel'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconMail } from 'twenty-ui/display'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -15,10 +15,10 @@ jest.mock('uuid', () => ({ v4: jest.fn().mockReturnValue('mocked-uuid'), })); -const mockNavigateCommandMenu = jest.fn(); -jest.mock('@/command-menu/hooks/useNavigateCommandMenu', () => ({ - useNavigateCommandMenu: () => ({ - navigateCommandMenu: mockNavigateCommandMenu, +const mockNavigateSidePanel = jest.fn(); +jest.mock('@/side-panel/hooks/useNavigateSidePanel', () => ({ + useNavigateSidePanel: () => ({ + navigateSidePanel: mockNavigateSidePanel, }), })); @@ -28,7 +28,7 @@ const personMockObjectMetadataItem = generatedMockObjectMetadataItems.find( const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ apolloMocks: [], - componentInstanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, + componentInstanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, contextStoreCurrentObjectMetadataNameSingular: personMockObjectMetadataItem.nameSingular, contextStoreCurrentViewId: 'my-view-id', @@ -43,8 +43,7 @@ const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ const renderHooks = () => { const { result } = renderHook( () => { - const { openEmailThreadInCommandMenu } = - useOpenEmailThreadInCommandMenu(); + const { openEmailThreadInSidePanel } = useOpenEmailThreadInSidePanel(); const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, @@ -52,7 +51,7 @@ const renderHooks = () => { ); return { - openEmailThreadInCommandMenu, + openEmailThreadInSidePanel, viewableRecordId, }; }, @@ -63,7 +62,7 @@ const renderHooks = () => { return { result }; }; -describe('useOpenEmailThreadInCommandMenu', () => { +describe('useOpenEmailThreadInSidePanel', () => { beforeEach(() => { jest.clearAllMocks(); }); @@ -74,13 +73,13 @@ describe('useOpenEmailThreadInCommandMenu', () => { const emailThreadId = 'email-thread-123'; act(() => { - result.current.openEmailThreadInCommandMenu(emailThreadId); + result.current.openEmailThreadInSidePanel(emailThreadId); }); expect(result.current.viewableRecordId).toBe(emailThreadId); - expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.ViewEmailThread, + expect(mockNavigateSidePanel).toHaveBeenCalledWith({ + page: SidePanelPages.ViewEmailThread, pageTitle: 'Email Thread', pageIcon: IconMail, pageId: 'mocked-uuid', diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenRecordInCommandMenu.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenRecordInSidePanel.test.tsx similarity index 78% rename from packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenRecordInCommandMenu.test.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenRecordInSidePanel.test.tsx index 1bf82ac5a7..6e1de6c49c 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenRecordInCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenRecordInSidePanel.test.tsx @@ -1,11 +1,11 @@ import { renderHook } from '@testing-library/react'; import { act } from 'react'; -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; -import { viewableRecordNameSingularComponentState } from '@/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState'; -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; +import { viewableRecordNameSingularComponentState } from '@/side-panel/pages/record-page/states/viewableRecordNameSingularComponentState'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState'; @@ -14,7 +14,7 @@ import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/s import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; import { getLabelIdentifierFieldMetadataItem } from '@/object-metadata/utils/getLabelIdentifierFieldMetadataItem'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { useIcons } from 'twenty-ui/display'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -23,10 +23,10 @@ jest.mock('uuid', () => ({ v4: jest.fn().mockReturnValue('mocked-uuid'), })); -const mockNavigateCommandMenu = jest.fn(); -jest.mock('@/command-menu/hooks/useNavigateCommandMenu', () => ({ - useNavigateCommandMenu: () => ({ - navigateCommandMenu: mockNavigateCommandMenu, +const mockNavigateSidePanel = jest.fn(); +jest.mock('@/side-panel/hooks/useNavigateSidePanel', () => ({ + useNavigateSidePanel: () => ({ + navigateSidePanel: mockNavigateSidePanel, }), })); @@ -46,7 +46,7 @@ const personMockObjectMetadataItem = generatedMockObjectMetadataItems.find( const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ apolloMocks: [], - componentInstanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, + componentInstanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, contextStoreCurrentObjectMetadataNameSingular: personMockObjectMetadataItem.nameSingular, contextStoreCurrentViewId: 'my-view-id', @@ -61,7 +61,7 @@ const wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({ const renderHooks = () => { const { result } = renderHook( () => { - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, @@ -91,7 +91,7 @@ const renderHooks = () => { const { getIcon } = useIcons(); return { - openRecordInCommandMenu, + openRecordInSidePanel, viewableRecordId, viewableRecordNameSingular, contextStoreCurrentObjectMetadataItemId, @@ -108,7 +108,7 @@ const renderHooks = () => { return { result }; }; -describe('useOpenRecordInCommandMenu', () => { +describe('useOpenRecordInSidePanel', () => { beforeEach(() => { jest.clearAllMocks(); }); @@ -120,7 +120,7 @@ describe('useOpenRecordInCommandMenu', () => { const objectNameSingular = 'person'; act(() => { - result.current.openRecordInCommandMenu({ + result.current.openRecordInSidePanel({ recordId, objectNameSingular, }); @@ -140,19 +140,19 @@ describe('useOpenRecordInCommandMenu', () => { ContextStoreViewType.ShowPage, ); - const commandMenuNavigationMorphItemsByPage = jotaiStore.get( - commandMenuNavigationMorphItemsByPageState.atom, + const sidePanelNavigationMorphItemsByPage = jotaiStore.get( + sidePanelNavigationMorphItemsByPageState.atom, ); - expect(commandMenuNavigationMorphItemsByPage.size).toBe(1); - expect(commandMenuNavigationMorphItemsByPage.get('mocked-uuid')).toEqual([ + expect(sidePanelNavigationMorphItemsByPage.size).toBe(1); + expect(sidePanelNavigationMorphItemsByPage.get('mocked-uuid')).toEqual([ { objectMetadataId: personMockObjectMetadataItem.id, recordId, }, ]); - expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.ViewRecord, + expect(mockNavigateSidePanel).toHaveBeenCalledWith({ + page: SidePanelPages.ViewRecord, pageTitle: 'Person', pageIcon: result.current.getIcon(personMockObjectMetadataItem.icon), pageIconColor: 'currentColor', @@ -168,15 +168,15 @@ describe('useOpenRecordInCommandMenu', () => { const objectNameSingular = 'person'; act(() => { - result.current.openRecordInCommandMenu({ + result.current.openRecordInSidePanel({ recordId, objectNameSingular, isNewRecord: true, }); }); - expect(mockNavigateCommandMenu).toHaveBeenCalledWith({ - page: CommandMenuPages.ViewRecord, + expect(mockNavigateSidePanel).toHaveBeenCalledWith({ + page: SidePanelPages.ViewRecord, pageTitle: 'New Person', pageIcon: result.current.getIcon(personMockObjectMetadataItem.icon), pageIconColor: 'currentColor', @@ -189,7 +189,7 @@ describe('useOpenRecordInCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.openRecordInCommandMenu({ + result.current.openRecordInSidePanel({ recordId: 'new-record-123', objectNameSingular: 'person', isNewRecord: true, @@ -208,7 +208,7 @@ describe('useOpenRecordInCommandMenu', () => { const { result } = renderHooks(); act(() => { - result.current.openRecordInCommandMenu({ + result.current.openRecordInSidePanel({ recordId: 'record-123', objectNameSingular: 'person', }); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenUpdateMultipleRecordsPageInCommandMenu.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenUpdateMultipleRecordsPageInSidePanel.test.tsx similarity index 50% rename from packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenUpdateMultipleRecordsPageInCommandMenu.test.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenUpdateMultipleRecordsPageInSidePanel.test.tsx index d365c843d4..79c20cb570 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenUpdateMultipleRecordsPageInCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useOpenUpdateMultipleRecordsPageInSidePanel.test.tsx @@ -1,6 +1,6 @@ -describe('useOpenUpdateMultipleRecordsPageInCommandMenu', () => { +describe('useOpenUpdateMultipleRecordsPageInSidePanel', () => { it('should work', () => { - // const { result } = renderHook(() => useOpenUpdateMultipleRecordsPageInCommandMenu({ contextStoreInstanceId: 'test' })); + // const { result } = renderHook(() => useOpenUpdateMultipleRecordsPageInSidePanel({ contextStoreInstanceId: 'test' })); expect(true).toBe(true); }); }); diff --git a/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelCloseAnimationCompleteCleanup.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelCloseAnimationCompleteCleanup.test.tsx new file mode 100644 index 0000000000..5988a8d976 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelCloseAnimationCompleteCleanup.test.tsx @@ -0,0 +1,179 @@ +import { renderHook } from '@testing-library/react'; +import { Provider as JotaiProvider } from 'jotai'; +import { act } from 'react'; +import { MemoryRouter } from 'react-router-dom'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { SIDE_PANEL_CONTEXT_CHIP_GROUPS_DROPDOWN_ID } from '@/side-panel/constants/SidePanelContextChipGroupsDropdownId'; +import { SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelPreviousComponentInstanceId'; +import { useSidePanelCloseAnimationCompleteCleanup } from '@/side-panel/hooks/useSidePanelCloseAnimationCompleteCleanup'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState'; +import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState'; +import { isSidePanelClosingState } from '@/side-panel/states/isSidePanelClosingState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; +import { viewableRecordIdState } from '@/object-record/record-side-panel/states/viewableRecordIdState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; +import { SidePanelPages } from 'twenty-shared/types'; +import { IconList } from 'twenty-ui/display'; + +const mockCloseDropdown = jest.fn(); +const mockResetContextStoreStates = jest.fn(); +const mockResetSelectedItem = jest.fn(); +const mockEmitSidePanelCloseEvent = jest.fn(); + +jest.mock('@/ui/layout/dropdown/hooks/useCloseDropdown', () => ({ + useCloseDropdown: () => ({ + closeDropdown: mockCloseDropdown, + }), +})); + +jest.mock('@/command-menu/hooks/useResetContextStoreStates', () => ({ + useResetContextStoreStates: () => ({ + resetContextStoreStates: mockResetContextStoreStates, + }), +})); + +jest.mock('@/ui/layout/selectable-list/hooks/useSelectableList', () => ({ + useSelectableList: () => ({ + resetSelectedItem: mockResetSelectedItem, + }), +})); + +jest.mock('@/ui/layout/side-panel/utils/emitSidePanelCloseEvent', () => ({ + emitSidePanelCloseEvent: () => { + mockEmitSidePanelCloseEvent(); + }, +})); + +const Wrapper = ({ children }: { children: React.ReactNode }) => ( + + {children} + +); + +describe('useSidePanelCloseAnimationCompleteCleanup', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + const renderHooks = () => { + const { result } = renderHook( + () => { + const { sidePanelCloseAnimationCompleteCleanup } = + useSidePanelCloseAnimationCompleteCleanup(); + + const viewableRecordId = useAtomStateValue(viewableRecordIdState); + + const setViewableRecordId = useSetAtomState(viewableRecordIdState); + + return { + sidePanelCloseAnimationCompleteCleanup, + viewableRecordId, + setViewableRecordId, + }; + }, + { + wrapper: Wrapper, + }, + ); + return { result }; + }; + + it('should reset modified states back to default values', () => { + const { result } = renderHooks(); + + act(() => { + jotaiStore.set(sidePanelPageState.atom, SidePanelPages.ViewRecord); + jotaiStore.set(sidePanelPageInfoState.atom, { + title: 'Test Record', + Icon: IconList, + instanceId: 'test-id', + }); + jotaiStore.set(isSidePanelOpenedState.atom, true); + jotaiStore.set(sidePanelSearchState.atom, 'test search'); + jotaiStore.set(sidePanelNavigationStackState.atom, [ + { + page: SidePanelPages.SearchRecords, + pageTitle: 'Search', + pageIcon: IconList, + pageId: '1', + }, + ]); + jotaiStore.set(hasUserSelectedSidePanelListItemState.atom, true); + jotaiStore.set(isSidePanelClosingState.atom, true); + result.current.setViewableRecordId('record-123'); + }); + + expect(jotaiStore.get(sidePanelPageState.atom)).toBe( + SidePanelPages.ViewRecord, + ); + expect(jotaiStore.get(sidePanelPageInfoState.atom)).toEqual({ + title: 'Test Record', + Icon: IconList, + instanceId: 'test-id', + }); + expect(jotaiStore.get(isSidePanelOpenedState.atom)).toBe(true); + expect(jotaiStore.get(sidePanelSearchState.atom)).toBe('test search'); + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toEqual([ + { + page: SidePanelPages.SearchRecords, + pageTitle: 'Search', + pageIcon: IconList, + pageId: '1', + }, + ]); + expect(jotaiStore.get(hasUserSelectedSidePanelListItemState.atom)).toBe( + true, + ); + expect(jotaiStore.get(isSidePanelClosingState.atom)).toBe(true); + expect(result.current.viewableRecordId).toBe('record-123'); + + act(() => { + result.current.sidePanelCloseAnimationCompleteCleanup(); + }); + + expect(jotaiStore.get(sidePanelPageState.atom)).toBe(SidePanelPages.Root); + expect(jotaiStore.get(sidePanelPageInfoState.atom)).toEqual({ + title: undefined, + Icon: undefined, + instanceId: '', + }); + expect(jotaiStore.get(isSidePanelOpenedState.atom)).toBe(false); + expect(jotaiStore.get(sidePanelSearchState.atom)).toBe(''); + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toEqual([]); + expect(jotaiStore.get(hasUserSelectedSidePanelListItemState.atom)).toBe( + false, + ); + expect(jotaiStore.get(isSidePanelClosingState.atom)).toBe(false); + expect(result.current.viewableRecordId).toBe(null); + }); + + it('should call all dependent functions correctly', () => { + const { result } = renderHooks(); + + act(() => { + result.current.sidePanelCloseAnimationCompleteCleanup(); + }); + + expect(mockCloseDropdown).toHaveBeenCalledTimes(1); + expect(mockResetContextStoreStates).toHaveBeenCalledTimes(2); + expect(mockResetSelectedItem).toHaveBeenCalledTimes(1); + expect(mockEmitSidePanelCloseEvent).toHaveBeenCalledTimes(1); + + expect(mockCloseDropdown).toHaveBeenCalledWith( + SIDE_PANEL_CONTEXT_CHIP_GROUPS_DROPDOWN_ID, + ); + expect(mockResetContextStoreStates).toHaveBeenNthCalledWith( + 1, + SIDE_PANEL_COMPONENT_INSTANCE_ID, + ); + expect(mockResetContextStoreStates).toHaveBeenNthCalledWith( + 2, + SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID, + ); + }); +}); diff --git a/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelHistory.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelHistory.test.tsx new file mode 100644 index 0000000000..8f885ef79c --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelHistory.test.tsx @@ -0,0 +1,141 @@ +import { renderHook } from '@testing-library/react'; +import { Provider as JotaiProvider } from 'jotai'; +import { act } from 'react'; +import { MemoryRouter } from 'react-router-dom'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useSidePanelCloseAnimationCompleteCleanup } from '@/side-panel/hooks/useSidePanelCloseAnimationCompleteCleanup'; +import { useSidePanelHistory } from '@/side-panel/hooks/useSidePanelHistory'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; +import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; +import { SidePanelPages } from 'twenty-shared/types'; +import { IconList, IconSearch } from 'twenty-ui/display'; + +const Wrapper = ({ children }: { children: React.ReactNode }) => ( + + {children} + +); + +const renderHooks = () => { + const { result } = renderHook( + () => { + const commandMenu = useSidePanelMenu(); + const commandMenuHistory = useSidePanelHistory(); + const sidePanelCloseAnimationCompleteCleanup = + useSidePanelCloseAnimationCompleteCleanup(); + + return { + commandMenu, + commandMenuHistory, + sidePanelCloseAnimationCompleteCleanup, + }; + }, + { + wrapper: Wrapper, + }, + ); + return { result }; +}; + +describe('useSidePanelHistory', () => { + it('should go back from a page', () => { + const { result } = renderHooks(); + + act(() => { + result.current.commandMenu.navigateSidePanelMenu({ + page: SidePanelPages.SearchRecords, + pageTitle: 'Search', + pageIcon: IconSearch, + pageId: '1', + }); + }); + + act(() => { + result.current.commandMenu.navigateSidePanelMenu({ + page: SidePanelPages.ViewRecord, + pageTitle: 'Company', + pageIcon: IconList, + pageId: '2', + }); + }); + + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toEqual([ + { + page: SidePanelPages.SearchRecords, + pageTitle: 'Search', + pageIcon: IconSearch, + pageId: '1', + }, + { + page: SidePanelPages.ViewRecord, + pageTitle: 'Company', + pageIcon: IconList, + pageId: '2', + }, + ]); + + act(() => { + result.current.commandMenuHistory.goBackFromSidePanel(); + }); + + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toEqual([ + { + page: SidePanelPages.SearchRecords, + pageTitle: 'Search', + pageIcon: IconSearch, + pageId: '1', + }, + ]); + expect(jotaiStore.get(sidePanelPageState.atom)).toBe( + SidePanelPages.SearchRecords, + ); + expect(jotaiStore.get(sidePanelPageInfoState.atom)).toEqual({ + title: 'Search', + Icon: IconSearch, + instanceId: '1', + }); + + act(() => { + result.current.commandMenuHistory.goBackFromSidePanel(); + result.current.sidePanelCloseAnimationCompleteCleanup.sidePanelCloseAnimationCompleteCleanup(); + }); + + expect(jotaiStore.get(sidePanelNavigationStackState.atom)).toEqual([]); + expect(jotaiStore.get(sidePanelPageState.atom)).toBe(SidePanelPages.Root); + expect(jotaiStore.get(sidePanelPageInfoState.atom)).toEqual({ + title: undefined, + instanceId: '', + Icon: undefined, + }); + expect(jotaiStore.get(isSidePanelOpenedState.atom)).toBe(false); + }); + + it('should navigate to a page in history', () => { + const { result } = renderHooks(); + + act(() => { + result.current.commandMenu.navigateSidePanelMenu({ + page: SidePanelPages.SearchRecords, + pageTitle: 'Search', + pageIcon: IconSearch, + pageId: '1', + }); + }); + + act(() => { + result.current.commandMenuHistory.navigateSidePanelHistory(0); + }); + + expect(jotaiStore.get(sidePanelPageState.atom)).toBe( + SidePanelPages.SearchRecords, + ); + expect(jotaiStore.get(sidePanelPageInfoState.atom)).toEqual({ + title: 'Search', + Icon: IconSearch, + instanceId: '1', + }); + }); +}); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuUpdateNavigationMorphItemsByPage.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelUpdateNavigationMorphItemsByPage.test.tsx similarity index 65% rename from packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuUpdateNavigationMorphItemsByPage.test.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelUpdateNavigationMorphItemsByPage.test.tsx index de04cb90a5..febb2bc3a8 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuUpdateNavigationMorphItemsByPage.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useSidePanelUpdateNavigationMorphItemsByPage.test.tsx @@ -1,5 +1,5 @@ -import { useCommandMenuUpdateNavigationMorphItemsByPage } from '@/command-menu/hooks/useCommandMenuUpdateNavigationMorphItemsByPage'; -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; +import { useSidePanelUpdateNavigationMorphItemsByPage } from '@/side-panel/hooks/useSidePanelUpdateNavigationMorphItemsByPage'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { renderHook } from '@testing-library/react'; import { Provider as JotaiProvider } from 'jotai'; @@ -13,7 +13,7 @@ const Wrapper = ({ children }: { children: React.ReactNode }) => ( const renderHooks = (initialRecordIds: string[]) => { jotaiStore.set( - commandMenuNavigationMorphItemsByPageState.atom, + sidePanelNavigationMorphItemsByPageState.atom, new Map([ [ pageId, @@ -27,11 +27,11 @@ const renderHooks = (initialRecordIds: string[]) => { return renderHook( () => { - const { updateCommandMenuNavigationMorphItemsByPage } = - useCommandMenuUpdateNavigationMorphItemsByPage(); + const { updateSidePanelNavigationMorphItemsByPage } = + useSidePanelUpdateNavigationMorphItemsByPage(); return { - updateCommandMenuNavigationMorphItemsByPage, + updateSidePanelNavigationMorphItemsByPage, }; }, { @@ -40,12 +40,12 @@ const renderHooks = (initialRecordIds: string[]) => { ); }; -describe('useCommandMenuUpdateNavigationMorphItemsByPage', () => { +describe('useSidePanelUpdateNavigationMorphItemsByPage', () => { it('should replace existing items for a page instead of appending', async () => { const { result } = renderHooks(['record-1', 'record-2']); await act(async () => { - await result.current.updateCommandMenuNavigationMorphItemsByPage({ + await result.current.updateSidePanelNavigationMorphItemsByPage({ pageId, objectMetadataId, objectRecordIds: ['record-2', 'record-1'], @@ -53,9 +53,7 @@ describe('useCommandMenuUpdateNavigationMorphItemsByPage', () => { }); expect( - jotaiStore - .get(commandMenuNavigationMorphItemsByPageState.atom) - .get(pageId), + jotaiStore.get(sidePanelNavigationMorphItemsByPageState.atom).get(pageId), ).toEqual([ { objectMetadataId, @@ -72,12 +70,12 @@ describe('useCommandMenuUpdateNavigationMorphItemsByPage', () => { const { result } = renderHooks([]); await act(async () => { - await result.current.updateCommandMenuNavigationMorphItemsByPage({ + await result.current.updateSidePanelNavigationMorphItemsByPage({ pageId, objectMetadataId, objectRecordIds: ['record-1', 'record-2'], }); - await result.current.updateCommandMenuNavigationMorphItemsByPage({ + await result.current.updateSidePanelNavigationMorphItemsByPage({ pageId, objectMetadataId, objectRecordIds: ['record-2', 'record-1'], @@ -85,9 +83,7 @@ describe('useCommandMenuUpdateNavigationMorphItemsByPage', () => { }); expect( - jotaiStore - .get(commandMenuNavigationMorphItemsByPageState.atom) - .get(pageId), + jotaiStore.get(sidePanelNavigationMorphItemsByPageState.atom).get(pageId), ).toEqual([ { objectMetadataId, diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useUpdateCommandMenuPageInfo.test.tsx b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useUpdateSidePanelPageInfo.test.tsx similarity index 55% rename from packages/twenty-front/src/modules/command-menu/hooks/__tests__/useUpdateCommandMenuPageInfo.test.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/__tests__/useUpdateSidePanelPageInfo.test.tsx index 01d1427959..969539d242 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useUpdateCommandMenuPageInfo.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/__tests__/useUpdateSidePanelPageInfo.test.tsx @@ -1,11 +1,11 @@ -import { useUpdateCommandMenuPageInfo } from '@/command-menu/hooks/useUpdateCommandMenuPageInfo'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; +import { useUpdateSidePanelPageInfo } from '@/side-panel/hooks/useUpdateSidePanelPageInfo'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { renderHook } from '@testing-library/react'; import { Provider as JotaiProvider } from 'jotai'; import { act } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconArrowDown, IconDotsVertical } from 'twenty-ui/display'; const mockedPageInfo = { @@ -16,7 +16,7 @@ const mockedPageInfo = { const mockedNavigationStack = [ { - page: CommandMenuPages.Root, + page: SidePanelPages.Root, pageTitle: 'Initial Title', pageIcon: IconDotsVertical, pageId: 'test-page-id', @@ -27,19 +27,19 @@ const Wrapper = ({ children }: { children: React.ReactNode }) => ( {children} ); -describe('useUpdateCommandMenuPageInfo', () => { +describe('useUpdateSidePanelPageInfo', () => { beforeEach(() => { - jotaiStore.set(commandMenuNavigationStackState.atom, mockedNavigationStack); - jotaiStore.set(commandMenuPageInfoState.atom, mockedPageInfo); + jotaiStore.set(sidePanelNavigationStackState.atom, mockedNavigationStack); + jotaiStore.set(sidePanelPageInfoState.atom, mockedPageInfo); }); const renderHooks = () => { const { result } = renderHook( () => { - const { updateCommandMenuPageInfo } = useUpdateCommandMenuPageInfo(); + const { updateSidePanelPageInfo } = useUpdateSidePanelPageInfo(); return { - updateCommandMenuPageInfo, + updateSidePanelPageInfo, }; }, { wrapper: Wrapper }, @@ -54,26 +54,26 @@ describe('useUpdateCommandMenuPageInfo', () => { const { result } = renderHooks(); act(() => { - result.current.updateCommandMenuPageInfo({ + result.current.updateSidePanelPageInfo({ pageTitle: 'New Title', pageIcon: IconArrowDown, }); }); - const commandMenuNavigationStack = jotaiStore.get( - commandMenuNavigationStackState.atom, + const sidePanelNavigationStack = jotaiStore.get( + sidePanelNavigationStackState.atom, ); - expect(commandMenuNavigationStack).toEqual([ + expect(sidePanelNavigationStack).toEqual([ { - page: CommandMenuPages.Root, + page: SidePanelPages.Root, pageTitle: 'New Title', pageIcon: IconArrowDown, pageId: 'test-page-id', }, ]); - const commandMenuPageInfo = jotaiStore.get(commandMenuPageInfoState.atom); - expect(commandMenuPageInfo).toEqual({ + const sidePanelPageInfo = jotaiStore.get(sidePanelPageInfoState.atom); + expect(sidePanelPageInfo).toEqual({ title: 'New Title', Icon: IconArrowDown, instanceId: 'test-instance', @@ -84,25 +84,25 @@ describe('useUpdateCommandMenuPageInfo', () => { const { result } = renderHooks(); act(() => { - result.current.updateCommandMenuPageInfo({ + result.current.updateSidePanelPageInfo({ pageTitle: 'New Title', }); }); - const commandMenuNavigationStack = jotaiStore.get( - commandMenuNavigationStackState.atom, + const sidePanelNavigationStack = jotaiStore.get( + sidePanelNavigationStackState.atom, ); - expect(commandMenuNavigationStack).toEqual([ + expect(sidePanelNavigationStack).toEqual([ { - page: CommandMenuPages.Root, + page: SidePanelPages.Root, pageTitle: 'New Title', pageIcon: IconDotsVertical, pageId: 'test-page-id', }, ]); - const commandMenuPageInfo = jotaiStore.get(commandMenuPageInfoState.atom); - expect(commandMenuPageInfo).toEqual({ + const sidePanelPageInfo = jotaiStore.get(sidePanelPageInfoState.atom); + expect(sidePanelPageInfo).toEqual({ title: 'New Title', Icon: IconDotsVertical, instanceId: 'test-instance', @@ -113,25 +113,25 @@ describe('useUpdateCommandMenuPageInfo', () => { const { result } = renderHooks(); act(() => { - result.current.updateCommandMenuPageInfo({ + result.current.updateSidePanelPageInfo({ pageIcon: IconArrowDown, }); }); - const commandMenuNavigationStack = jotaiStore.get( - commandMenuNavigationStackState.atom, + const sidePanelNavigationStack = jotaiStore.get( + sidePanelNavigationStackState.atom, ); - expect(commandMenuNavigationStack).toEqual([ + expect(sidePanelNavigationStack).toEqual([ { - page: CommandMenuPages.Root, + page: SidePanelPages.Root, pageTitle: 'Initial Title', pageIcon: IconArrowDown, pageId: 'test-page-id', }, ]); - const commandMenuPageInfo = jotaiStore.get(commandMenuPageInfoState.atom); - expect(commandMenuPageInfo).toEqual({ + const sidePanelPageInfo = jotaiStore.get(sidePanelPageInfoState.atom); + expect(sidePanelPageInfo).toEqual({ title: 'Initial Title', Icon: IconArrowDown, instanceId: 'test-instance', diff --git a/packages/twenty-front/src/modules/side-panel/hooks/useNavigateSidePanel.ts b/packages/twenty-front/src/modules/side-panel/hooks/useNavigateSidePanel.ts new file mode 100644 index 0000000000..a1ca5011bc --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/hooks/useNavigateSidePanel.ts @@ -0,0 +1,148 @@ +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; +import { useSidePanelCloseAnimationCompleteCleanup } from '@/side-panel/hooks/useSidePanelCloseAnimationCompleteCleanup'; +import { useCopyContextStoreStates } from '@/command-menu/hooks/useCopyContextStoreAndActionMenuStates'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { sidePanelShouldFocusTitleInputComponentState } from '@/side-panel/states/sidePanelShouldFocusTitleInputComponentState'; +import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState'; +import { isSidePanelClosingState } from '@/side-panel/states/isSidePanelClosingState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; +import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; +import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; +import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; +import { useStore } from 'jotai'; +import { useCallback } from 'react'; +import { type SidePanelPages } from 'twenty-shared/types'; +import { type IconComponent } from 'twenty-ui/display'; +import { v4 } from 'uuid'; + +export type SidePanelNavigationStackItem = { + page: SidePanelPages; + pageTitle: string; + pageIcon: IconComponent; + pageIconColor?: string; + pageId?: string; +}; + +export const useNavigateSidePanel = () => { + const store = useStore(); + const { copyContextStoreStates } = useCopyContextStoreStates(); + + const { sidePanelCloseAnimationCompleteCleanup } = + useSidePanelCloseAnimationCompleteCleanup(); + + const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); + + const openSidePanel = useCallback(() => { + const isSidePanelOpened = store.get(isSidePanelOpenedState.atom); + + const isSidePanelClosing = store.get(isSidePanelClosingState.atom); + + if (isSidePanelClosing) { + sidePanelCloseAnimationCompleteCleanup({ + emitSidePanelCloseEvent: false, + }); + } + + if (isSidePanelOpened) { + return; + } + + pushFocusItemToFocusStack({ + focusId: SIDE_PANEL_FOCUS_ID, + component: { + type: FocusComponentType.SIDE_PANEL, + instanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, + }, + globalHotkeysConfig: { + enableGlobalHotkeysConflictingWithKeyboard: false, + }, + }); + + copyContextStoreStates({ + instanceIdToCopyFrom: MAIN_CONTEXT_STORE_INSTANCE_ID, + instanceIdToCopyTo: SIDE_PANEL_COMPONENT_INSTANCE_ID, + }); + + store.set(isSidePanelOpenedState.atom, true); + store.set(hasUserSelectedSidePanelListItemState.atom, false); + }, [ + copyContextStoreStates, + sidePanelCloseAnimationCompleteCleanup, + pushFocusItemToFocusStack, + store, + ]); + + const navigateSidePanel = useCallback( + ({ + page, + pageTitle, + pageIcon, + pageIconColor, + pageId, + focusTitleInput = false, + resetNavigationStack = false, + }: SidePanelNavigationStackItem & { + resetNavigationStack?: boolean; + focusTitleInput?: boolean; + }) => { + const computedPageId = pageId || v4(); + + openSidePanel(); + store.set(sidePanelPageState.atom, page); + store.set(sidePanelPageInfoState.atom, { + title: pageTitle, + Icon: pageIcon, + instanceId: computedPageId, + }); + + if (focusTitleInput) { + store.set( + sidePanelShouldFocusTitleInputComponentState.atomFamily({ + instanceId: computedPageId, + }), + true, + ); + } + + const isSidePanelClosing = store.get(isSidePanelClosingState.atom); + + const currentNavigationStack = isSidePanelClosing + ? [] + : store.get(sidePanelNavigationStackState.atom); + + if (resetNavigationStack) { + store.set(sidePanelNavigationStackState.atom, [ + { + page, + pageTitle, + pageIcon, + pageIconColor, + pageId: computedPageId, + }, + ]); + + store.set(sidePanelNavigationMorphItemsByPageState.atom, new Map()); + } else { + store.set(sidePanelNavigationStackState.atom, [ + ...currentNavigationStack, + { + page, + pageTitle, + pageIcon, + pageIconColor, + pageId: computedPageId, + }, + ]); + } + }, + [openSidePanel, store], + ); + + return { + navigateSidePanel, + }; +}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenAskAIPageInCommandMenu.ts b/packages/twenty-front/src/modules/side-panel/hooks/useOpenAskAIPageInSidePanel.ts similarity index 55% rename from packages/twenty-front/src/modules/command-menu/hooks/useOpenAskAIPageInCommandMenu.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useOpenAskAIPageInSidePanel.ts index 2256b62b14..2fcb8daf78 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenAskAIPageInCommandMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenAskAIPageInSidePanel.ts @@ -1,15 +1,15 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { t } from '@lingui/core/macro'; import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconSparkles } from 'twenty-ui/display'; import { v4 } from 'uuid'; -export const useOpenAskAIPageInCommandMenu = () => { - const { navigateCommandMenu } = useCommandMenu(); - const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState); +export const useOpenAskAIPageInSidePanel = () => { + const { navigateSidePanelMenu } = useSidePanelMenu(); + const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState); const openAskAIPage = useCallback( ({ @@ -20,17 +20,17 @@ export const useOpenAskAIPageInCommandMenu = () => { const shouldReset = resetNavigationStack !== undefined ? resetNavigationStack - : isCommandMenuOpened; + : isSidePanelOpened; - navigateCommandMenu({ - page: CommandMenuPages.AskAI, + navigateSidePanelMenu({ + page: SidePanelPages.AskAI, pageTitle: t`Ask AI`, pageIcon: IconSparkles, pageId: v4(), resetNavigationStack: shouldReset, }); }, - [navigateCommandMenu, isCommandMenuOpened], + [navigateSidePanelMenu, isSidePanelOpened], ); return { diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenCalendarEventInCommandMenu.ts b/packages/twenty-front/src/modules/side-panel/hooks/useOpenCalendarEventInSidePanel.ts similarity index 70% rename from packages/twenty-front/src/modules/command-menu/hooks/useOpenCalendarEventInCommandMenu.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useOpenCalendarEventInSidePanel.ts index e29d49c316..226372c4da 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenCalendarEventInCommandMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenCalendarEventInSidePanel.ts @@ -1,17 +1,17 @@ -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; import { t } from '@lingui/core/macro'; import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconCalendarEvent } from 'twenty-ui/display'; import { v4 } from 'uuid'; import { useStore } from 'jotai'; -export const useOpenCalendarEventInCommandMenu = () => { +export const useOpenCalendarEventInSidePanel = () => { const store = useStore(); - const { navigateCommandMenu } = useNavigateCommandMenu(); + const { navigateSidePanel } = useNavigateSidePanel(); - const openCalendarEventInCommandMenu = useCallback( + const openCalendarEventInSidePanel = useCallback( (calendarEventId: string) => { const pageComponentInstanceId = v4(); @@ -47,17 +47,17 @@ export const useOpenCalendarEventInCommandMenu = () => { // ]), // ); - navigateCommandMenu({ - page: CommandMenuPages.ViewCalendarEvent, + navigateSidePanel({ + page: SidePanelPages.ViewCalendarEvent, pageTitle: t`Calendar Event`, pageIcon: IconCalendarEvent, pageId: pageComponentInstanceId, }); }, - [navigateCommandMenu, store], + [navigateSidePanel, store], ); return { - openCalendarEventInCommandMenu, + openCalendarEventInSidePanel, }; }; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenEmailThreadInCommandMenu.ts b/packages/twenty-front/src/modules/side-panel/hooks/useOpenEmailThreadInSidePanel.ts similarity index 70% rename from packages/twenty-front/src/modules/command-menu/hooks/useOpenEmailThreadInCommandMenu.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useOpenEmailThreadInSidePanel.ts index b2d233d008..378315803d 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenEmailThreadInCommandMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenEmailThreadInSidePanel.ts @@ -1,17 +1,17 @@ -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; import { t } from '@lingui/core/macro'; import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { IconMail } from 'twenty-ui/display'; import { v4 } from 'uuid'; import { useStore } from 'jotai'; -export const useOpenEmailThreadInCommandMenu = () => { +export const useOpenEmailThreadInSidePanel = () => { const store = useStore(); - const { navigateCommandMenu } = useNavigateCommandMenu(); + const { navigateSidePanel } = useNavigateSidePanel(); - const openEmailThreadInCommandMenu = useCallback( + const openEmailThreadInSidePanel = useCallback( (emailThreadId: string) => { const pageComponentInstanceId = v4(); @@ -47,17 +47,17 @@ export const useOpenEmailThreadInCommandMenu = () => { // ]), // ); - navigateCommandMenu({ - page: CommandMenuPages.ViewEmailThread, + navigateSidePanel({ + page: SidePanelPages.ViewEmailThread, pageTitle: t`Email Thread`, pageIcon: IconMail, pageId: pageComponentInstanceId, }); }, - [navigateCommandMenu, store], + [navigateSidePanel, store], ); return { - openEmailThreadInCommandMenu, + openEmailThreadInSidePanel, }; }; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenFrontComponentInCommandMenu.ts b/packages/twenty-front/src/modules/side-panel/hooks/useOpenFrontComponentInSidePanel.ts similarity index 62% rename from packages/twenty-front/src/modules/command-menu/hooks/useOpenFrontComponentInCommandMenu.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useOpenFrontComponentInSidePanel.ts index 29ff0cc0b2..c0f09ea253 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenFrontComponentInCommandMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenFrontComponentInSidePanel.ts @@ -1,16 +1,16 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { viewableFrontComponentIdComponentState } from '@/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState'; -import { viewableFrontComponentRecordContextComponentState } from '@/command-menu/pages/front-component/states/viewableFrontComponentRecordContextComponentState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { viewableFrontComponentIdComponentState } from '@/side-panel/pages/front-component/states/viewableFrontComponentIdComponentState'; +import { viewableFrontComponentRecordContextComponentState } from '@/side-panel/pages/front-component/states/viewableFrontComponentRecordContextComponentState'; import { useStore } from 'jotai'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { type IconComponent } from 'twenty-ui/display'; import { v4 } from 'uuid'; -export const useOpenFrontComponentInCommandMenu = () => { +export const useOpenFrontComponentInSidePanel = () => { const store = useStore(); - const { navigateCommandMenu } = useCommandMenu(); + const { navigateSidePanelMenu } = useSidePanelMenu(); - const openFrontComponentInCommandMenu = ({ + const openFrontComponentInSidePanel = ({ frontComponentId, pageTitle, pageIcon, @@ -42,8 +42,8 @@ export const useOpenFrontComponentInCommandMenu = () => { recordContext ?? null, ); - navigateCommandMenu({ - page: CommandMenuPages.ViewFrontComponent, + navigateSidePanelMenu({ + page: SidePanelPages.ViewFrontComponent, pageTitle, pageIcon, pageId: pageComponentInstanceId, @@ -52,6 +52,6 @@ export const useOpenFrontComponentInCommandMenu = () => { }; return { - openFrontComponentInCommandMenu, + openFrontComponentInSidePanel, }; }; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenMergeRecordsPageInCommandMenu.tsx b/packages/twenty-front/src/modules/side-panel/hooks/useOpenMergeRecordsPageInSidePanel.tsx similarity index 65% rename from packages/twenty-front/src/modules/command-menu/hooks/useOpenMergeRecordsPageInCommandMenu.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/useOpenMergeRecordsPageInSidePanel.tsx index c54b35995a..27b1338d96 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenMergeRecordsPageInCommandMenu.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenMergeRecordsPageInSidePanel.tsx @@ -1,10 +1,10 @@ -import { useCommandMenuUpdateNavigationMorphItemsByPage } from '@/command-menu/hooks/useCommandMenuUpdateNavigationMorphItemsByPage'; -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; +import { useSidePanelUpdateNavigationMorphItemsByPage } from '@/side-panel/hooks/useSidePanelUpdateNavigationMorphItemsByPage'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { useLazyFindManyRecords } from '@/object-record/hooks/useLazyFindManyRecords'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { msg, t } from '@lingui/core/macro'; import { useCallback } from 'react'; @@ -12,23 +12,23 @@ import { IconArrowMerge } from 'twenty-ui/display'; import { v4 } from 'uuid'; import { useStore } from 'jotai'; -type UseOpenMergeRecordsPageInCommandMenuProps = { +type UseOpenMergeRecordsPageInSidePanelProps = { objectNameSingular: string; objectRecordIds: string[]; }; -export const useOpenMergeRecordsPageInCommandMenu = ({ +export const useOpenMergeRecordsPageInSidePanel = ({ objectNameSingular, objectRecordIds, -}: UseOpenMergeRecordsPageInCommandMenuProps) => { +}: UseOpenMergeRecordsPageInSidePanelProps) => { const store = useStore(); const { objectMetadataItem } = useObjectMetadataItem({ objectNameSingular, }); - const { navigateCommandMenu } = useNavigateCommandMenu(); - const { updateCommandMenuNavigationMorphItemsByPage } = - useCommandMenuUpdateNavigationMorphItemsByPage(); + const { navigateSidePanel } = useNavigateSidePanel(); + const { updateSidePanelNavigationMorphItemsByPage } = + useSidePanelUpdateNavigationMorphItemsByPage(); const { upsertRecordsInStore } = useUpsertRecordsInStore(); @@ -41,7 +41,7 @@ export const useOpenMergeRecordsPageInCommandMenu = ({ }, }); - const openMergeRecordsPageInCommandMenu = useCallback(async () => { + const openMergeRecordsPageInSidePanel = useCallback(async () => { const pageId = v4(); store.set( @@ -51,7 +51,7 @@ export const useOpenMergeRecordsPageInCommandMenu = ({ objectMetadataItem.id, ); - await updateCommandMenuNavigationMorphItemsByPage({ + await updateSidePanelNavigationMorphItemsByPage({ pageId, objectMetadataId: objectMetadataItem.id, objectRecordIds, @@ -59,8 +59,8 @@ export const useOpenMergeRecordsPageInCommandMenu = ({ const { records } = await findManyRecordsLazy(); upsertRecordsInStore({ partialRecords: records ?? [] }); - navigateCommandMenu({ - page: CommandMenuPages.MergeRecords, + navigateSidePanel({ + page: SidePanelPages.MergeRecords, pageTitle: t(msg`Merge records`), pageIcon: IconArrowMerge, pageId, @@ -70,12 +70,12 @@ export const useOpenMergeRecordsPageInCommandMenu = ({ objectRecordIds, findManyRecordsLazy, upsertRecordsInStore, - navigateCommandMenu, - updateCommandMenuNavigationMorphItemsByPage, + navigateSidePanel, + updateSidePanelNavigationMorphItemsByPage, store, ]); return { - openMergeRecordsPageInCommandMenu, + openMergeRecordsPageInSidePanel, }; }; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordInCommandMenu.ts b/packages/twenty-front/src/modules/side-panel/hooks/useOpenRecordInSidePanel.ts similarity index 79% rename from packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordInCommandMenu.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useOpenRecordInSidePanel.ts index e8317465b6..4dd533e6b7 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordInCommandMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenRecordInSidePanel.ts @@ -1,8 +1,8 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; -import { viewableRecordNameSingularComponentState } from '@/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState'; -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; +import { viewableRecordNameSingularComponentState } from '@/side-panel/pages/record-page/states/viewableRecordNameSingularComponentState'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; @@ -14,11 +14,11 @@ import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector'; import { getIconColorForObjectType } from '@/object-metadata/utils/getIconColorForObjectType'; import { getLabelIdentifierFieldMetadataItem } from '@/object-metadata/utils/getLabelIdentifierFieldMetadataItem'; -import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; +import { viewableRecordIdState } from '@/object-record/record-side-panel/states/viewableRecordIdState'; import { useOpenNewRecordTitleCell } from '@/object-record/record-title-cell/hooks/useOpenNewRecordTitleCell'; -import { CommandMenuPages, CoreObjectNameSingular } from 'twenty-shared/types'; +import { CoreObjectNameSingular, SidePanelPages } from 'twenty-shared/types'; -import { useRunWorkflowRunOpeningInCommandMenuSideEffects } from '@/workflow/hooks/useRunWorkflowRunOpeningInCommandMenuSideEffects'; +import { useRunWorkflowRunOpeningInSidePanelEffects } from '@/workflow/hooks/useRunWorkflowRunOpeningInSidePanelEffects'; import { t } from '@lingui/core/macro'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -26,16 +26,16 @@ import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; import { v4 } from 'uuid'; -export const useOpenRecordInCommandMenu = () => { +export const useOpenRecordInSidePanel = () => { const store = useStore(); const { getIcon } = useIcons(); - const { navigateCommandMenu } = useCommandMenu(); - const { runWorkflowRunOpeningInCommandMenuSideEffects } = - useRunWorkflowRunOpeningInCommandMenuSideEffects(); + const { navigateSidePanelMenu } = useSidePanelMenu(); + const { runWorkflowRunOpeningInSidePanelEffects } = + useRunWorkflowRunOpeningInSidePanelEffects(); const { openNewRecordTitleCell } = useOpenNewRecordTitleCell(); - const openRecordInCommandMenu = useCallback( + const openRecordInSidePanel = useCallback( ({ recordId, objectNameSingular, @@ -47,7 +47,7 @@ export const useOpenRecordInCommandMenu = () => { isNewRecord?: boolean; resetNavigationStack?: boolean; }) => { - const navigationStack = store.get(commandMenuNavigationStackState.atom); + const navigationStack = store.get(sidePanelNavigationStackState.atom); const currentNavigationStackItem = navigationStack.at(-1); @@ -146,7 +146,7 @@ export const useOpenRecordInCommandMenu = () => { ); const currentMorphItems = store.get( - commandMenuNavigationMorphItemsByPageState.atom, + sidePanelNavigationMorphItemsByPageState.atom, ); const morphItemToAdd = { @@ -158,7 +158,7 @@ export const useOpenRecordInCommandMenu = () => { newMorphItemsMap.set(pageComponentInstanceId, [morphItemToAdd]); store.set( - commandMenuNavigationMorphItemsByPageState.atom, + sidePanelNavigationMorphItemsByPageState.atom, newMorphItemsMap, ); @@ -172,8 +172,8 @@ export const useOpenRecordInCommandMenu = () => { const objectLabelSingular = objectMetadataItem.labelSingular; - navigateCommandMenu({ - page: CommandMenuPages.ViewRecord, + navigateSidePanelMenu({ + page: SidePanelPages.ViewRecord, pageTitle: isNewRecord ? t`New ${objectLabelSingular}` : objectLabelSingular, @@ -184,7 +184,7 @@ export const useOpenRecordInCommandMenu = () => { }); if (objectNameSingular === CoreObjectNameSingular.WorkflowRun) { - runWorkflowRunOpeningInCommandMenuSideEffects({ + runWorkflowRunOpeningInSidePanelEffects({ objectMetadataItem, recordId, }); @@ -204,14 +204,14 @@ export const useOpenRecordInCommandMenu = () => { }, [ getIcon, - navigateCommandMenu, + navigateSidePanelMenu, openNewRecordTitleCell, - runWorkflowRunOpeningInCommandMenuSideEffects, + runWorkflowRunOpeningInSidePanelEffects, store, ], ); return { - openRecordInCommandMenu, + openRecordInSidePanel, }; }; diff --git a/packages/twenty-front/src/modules/side-panel/hooks/useOpenRecordsSearchPageInSidePanel.ts b/packages/twenty-front/src/modules/side-panel/hooks/useOpenRecordsSearchPageInSidePanel.ts new file mode 100644 index 0000000000..2c5d43f0c0 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenRecordsSearchPageInSidePanel.ts @@ -0,0 +1,26 @@ +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { t } from '@lingui/core/macro'; +import { SidePanelPages } from 'twenty-shared/types'; +import { IconSearch } from 'twenty-ui/display'; +import { v4 } from 'uuid'; + +export const useOpenRecordsSearchPageInSidePanel = () => { + const { navigateSidePanelMenu } = useSidePanelMenu(); + const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState); + + const openRecordsSearchPage = () => { + navigateSidePanelMenu({ + page: SidePanelPages.SearchRecords, + pageTitle: t`Search`, + pageIcon: IconSearch, + pageId: v4(), + resetNavigationStack: isSidePanelOpened, + }); + }; + + return { + openRecordsSearchPage, + }; +}; diff --git a/packages/twenty-front/src/modules/side-panel/hooks/useOpenRichTextInSidePanel.ts b/packages/twenty-front/src/modules/side-panel/hooks/useOpenRichTextInSidePanel.ts new file mode 100644 index 0000000000..83984f90e1 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenRichTextInSidePanel.ts @@ -0,0 +1,34 @@ +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { viewableRichTextComponentState } from '@/side-panel/pages/rich-text-page/states/viewableRichTextComponentState'; +import { t } from '@lingui/core/macro'; +import { useStore } from 'jotai'; +import { useCallback } from 'react'; +import { SidePanelPages } from 'twenty-shared/types'; +import { IconPencil } from 'twenty-ui/display'; + +export const useOpenRichTextInSidePanel = () => { + const { navigateSidePanelMenu, openSidePanelMenu } = useSidePanelMenu(); + + const store = useStore(); + + const openRichTextInSidePanel = useCallback( + (activityId: string, activityObjectNameSingular: string) => { + store.set(viewableRichTextComponentState.atom, { + activityId, + activityObjectNameSingular, + }); + + openSidePanelMenu(); + navigateSidePanelMenu({ + page: SidePanelPages.EditRichText, + pageTitle: t`Rich Text`, + pageIcon: IconPencil, + }); + }, + [navigateSidePanelMenu, openSidePanelMenu, store], + ); + + return { + openRichTextInSidePanel, + }; +}; diff --git a/packages/twenty-front/src/modules/side-panel/hooks/useOpenUpdateMultipleRecordsPageInSidePanel.tsx b/packages/twenty-front/src/modules/side-panel/hooks/useOpenUpdateMultipleRecordsPageInSidePanel.tsx new file mode 100644 index 0000000000..041cc83831 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/hooks/useOpenUpdateMultipleRecordsPageInSidePanel.tsx @@ -0,0 +1,29 @@ +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { SidePanelPages } from 'twenty-shared/types'; + +import { msg, t } from '@lingui/core/macro'; +import { useCallback } from 'react'; +import { IconBoxMultiple } from 'twenty-ui/display'; + +type UseOpenUpdateMultipleRecordsPageInSidePanelProps = { + contextStoreInstanceId: string; +}; + +export const useOpenUpdateMultipleRecordsPageInSidePanel = ({ + contextStoreInstanceId, +}: UseOpenUpdateMultipleRecordsPageInSidePanelProps) => { + const { navigateSidePanel } = useNavigateSidePanel(); + + const openUpdateMultipleRecordsPageInSidePanel = useCallback(async () => { + navigateSidePanel({ + page: SidePanelPages.UpdateRecords, + pageTitle: t(msg`Update records`), + pageIcon: IconBoxMultiple, + pageId: contextStoreInstanceId, + }); + }, [navigateSidePanel, contextStoreInstanceId]); + + return { + openUpdateMultipleRecordsPageInSidePanel, + }; +}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCloseAnimationCompleteCleanup.ts b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelCloseAnimationCompleteCleanup.ts similarity index 58% rename from packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCloseAnimationCompleteCleanup.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useSidePanelCloseAnimationCompleteCleanup.ts index 226ecfcf0f..c6660de1c1 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCloseAnimationCompleteCleanup.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelCloseAnimationCompleteCleanup.ts @@ -1,24 +1,24 @@ -import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId'; -import { COMMAND_MENU_CONTEXT_CHIP_GROUPS_DROPDOWN_ID } from '@/command-menu/constants/CommandMenuContextChipGroupsDropdownId'; -import { COMMAND_MENU_LIST_SELECTABLE_LIST_ID } from '@/command-menu/constants/CommandMenuListSelectableListId'; -import { COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuPreviousComponentInstanceId'; +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { SIDE_PANEL_CONTEXT_CHIP_GROUPS_DROPDOWN_ID } from '@/side-panel/constants/SidePanelContextChipGroupsDropdownId'; +import { SIDE_PANEL_SELECTABLE_LIST_ID } from '@/side-panel/constants/SidePanelSelectableListId'; +import { SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelPreviousComponentInstanceId'; import { useResetContextStoreStates } from '@/command-menu/hooks/useResetContextStoreStates'; -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; -import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; -import { isCommandMenuClosingState } from '@/command-menu/states/isCommandMenuClosingState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState'; +import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState'; +import { isSidePanelClosingState } from '@/side-panel/states/isSidePanelClosingState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; -import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; +import { viewableRecordIdState } from '@/object-record/record-side-panel/states/viewableRecordIdState'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { pageLayoutDraggedAreaComponentState } from '@/page-layout/states/pageLayoutDraggedAreaComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { pageLayoutTabSettingsOpenTabIdComponentState } from '@/page-layout/states/pageLayoutTabSettingsOpenTabIdComponentState'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { emitSidePanelCloseEvent } from '@/ui/layout/right-drawer/utils/emitSidePanelCloseEvent'; +import { emitSidePanelCloseEvent } from '@/ui/layout/side-panel/utils/emitSidePanelCloseEvent'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { getShowPageTabListComponentId } from '@/ui/layout/show-page/utils/getShowPageTabListComponentId'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; @@ -26,43 +26,43 @@ import { WORKFLOW_LOGIC_FUNCTION_TAB_LIST_COMPONENT_ID } from '@/workflow/workfl import { WorkflowLogicFunctionTabId } from '@/workflow/workflow-steps/workflow-actions/code-action/types/WorkflowLogicFunctionTabId'; import { useStore } from 'jotai'; import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; -export const useCommandMenuCloseAnimationCompleteCleanup = () => { +export const useSidePanelCloseAnimationCompleteCleanup = () => { const store = useStore(); const { resetSelectedItem } = useSelectableList( - COMMAND_MENU_LIST_SELECTABLE_LIST_ID, + SIDE_PANEL_SELECTABLE_LIST_ID, ); const { resetContextStoreStates } = useResetContextStoreStates(); const { closeDropdown } = useCloseDropdown(); - const commandMenuCloseAnimationCompleteCleanup = useCallback( + const sidePanelCloseAnimationCompleteCleanup = useCallback( (options?: { emitSidePanelCloseEvent?: boolean }) => { - closeDropdown(COMMAND_MENU_CONTEXT_CHIP_GROUPS_DROPDOWN_ID); + closeDropdown(SIDE_PANEL_CONTEXT_CHIP_GROUPS_DROPDOWN_ID); // Snapshot values before any mutations (Jotai store.get is live and // reflects the latest state, so we capture before mutating). - const currentPage = store.get(commandMenuPageState.atom); + const currentPage = store.get(sidePanelPageState.atom); const targetedRecordsRule = store.get( contextStoreTargetedRecordsRuleComponentState.atomFamily({ - instanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID, + instanceId: SIDE_PANEL_COMPONENT_INSTANCE_ID, }), ); const morphItemsByPage = store.get( - commandMenuNavigationMorphItemsByPageState.atom, + sidePanelNavigationMorphItemsByPageState.atom, ); - resetContextStoreStates(COMMAND_MENU_COMPONENT_INSTANCE_ID); - resetContextStoreStates(COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID); + resetContextStoreStates(SIDE_PANEL_COMPONENT_INSTANCE_ID); + resetContextStoreStates(SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID); const isPageLayoutEditingPage = - currentPage === CommandMenuPages.PageLayoutWidgetTypeSelect || - currentPage === CommandMenuPages.PageLayoutGraphTypeSelect || - currentPage === CommandMenuPages.PageLayoutIframeSettings || - currentPage === CommandMenuPages.PageLayoutTabSettings; + currentPage === SidePanelPages.PageLayoutWidgetTypeSelect || + currentPage === SidePanelPages.PageLayoutGraphTypeSelect || + currentPage === SidePanelPages.PageLayoutIframeSettings || + currentPage === SidePanelPages.PageLayoutTabSettings; if (isPageLayoutEditingPage) { if ( @@ -96,23 +96,23 @@ export const useCommandMenuCloseAnimationCompleteCleanup = () => { } store.set(viewableRecordIdState.atom, null); - store.set(commandMenuPageState.atom, CommandMenuPages.Root); - store.set(commandMenuPageInfoState.atom, { + store.set(sidePanelPageState.atom, SidePanelPages.Root); + store.set(sidePanelPageInfoState.atom, { title: undefined, Icon: undefined, instanceId: '', }); - store.set(isCommandMenuOpenedState.atom, false); - store.set(commandMenuSearchState.atom, ''); - store.set(commandMenuNavigationMorphItemsByPageState.atom, new Map()); - store.set(commandMenuNavigationStackState.atom, []); + store.set(isSidePanelOpenedState.atom, false); + store.set(sidePanelSearchState.atom, ''); + store.set(sidePanelNavigationMorphItemsByPageState.atom, new Map()); + store.set(sidePanelNavigationStackState.atom, []); resetSelectedItem(); - store.set(hasUserSelectedCommandState.atom, false); + store.set(hasUserSelectedSidePanelListItemState.atom, false); if (options?.emitSidePanelCloseEvent !== false) { emitSidePanelCloseEvent(); } - store.set(isCommandMenuClosingState.atom, false); + store.set(isSidePanelClosingState.atom, false); store.set( activeTabIdComponentState.atomFamily({ instanceId: WORKFLOW_LOGIC_FUNCTION_TAB_LIST_COMPONENT_ID, @@ -136,6 +136,6 @@ export const useCommandMenuCloseAnimationCompleteCleanup = () => { ); return { - commandMenuCloseAnimationCompleteCleanup, + sidePanelCloseAnimationCompleteCleanup, }; }; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelContextChips.tsx similarity index 60% rename from packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/useSidePanelContextChips.tsx index 5a06000519..933bdb64fd 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelContextChips.tsx @@ -1,8 +1,8 @@ -import { CommandMenuContextChipIconWrapper } from '@/command-menu/components/CommandMenuContextChipIconWrapper'; -import { CommandMenuContextRecordChipAvatars } from '@/command-menu/components/CommandMenuContextRecordChipAvatars'; -import { useCommandMenuHistory } from '@/command-menu/hooks/useCommandMenuHistory'; -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +import { SidePanelContextChipIconWrapper } from '@/side-panel/components/SidePanelContextChipIconWrapper'; +import { SidePanelContextRecordChipAvatars } from '@/side-panel/components/SidePanelContextRecordChipAvatars'; +import { useSidePanelHistory } from '@/side-panel/hooks/useSidePanelHistory'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { recordStoreIdentifiersFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreIdentifiersSelector'; @@ -10,15 +10,15 @@ import { recordStoreRecordsSelector } from '@/object-record/record-store/states/ import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useContext, useMemo } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants'; -export const useCommandMenuContextChips = () => { +export const useSidePanelContextChips = () => { const { theme } = useContext(ThemeContext); const iconSizeSm = theme.icon.size.sm; - const commandMenuNavigationStack = useAtomStateValue( - commandMenuNavigationStackState, + const sidePanelNavigationStack = useAtomStateValue( + sidePanelNavigationStackState, ); const allowRequestsToTwentyIcons = useAtomStateValue( @@ -27,14 +27,14 @@ export const useCommandMenuContextChips = () => { const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); - const { navigateCommandMenuHistory } = useCommandMenuHistory(); + const { navigateSidePanelHistory } = useSidePanelHistory(); - const commandMenuNavigationMorphItemsByPage = useAtomStateValue( - commandMenuNavigationMorphItemsByPageState, + const sidePanelNavigationMorphItemsByPage = useAtomStateValue( + sidePanelNavigationMorphItemsByPageState, ); const allRecordIds = Array.from( - commandMenuNavigationMorphItemsByPage.entries(), + sidePanelNavigationMorphItemsByPage.entries(), ).flatMap(([, morphItems]) => morphItems.map((morphItem) => morphItem.recordId), ); @@ -51,38 +51,36 @@ export const useCommandMenuContextChips = () => { }); const contextChips = useMemo(() => { - const filteredCommandMenuNavigationStack = - commandMenuNavigationStack.filter( - (page) => page.page !== CommandMenuPages.Root, - ); + const filteredSidePanelNavigationStack = sidePanelNavigationStack.filter( + (page) => page.page !== SidePanelPages.Root, + ); - return filteredCommandMenuNavigationStack + return filteredSidePanelNavigationStack .map((page, index) => { const isLastChip = - index === filteredCommandMenuNavigationStack.length - 1; + index === filteredSidePanelNavigationStack.length - 1; - const isRecordPage = page.page === CommandMenuPages.ViewRecord; + const isRecordPage = page.page === SidePanelPages.ViewRecord; if (isRecordPage && !isLastChip) { - const commandMenuNavigationMorphItem = - commandMenuNavigationMorphItemsByPage.get(page.pageId)?.[0]; + const sidePanelNavigationMorphItem = + sidePanelNavigationMorphItemsByPage.get(page.pageId)?.[0]; - if (!isDefined(commandMenuNavigationMorphItem?.recordId)) { + if (!isDefined(sidePanelNavigationMorphItem?.recordId)) { return null; } const objectMetadataItem = objectMetadataItems.find( - (item) => - item.id === commandMenuNavigationMorphItem.objectMetadataId, + (item) => item.id === sidePanelNavigationMorphItem.objectMetadataId, ); const recordIdentifier = recordIdentifiers.find( (recordIdentifier) => - recordIdentifier.id === commandMenuNavigationMorphItem.recordId, + recordIdentifier.id === sidePanelNavigationMorphItem.recordId, ); const record = records.find( - (record) => record.id === commandMenuNavigationMorphItem.recordId, + (record) => record.id === sidePanelNavigationMorphItem.recordId, ); if ( @@ -96,14 +94,14 @@ export const useCommandMenuContextChips = () => { return { page, Icons: [ - , ], text: recordIdentifier.name, onClick: () => { - navigateCommandMenuHistory(index); + navigateSidePanelHistory(index); }, }; } @@ -113,7 +111,7 @@ export const useCommandMenuContextChips = () => { Icons: isLastChip ? [] : [ - + { : themeCssVariables.font.color.tertiary } /> - , + , ], text: page.pageTitle, onClick: isLastChip ? undefined : () => { - navigateCommandMenuHistory(index); + navigateSidePanelHistory(index); }, }; }) .filter(isDefined); }, [ - commandMenuNavigationMorphItemsByPage, - commandMenuNavigationStack, + sidePanelNavigationMorphItemsByPage, + sidePanelNavigationStack, + navigateSidePanelHistory, iconSizeSm, - navigateCommandMenuHistory, objectMetadataItems, recordIdentifiers, records, diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useFilteredPickerItems.ts b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelFilteredPickerItems.ts similarity index 75% rename from packages/twenty-front/src/modules/command-menu/hooks/useFilteredPickerItems.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useSidePanelFilteredPickerItems.ts index 78e82cf5c7..bf672c8e60 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useFilteredPickerItems.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelFilteredPickerItems.ts @@ -1,25 +1,25 @@ import { filterBySearchQuery } from '~/utils/filterBySearchQuery'; -type UseFilteredPickerItemsParams = { +type UseSidePanelFilteredPickerItemsParams = { items: T[]; searchQuery: string; getSearchableValues: (item: T) => string[]; appendSelectableIds?: string[]; }; -type UseFilteredPickerItemsResult = { +type UseSidePanelFilteredPickerItemsResult = { filteredItems: T[]; selectableItemIds: string[]; isEmpty: boolean; hasSearchQuery: boolean; }; -export const useFilteredPickerItems = ({ +export const useSidePanelFilteredPickerItems = ({ items, searchQuery, getSearchableValues, appendSelectableIds = [], -}: UseFilteredPickerItemsParams): UseFilteredPickerItemsResult => { +}: UseSidePanelFilteredPickerItemsParams): UseSidePanelFilteredPickerItemsResult => { const filteredItems = filterBySearchQuery({ items, searchQuery, diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHistory.ts b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelHistory.ts similarity index 60% rename from packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHistory.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useSidePanelHistory.ts index 1a19471e2f..b8b31a77df 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHistory.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelHistory.ts @@ -1,46 +1,46 @@ import { useCallback } from 'react'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; -import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { sidePanelPageState } from '@/side-panel/states/sidePanelPageState'; +import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState'; import { getShowPageTabListComponentId } from '@/ui/layout/show-page/utils/getShowPageTabListComponentId'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { isNonEmptyArray } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; import { useStore } from 'jotai'; -export const useCommandMenuHistory = () => { +export const useSidePanelHistory = () => { const store = useStore(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); - const goBackFromCommandMenu = useCallback(() => { + const goBackFromSidePanel = useCallback(() => { const currentNavigationStack = store.get( - commandMenuNavigationStackState.atom, + sidePanelNavigationStackState.atom, ); const newNavigationStack = currentNavigationStack.slice(0, -1); const lastNavigationStackItem = newNavigationStack.at(-1); if (!isDefined(lastNavigationStackItem)) { - closeCommandMenu(); + closeSidePanelMenu(); return; } - store.set(commandMenuPageState.atom, lastNavigationStackItem.page); + store.set(sidePanelPageState.atom, lastNavigationStackItem.page); - store.set(commandMenuPageInfoState.atom, { + store.set(sidePanelPageInfoState.atom, { title: lastNavigationStackItem.pageTitle, Icon: lastNavigationStackItem.pageIcon, instanceId: lastNavigationStackItem.pageId, }); - store.set(commandMenuNavigationStackState.atom, newNavigationStack); + store.set(sidePanelNavigationStackState.atom, newNavigationStack); const currentMorphItems = store.get( - commandMenuNavigationMorphItemsByPageState.atom, + sidePanelNavigationMorphItemsByPageState.atom, ); if (currentNavigationStack.length > 0) { @@ -49,10 +49,7 @@ export const useCommandMenuHistory = () => { if (isDefined(removedItem)) { const newMorphItems = new Map(currentMorphItems); newMorphItems.delete(removedItem.pageId); - store.set( - commandMenuNavigationMorphItemsByPageState.atom, - newMorphItems, - ); + store.set(sidePanelNavigationMorphItemsByPageState.atom, newMorphItems); const morphItems = currentMorphItems.get(removedItem.pageId); if (isNonEmptyArray(morphItems)) { @@ -69,35 +66,35 @@ export const useCommandMenuHistory = () => { } } - store.set(hasUserSelectedCommandState.atom, false); - }, [closeCommandMenu, store]); + store.set(hasUserSelectedSidePanelListItemState.atom, false); + }, [closeSidePanelMenu, store]); - const navigateCommandMenuHistory = useCallback( + const navigateSidePanelHistory = useCallback( (pageIndex: number) => { const currentNavigationStack = store.get( - commandMenuNavigationStackState.atom, + sidePanelNavigationStackState.atom, ); const newNavigationStack = currentNavigationStack.slice(0, pageIndex + 1); - store.set(commandMenuNavigationStackState.atom, newNavigationStack); + store.set(sidePanelNavigationStackState.atom, newNavigationStack); const newNavigationStackItem = newNavigationStack.at(-1); if (!isDefined(newNavigationStackItem)) { throw new Error( - `No command menu navigation stack item found for index ${pageIndex}`, + `No side panel navigation stack item found for index ${pageIndex}`, ); } - store.set(commandMenuPageState.atom, newNavigationStackItem.page); - store.set(commandMenuPageInfoState.atom, { + store.set(sidePanelPageState.atom, newNavigationStackItem.page); + store.set(sidePanelPageInfoState.atom, { title: newNavigationStackItem.pageTitle, Icon: newNavigationStackItem.pageIcon, instanceId: newNavigationStackItem.pageId, }); const currentMorphItems = store.get( - commandMenuNavigationMorphItemsByPageState.atom, + sidePanelNavigationMorphItemsByPageState.atom, ); for (const [pageId, morphItems] of currentMorphItems.entries()) { @@ -120,15 +117,15 @@ export const useCommandMenuHistory = () => { ), ); - store.set(commandMenuNavigationMorphItemsByPageState.atom, newMorphItems); + store.set(sidePanelNavigationMorphItemsByPageState.atom, newMorphItems); - store.set(hasUserSelectedCommandState.atom, false); + store.set(hasUserSelectedSidePanelListItemState.atom, false); }, [store], ); return { - goBackFromCommandMenu, - navigateCommandMenuHistory, + goBackFromSidePanel, + navigateSidePanelHistory, }; }; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenu.ts b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelMenu.ts similarity index 55% rename from packages/twenty-front/src/modules/command-menu/hooks/useCommandMenu.ts rename to packages/twenty-front/src/modules/side-panel/hooks/useSidePanelMenu.ts index ba81728d1a..c22b5d21f9 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelMenu.ts @@ -1,36 +1,36 @@ -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; -import { isCommandMenuClosingState } from '@/command-menu/states/isCommandMenuClosingState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState'; +import { isSidePanelClosingState } from '@/side-panel/states/isSidePanelClosingState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { addToNavPayloadRegistryState } from '@/navigation-menu-item/states/addToNavPayloadRegistryState'; import { isNavigationMenuInEditModeState } from '@/navigation-menu-item/states/isNavigationMenuInEditModeState'; import { selectedNavigationMenuItemInEditModeState } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeState'; import { useCloseAnyOpenDropdown } from '@/ui/layout/dropdown/hooks/useCloseAnyOpenDropdown'; -import { emitSidePanelOpenEvent } from '@/ui/layout/right-drawer/utils/emitSidePanelOpenEvent'; +import { emitSidePanelOpenEvent } from '@/ui/layout/side-panel/utils/emitSidePanelOpenEvent'; import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById'; import { t } from '@lingui/core/macro'; import { useStore } from 'jotai'; import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { IconColumnInsertRight, IconDotsVertical } from 'twenty-ui/display'; -export const useCommandMenu = () => { +export const useSidePanelMenu = () => { const store = useStore(); - const { navigateCommandMenu } = useNavigateCommandMenu(); + const { navigateSidePanel } = useNavigateSidePanel(); const { closeAnyOpenDropdown } = useCloseAnyOpenDropdown(); const { removeFocusItemFromFocusStackById } = useRemoveFocusItemFromFocusStackById(); - const closeCommandMenu = useCallback(() => { - const isCommandMenuOpened = store.get(isCommandMenuOpenedState.atom); + const closeSidePanelMenu = useCallback(() => { + const isSidePanelOpened = store.get(isSidePanelOpenedState.atom); - if (isCommandMenuOpened) { + if (isSidePanelOpened) { store.set(addToNavPayloadRegistryState.atom, new Map()); - store.set(isCommandMenuOpenedState.atom, false); - store.set(isCommandMenuClosingState.atom, true); + store.set(isSidePanelOpenedState.atom, false); + store.set(isSidePanelClosingState.atom, true); closeAnyOpenDropdown(); removeFocusItemFromFocusStackById({ focusId: SIDE_PANEL_FOCUS_ID, @@ -38,7 +38,7 @@ export const useCommandMenu = () => { } }, [closeAnyOpenDropdown, removeFocusItemFromFocusStackById, store]); - const openCommandMenu = useCallback(() => { + const openSidePanelMenu = useCallback(() => { emitSidePanelOpenEvent(); closeAnyOpenDropdown(); const isNavigationMenuInEditMode = store.get( @@ -48,45 +48,47 @@ export const useCommandMenu = () => { selectedNavigationMenuItemInEditModeState.atom, ); if (isNavigationMenuInEditMode && isDefined(selectedNavigationItemId)) { - navigateCommandMenu({ - page: CommandMenuPages.NavigationMenuItemEdit, + navigateSidePanel({ + page: SidePanelPages.NavigationMenuItemEdit, pageTitle: t`Edit`, pageIcon: IconDotsVertical, resetNavigationStack: true, }); } else if (isNavigationMenuInEditMode) { - navigateCommandMenu({ - page: CommandMenuPages.NavigationMenuAddItem, + navigateSidePanel({ + page: SidePanelPages.NavigationMenuAddItem, pageTitle: t`New sidebar item`, pageIcon: IconColumnInsertRight, resetNavigationStack: true, }); } else { - navigateCommandMenu({ - page: CommandMenuPages.Root, + navigateSidePanel({ + page: SidePanelPages.Root, pageTitle: t`Command Menu`, pageIcon: IconDotsVertical, resetNavigationStack: true, }); } - }, [closeAnyOpenDropdown, navigateCommandMenu, store]); + }, [closeAnyOpenDropdown, navigateSidePanel, store]); - const toggleCommandMenu = useCallback(() => { - const isCommandMenuOpened = store.get(isCommandMenuOpenedState.atom); + const navigateSidePanelMenu = navigateSidePanel; - store.set(commandMenuSearchState.atom, ''); + const toggleSidePanelMenu = useCallback(() => { + const isSidePanelOpened = store.get(isSidePanelOpenedState.atom); - if (isCommandMenuOpened) { - closeCommandMenu(); + store.set(sidePanelSearchState.atom, ''); + + if (isSidePanelOpened) { + closeSidePanelMenu(); } else { - openCommandMenu(); + openSidePanelMenu(); } - }, [closeCommandMenu, openCommandMenu, store]); + }, [closeSidePanelMenu, openSidePanelMenu, store]); return { - openCommandMenu, - closeCommandMenu, - navigateCommandMenu, - toggleCommandMenu, + openSidePanelMenu, + closeSidePanelMenu, + navigateSidePanelMenu, + toggleSidePanelMenu, }; }; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuUpdateNavigationMorphItemsByPage.tsx b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelUpdateNavigationMorphItemsByPage.tsx similarity index 63% rename from packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuUpdateNavigationMorphItemsByPage.tsx rename to packages/twenty-front/src/modules/side-panel/hooks/useSidePanelUpdateNavigationMorphItemsByPage.tsx index 0b3043c6eb..0d8854deb1 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuUpdateNavigationMorphItemsByPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/hooks/useSidePanelUpdateNavigationMorphItemsByPage.tsx @@ -1,4 +1,4 @@ -import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/states/commandMenuNavigationMorphItemsByPageState'; +import { sidePanelNavigationMorphItemsByPageState } from '@/side-panel/states/sidePanelNavigationMorphItemsByPageState'; import { useCallback } from 'react'; import { useStore } from 'jotai'; @@ -8,16 +8,16 @@ type UpdateNavigationMorphItemsByPageParams = { objectRecordIds: string[]; }; -export const useCommandMenuUpdateNavigationMorphItemsByPage = () => { +export const useSidePanelUpdateNavigationMorphItemsByPage = () => { const store = useStore(); - const updateCommandMenuNavigationMorphItemsByPage = useCallback( + const updateSidePanelNavigationMorphItemsByPage = useCallback( async ({ pageId, objectMetadataId, objectRecordIds, }: UpdateNavigationMorphItemsByPageParams) => { const currentMorphItems = store.get( - commandMenuNavigationMorphItemsByPageState.atom, + sidePanelNavigationMorphItemsByPageState.atom, ); const newMorphItems = objectRecordIds.map((recordId) => ({ @@ -28,7 +28,7 @@ export const useCommandMenuUpdateNavigationMorphItemsByPage = () => { const newMorphItemsMap = new Map(currentMorphItems); newMorphItemsMap.set(pageId, newMorphItems); store.set( - commandMenuNavigationMorphItemsByPageState.atom, + sidePanelNavigationMorphItemsByPageState.atom, newMorphItemsMap, ); }, @@ -36,6 +36,6 @@ export const useCommandMenuUpdateNavigationMorphItemsByPage = () => { ); return { - updateCommandMenuNavigationMorphItemsByPage, + updateSidePanelNavigationMorphItemsByPage, }; }; diff --git a/packages/twenty-front/src/modules/side-panel/hooks/useUpdateSidePanelPageInfo.ts b/packages/twenty-front/src/modules/side-panel/hooks/useUpdateSidePanelPageInfo.ts new file mode 100644 index 0000000000..333169d857 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/hooks/useUpdateSidePanelPageInfo.ts @@ -0,0 +1,58 @@ +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; +import { useCallback } from 'react'; +import { type IconComponent, IconDotsVertical } from 'twenty-ui/display'; +import { useStore } from 'jotai'; + +export const useUpdateSidePanelPageInfo = () => { + const store = useStore(); + const updateSidePanelPageInfo = useCallback( + ({ + pageTitle, + pageIcon, + }: { + pageTitle?: string; + pageIcon?: IconComponent; + }) => { + const sidePanelPageInfo = store.get(sidePanelPageInfoState.atom); + + const newSidePanelPageInfo = { + ...sidePanelPageInfo, + title: pageTitle ?? sidePanelPageInfo.title ?? '', + Icon: pageIcon ?? sidePanelPageInfo.Icon ?? IconDotsVertical, + }; + + store.set(sidePanelPageInfoState.atom, newSidePanelPageInfo); + + const sidePanelNavigationStack = store.get( + sidePanelNavigationStackState.atom, + ); + + const lastSidePanelNavigationStackItem = sidePanelNavigationStack.at(-1); + + if (!lastSidePanelNavigationStackItem) { + return; + } + + const newSidePanelNavigationStack = [ + ...sidePanelNavigationStack.slice(0, -1), + { + page: lastSidePanelNavigationStackItem.page, + pageTitle: newSidePanelPageInfo.title, + pageIcon: newSidePanelPageInfo.Icon, + pageId: lastSidePanelNavigationStackItem.pageId, + }, + ]; + + store.set( + sidePanelNavigationStackState.atom, + newSidePanelNavigationStack, + ); + }, + [store], + ); + + return { + updateSidePanelPageInfo, + }; +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/AIChatThreads/components/CommandMenuAIChatThreadsPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/AIChatThreads/components/SidePanelAIChatThreadsPage.tsx similarity index 84% rename from packages/twenty-front/src/modules/command-menu/pages/AIChatThreads/components/CommandMenuAIChatThreadsPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/AIChatThreads/components/SidePanelAIChatThreadsPage.tsx index cee799f3ae..ee0e47ee01 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/AIChatThreads/components/CommandMenuAIChatThreadsPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/AIChatThreads/components/SidePanelAIChatThreadsPage.tsx @@ -6,7 +6,7 @@ const StyledContainer = styled.div` width: 100%; `; -export const CommandMenuAIChatThreadsPage = () => { +export const SidePanelAIChatThreadsPage = () => { return ( diff --git a/packages/twenty-front/src/modules/command-menu/pages/ask-ai/components/CommandMenuAskAIPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/ask-ai/components/SidePanelAskAIPage.tsx similarity index 85% rename from packages/twenty-front/src/modules/command-menu/pages/ask-ai/components/CommandMenuAskAIPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/ask-ai/components/SidePanelAskAIPage.tsx index e5cd9b68ca..ae14d1c1e8 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/ask-ai/components/CommandMenuAskAIPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/ask-ai/components/SidePanelAskAIPage.tsx @@ -6,7 +6,7 @@ const StyledContainer = styled.div` width: 100%; `; -export const CommandMenuAskAIPage = () => { +export const SidePanelAskAIPage = () => { return ( diff --git a/packages/twenty-front/src/modules/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/calendar-event/components/SidePanelCalendarEventPage.tsx similarity index 92% rename from packages/twenty-front/src/modules/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/calendar-event/components/SidePanelCalendarEventPage.tsx index 084c338491..a1d630abd2 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/calendar-event/components/SidePanelCalendarEventPage.tsx @@ -1,7 +1,7 @@ import { CalendarEventDetails } from '@/activities/calendar/components/CalendarEventDetails'; import { CalendarEventDetailsEffect } from '@/activities/calendar/components/CalendarEventDetailsEffect'; import { type CalendarEvent } from '@/activities/calendar/types/CalendarEvent'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; import { CoreObjectNameSingular } from 'twenty-shared/types'; import { useGenerateDepthRecordGqlFieldsFromObject } from '@/object-record/graphql/record-gql-fields/hooks/useGenerateDepthRecordGqlFieldsFromObject'; import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord'; @@ -10,7 +10,7 @@ import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingCon import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { PageLayoutType } from '~/generated-metadata/graphql'; -export const CommandMenuCalendarEventPage = () => { +export const SidePanelCalendarEventPage = () => { const { upsertRecordsInStore } = useUpsertRecordsInStore(); const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, @@ -59,7 +59,7 @@ export const CommandMenuCalendarEventPage = () => { targetObjectNameSingular: CoreObjectNameSingular.CalendarEvent, }, layoutType: PageLayoutType.RECORD_PAGE, - isInRightDrawer: true, + isInSidePanel: true, }} > diff --git a/packages/twenty-front/src/modules/command-menu/pages/common/components/SidePanelSubPageNavigationHeader.tsx b/packages/twenty-front/src/modules/side-panel/pages/common/components/SidePanelSubPageNavigationHeader.tsx similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/common/components/SidePanelSubPageNavigationHeader.tsx rename to packages/twenty-front/src/modules/side-panel/pages/common/components/SidePanelSubPageNavigationHeader.tsx diff --git a/packages/twenty-front/src/modules/command-menu/pages/front-component/components/CommandMenuFrontComponentPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/front-component/components/SidePanelFrontComponentPage.tsx similarity index 82% rename from packages/twenty-front/src/modules/command-menu/pages/front-component/components/CommandMenuFrontComponentPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/front-component/components/SidePanelFrontComponentPage.tsx index f96c947649..87e3f6788f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/front-component/components/CommandMenuFrontComponentPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/front-component/components/SidePanelFrontComponentPage.tsx @@ -1,7 +1,7 @@ import { Suspense, lazy } from 'react'; -import { viewableFrontComponentIdComponentState } from '@/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState'; -import { viewableFrontComponentRecordContextComponentState } from '@/command-menu/pages/front-component/states/viewableFrontComponentRecordContextComponentState'; +import { viewableFrontComponentIdComponentState } from '@/side-panel/pages/front-component/states/viewableFrontComponentIdComponentState'; +import { viewableFrontComponentRecordContextComponentState } from '@/side-panel/pages/front-component/states/viewableFrontComponentRecordContextComponentState'; import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; @@ -13,7 +13,7 @@ const FrontComponentRenderer = lazy(() => ), ); -export const CommandMenuFrontComponentPage = () => { +export const SidePanelFrontComponentPage = () => { const viewableFrontComponentId = useAtomComponentStateValue( viewableFrontComponentIdComponentState, ); @@ -37,7 +37,7 @@ export const CommandMenuFrontComponentPage = () => { } : undefined, layoutType: PageLayoutType.DASHBOARD, - isInRightDrawer: true, + isInSidePanel: true, }} > diff --git a/packages/twenty-front/src/modules/side-panel/pages/front-component/states/viewableFrontComponentIdComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/front-component/states/viewableFrontComponentIdComponentState.ts new file mode 100644 index 0000000000..5bbbd5ed44 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/front-component/states/viewableFrontComponentIdComponentState.ts @@ -0,0 +1,10 @@ +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; + +export const viewableFrontComponentIdComponentState = createAtomComponentState< + string | null +>({ + key: 'side-panel/viewable-front-component-id', + defaultValue: null, + componentInstanceContext: SidePanelPageComponentInstanceContext, +}); diff --git a/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentRecordContextComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/front-component/states/viewableFrontComponentRecordContextComponentState.ts similarity index 57% rename from packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentRecordContextComponentState.ts rename to packages/twenty-front/src/modules/side-panel/pages/front-component/states/viewableFrontComponentRecordContextComponentState.ts index f3b336c0da..e57a0775b1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentRecordContextComponentState.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/front-component/states/viewableFrontComponentRecordContextComponentState.ts @@ -1,4 +1,4 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; type FrontComponentRecordContext = { @@ -8,7 +8,7 @@ type FrontComponentRecordContext = { export const viewableFrontComponentRecordContextComponentState = createAtomComponentState({ - key: 'command-menu/viewable-front-component-record-context', + key: 'side-panel/viewable-front-component-record-context', defaultValue: null, - componentInstanceContext: CommandMenuPageComponentInstanceContext, + componentInstanceContext: SidePanelPageComponentInstanceContext, }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadIntermediaryMessages.tsx b/packages/twenty-front/src/modules/side-panel/pages/message-thread/components/SidePanelMessageThreadIntermediaryMessages.tsx similarity index 95% rename from packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadIntermediaryMessages.tsx rename to packages/twenty-front/src/modules/side-panel/pages/message-thread/components/SidePanelMessageThreadIntermediaryMessages.tsx index e22a1ba0d2..0a12c7769a 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadIntermediaryMessages.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/message-thread/components/SidePanelMessageThreadIntermediaryMessages.tsx @@ -12,7 +12,7 @@ const StyledButtonContainer = styled.div` padding: 16px 24px; `; -export const CommandMenuMessageThreadIntermediaryMessages = ({ +export const SidePanelMessageThreadIntermediaryMessages = ({ messages, }: { messages: EmailThreadMessageWithSender[]; diff --git a/packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/message-thread/components/SidePanelMessageThreadPage.tsx similarity index 90% rename from packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/message-thread/components/SidePanelMessageThreadPage.tsx index df2784749b..de158b74cd 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/message-thread/components/SidePanelMessageThreadPage.tsx @@ -5,9 +5,9 @@ import { CustomResolverFetchMoreLoader } from '@/activities/components/CustomRes import { EmailLoader } from '@/activities/emails/components/EmailLoader'; import { EmailThreadHeader } from '@/activities/emails/components/EmailThreadHeader'; import { EmailThreadMessage } from '@/activities/emails/components/EmailThreadMessage'; -import { CommandMenuMessageThreadIntermediaryMessages } from '@/command-menu/pages/message-thread/components/CommandMenuMessageThreadIntermediaryMessages'; -import { useEmailThreadInCommandMenu } from '@/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu'; -import { messageThreadComponentState } from '@/command-menu/pages/message-thread/states/messageThreadComponentState'; +import { SidePanelMessageThreadIntermediaryMessages } from '@/side-panel/pages/message-thread/components/SidePanelMessageThreadIntermediaryMessages'; +import { useEmailThreadInSidePanel } from '@/side-panel/pages/message-thread/hooks/useEmailThreadInSidePanel'; +import { messageThreadComponentState } from '@/side-panel/pages/message-thread/states/messageThreadComponentState'; import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { t } from '@lingui/core/macro'; import { ConnectedAccountProvider } from 'twenty-shared/types'; @@ -47,7 +47,7 @@ const ALLOWED_REPLY_PROVIDERS = [ ConnectedAccountProvider.IMAP_SMTP_CALDAV, ]; -export const CommandMenuMessageThreadPage = () => { +export const SidePanelMessageThreadPage = () => { const setMessageThread = useSetAtomComponentState( messageThreadComponentState, ); @@ -63,7 +63,7 @@ export const CommandMenuMessageThreadPage = () => { connectedAccountProvider, lastMessageExternalId, connectedAccountConnectionParameters, - } = useEmailThreadInCommandMenu(); + } = useEmailThreadInSidePanel(); useEffect(() => { if (!messages[0]?.messageThread) { @@ -148,7 +148,7 @@ export const CommandMenuMessageThreadPage = () => { sentAt={message.receivedAt} /> ))} - { return ( - {children} - + ); }; -describe('useEmailThreadInCommandMenu', () => { +describe('useEmailThreadInSidePanel', () => { it('should return correct values', async () => { const mockMessages = [ { @@ -241,7 +241,7 @@ describe('useEmailThreadInCommandMenu', () => { }, ]; - const { result } = renderHook(() => useEmailThreadInCommandMenu(), { + const { result } = renderHook(() => useEmailThreadInSidePanel(), { wrapper: Wrapper, }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu.ts b/packages/twenty-front/src/modules/side-panel/pages/message-thread/hooks/useEmailThreadInSidePanel.ts similarity index 97% rename from packages/twenty-front/src/modules/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu.ts rename to packages/twenty-front/src/modules/side-panel/pages/message-thread/hooks/useEmailThreadInSidePanel.ts index c50784476d..49c477bb23 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/message-thread/hooks/useEmailThreadInSidePanel.ts @@ -8,7 +8,7 @@ import { type MessageChannel } from '@/accounts/types/MessageChannel'; import { type EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant'; import { type EmailThreadMessageWithSender } from '@/activities/emails/types/EmailThreadMessageWithSender'; import { type MessageChannelMessageAssociation } from '@/activities/emails/types/MessageChannelMessageAssociation'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; import { CoreObjectNameSingular, MessageParticipantRole, @@ -20,7 +20,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use import { isDefined } from 'twenty-shared/utils'; // to improve - https://github.com/twentyhq/twenty/issues/12190 -export const useEmailThreadInCommandMenu = () => { +export const useEmailThreadInSidePanel = () => { const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/message-thread/states/messageThreadComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/message-thread/states/messageThreadComponentState.ts similarity index 63% rename from packages/twenty-front/src/modules/command-menu/pages/message-thread/states/messageThreadComponentState.ts rename to packages/twenty-front/src/modules/side-panel/pages/message-thread/states/messageThreadComponentState.ts index f8e4ff44ef..fb96c149f1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/message-thread/states/messageThreadComponentState.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/message-thread/states/messageThreadComponentState.ts @@ -1,10 +1,10 @@ import { type MessageThread } from '@/activities/emails/types/MessageThread'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const messageThreadComponentState = createAtomComponentState({ key: 'messageThreadComponentState', defaultValue: null, - componentInstanceContext: CommandMenuPageComponentInstanceContext, + componentInstanceContext: SidePanelPageComponentInstanceContext, }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditColorOption.tsx similarity index 96% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditColorOption.tsx index b3ad48caa6..3d969e273a 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditColorOption.tsx @@ -24,15 +24,15 @@ const StyledMenuStyleText = styled.span` font-size: 13px; `; -type CommandMenuEditColorOptionProps = { +type SidePanelEditColorOptionProps = { navigationMenuItemId: string; color: ThemeColor; }; -export const CommandMenuEditColorOption = ({ +export const SidePanelEditColorOption = ({ navigationMenuItemId, color, -}: CommandMenuEditColorOptionProps) => { +}: SidePanelEditColorOptionProps) => { const { t } = useLingui(); const { updateNavigationMenuItemInDraft } = useUpdateNavigationMenuItemInDraft(); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditFolderPickerSubView.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditFolderPickerSubView.tsx similarity index 81% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditFolderPickerSubView.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditFolderPickerSubView.tsx index a52113c43e..060b5f583b 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditFolderPickerSubView.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditFolderPickerSubView.tsx @@ -2,24 +2,24 @@ import { useLingui } from '@lingui/react/macro'; import { useState } from 'react'; import { useIcons } from 'twenty-ui/display'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { CommandMenuSubViewWithSearch } from '@/command-menu/components/CommandMenuSubViewWithSearch'; -import { useFolderPickerSelectionData } from '@/command-menu/pages/navigation-menu-item/hooks/useFolderPickerSelectionData'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { SidePanelSubViewWithSearch } from '@/side-panel/components/SidePanelSubViewWithSearch'; +import { useFolderPickerSelectionData } from '@/side-panel/pages/navigation-menu-item/hooks/useFolderPickerSelectionData'; import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/NavigationMenuItemStyleIcon'; import { FOLDER_ICON_DEFAULT } from '@/navigation-menu-item/constants/FolderIconDefault'; import { DEFAULT_NAVIGATION_MENU_ITEM_COLOR_FOLDER } from '@/navigation-menu-item/constants/NavigationMenuItemDefaultColorFolder'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { filterBySearchQuery } from '~/utils/filterBySearchQuery'; -type CommandMenuEditFolderPickerSubViewProps = { +type SidePanelEditFolderPickerSubViewProps = { onBack: () => void; }; -export const CommandMenuEditFolderPickerSubView = ({ +export const SidePanelEditFolderPickerSubView = ({ onBack, -}: CommandMenuEditFolderPickerSubViewProps) => { +}: SidePanelEditFolderPickerSubViewProps) => { const { t } = useLingui(); const { getIcon } = useIcons(); const [searchValue, setSearchValue] = useState(''); @@ -42,20 +42,20 @@ export const CommandMenuEditFolderPickerSubView = ({ : t`No folders available`; return ( - - - + {includeNoFolderOption && ( ); })} - - - + + + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditLinkItemView.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditLinkItemView.tsx similarity index 61% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditLinkItemView.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditLinkItemView.tsx index 8508bae905..a25484ca3b 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditLinkItemView.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditLinkItemView.tsx @@ -3,26 +3,26 @@ import { isNonEmptyString } from '@sniptt/guards'; import { useState } from 'react'; import { getAbsoluteUrl } from 'twenty-shared/utils'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { CommandMenuEditColorOption } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { SidePanelEditColorOption } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditColorOption'; import { type OrganizeActionsProps, - CommandMenuEditOrganizeActions, -} from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditOrganizeActions'; -import { CommandMenuEditOwnerSection } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditOwnerSection'; -import { getOrganizeActionsSelectableItemIds } from '@/command-menu/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds'; + SidePanelEditOrganizeActions, +} from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditOrganizeActions'; +import { SidePanelEditOwnerSection } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditOwnerSection'; +import { getOrganizeActionsSelectableItemIds } from '@/side-panel/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds'; import { type ProcessedNavigationMenuItem } from '@/navigation-menu-item/types/processed-navigation-menu-item'; import { parseThemeColor } from '@/navigation-menu-item/utils/parseThemeColor'; import { TextInput } from '@/ui/input/components/TextInput'; -type CommandMenuEditLinkItemViewProps = OrganizeActionsProps & { +type SidePanelEditLinkItemViewProps = OrganizeActionsProps & { selectedItem: ProcessedNavigationMenuItem; onUpdateLink: (linkId: string, link: string) => void; onOpenFolderPicker: () => void; }; -export const CommandMenuEditLinkItemView = ({ +export const SidePanelEditLinkItemView = ({ selectedItem, onUpdateLink, canMoveUp, @@ -33,16 +33,16 @@ export const CommandMenuEditLinkItemView = ({ onRemove, onAddBefore, onAddAfter, -}: CommandMenuEditLinkItemViewProps) => { +}: SidePanelEditLinkItemViewProps) => { const { t } = useLingui(); const [urlEditInput, setUrlEditInput] = useState(''); const selectableItemIds = getOrganizeActionsSelectableItemIds(true); return ( - - - + + @@ -59,8 +59,8 @@ export const CommandMenuEditLinkItemView = ({ } }} /> - - + - - + + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditObjectViewBase.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditObjectViewBase.tsx similarity index 55% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditObjectViewBase.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditObjectViewBase.tsx index cf73f4c90a..d4902dcca6 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditObjectViewBase.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditObjectViewBase.tsx @@ -1,21 +1,21 @@ -import { CommandGroup } from '@/command-menu/components/CommandGroup'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { CommandMenuEditColorOption } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { SidePanelEditColorOption } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditColorOption'; import { type OrganizeActionsProps, - CommandMenuEditOrganizeActions, -} from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditOrganizeActions'; -import { getOrganizeActionsSelectableItemIds } from '@/command-menu/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds'; + SidePanelEditOrganizeActions, +} from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditOrganizeActions'; +import { getOrganizeActionsSelectableItemIds } from '@/side-panel/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds'; import { useSelectedNavigationMenuItemEditItem } from '@/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem'; import { parseThemeColor } from '@/navigation-menu-item/utils/parseThemeColor'; import { useLingui } from '@lingui/react/macro'; -type CommandMenuEditObjectViewBaseProps = OrganizeActionsProps & { +type SidePanelEditObjectViewBaseProps = OrganizeActionsProps & { onOpenFolderPicker: () => void; showColorOption?: boolean; }; -export const CommandMenuEditObjectViewBase = ({ +export const SidePanelEditObjectViewBase = ({ onOpenFolderPicker, canMoveUp, canMoveDown, @@ -25,22 +25,22 @@ export const CommandMenuEditObjectViewBase = ({ onAddBefore, onAddAfter, showColorOption = false, -}: CommandMenuEditObjectViewBaseProps) => { +}: SidePanelEditObjectViewBaseProps) => { const { t } = useLingui(); const { selectedItem } = useSelectedNavigationMenuItemEditItem(); const selectableItemIds = getOrganizeActionsSelectableItemIds(true); return ( - + {showColorOption && selectedItem && ( - - + - + )} - - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditOrganizeActions.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditOrganizeActions.tsx similarity index 69% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditOrganizeActions.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditOrganizeActions.tsx index 526eba79f9..c59a578ade 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditOrganizeActions.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditOrganizeActions.tsx @@ -8,9 +8,9 @@ import { IconTrash, } from 'twenty-ui/display'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { CommandMenuNavigationItemActions } from '@/command-menu/pages/navigation-menu-item/command-menu-navigation-item-actions'; +import { SidePanelNavigationItemActions } from '@/side-panel/pages/navigation-menu-item/side-panel-navigation-item-actions'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; export type OrganizeActionsProps = { @@ -23,13 +23,13 @@ export type OrganizeActionsProps = { onAddAfter?: () => void; }; -type CommandMenuEditOrganizeActionsProps = OrganizeActionsProps & { +type SidePanelEditOrganizeActionsProps = OrganizeActionsProps & { showMoveToFolder?: boolean; onMoveToFolder?: () => void; moveToFolderHasSubMenu?: boolean; }; -export const CommandMenuEditOrganizeActions = ({ +export const SidePanelEditOrganizeActions = ({ canMoveUp, canMoveDown, onMoveUp, @@ -40,44 +40,44 @@ export const CommandMenuEditOrganizeActions = ({ showMoveToFolder = false, onMoveToFolder, moveToFolderHasSubMenu = false, -}: CommandMenuEditOrganizeActionsProps) => { +}: SidePanelEditOrganizeActionsProps) => { const { t } = useLingui(); return ( - + {showMoveToFolder && onMoveToFolder && ( @@ -85,41 +85,41 @@ export const CommandMenuEditOrganizeActions = ({ )} {onAddBefore && ( )} {onAddAfter && ( )} - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditOwnerSection.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditOwnerSection.tsx similarity index 86% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditOwnerSection.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditOwnerSection.tsx index f5552237cd..036f9e1574 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuEditOwnerSection.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelEditOwnerSection.tsx @@ -2,20 +2,20 @@ import { useLingui } from '@lingui/react/macro'; import { isDefined } from 'twenty-shared/utils'; import { IconApps } from 'twenty-ui/display'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; import { useDraftNavigationMenuItems } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItems'; import { useSelectedNavigationMenuItemEditItem } from '@/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { useFindOneApplicationQuery } from '~/generated-metadata/graphql'; -type CommandMenuEditOwnerSectionProps = { +type SidePanelEditOwnerSectionProps = { applicationId?: string | null; }; -export const CommandMenuEditOwnerSection = ({ +export const SidePanelEditOwnerSection = ({ applicationId: applicationIdProp, -}: CommandMenuEditOwnerSectionProps) => { +}: SidePanelEditOwnerSectionProps) => { const { t } = useLingui(); const { selectedItem } = useSelectedNavigationMenuItemEditItem(); @@ -40,7 +40,7 @@ export const CommandMenuEditOwnerSection = ({ } return ( - + {}}> - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNavigationMenuItemEditPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNavigationMenuItemEditPage.tsx similarity index 75% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNavigationMenuItemEditPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNavigationMenuItemEditPage.tsx index c368891271..7a10762183 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNavigationMenuItemEditPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNavigationMenuItemEditPage.tsx @@ -1,14 +1,14 @@ -import { CommandGroup } from '@/command-menu/components/CommandGroup'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { CommandMenuEditColorOption } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditColorOption'; -import { CommandMenuEditFolderPickerSubView } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditFolderPickerSubView'; -import { CommandMenuEditLinkItemView } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditLinkItemView'; -import { CommandMenuEditObjectViewBase } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditObjectViewBase'; -import { CommandMenuEditOrganizeActions } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditOrganizeActions'; -import { CommandMenuEditOwnerSection } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditOwnerSection'; -import { useNavigationMenuItemEditOrganizeActions } from '@/command-menu/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions'; -import { getOrganizeActionsSelectableItemIds } from '@/command-menu/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { SidePanelEditColorOption } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditColorOption'; +import { SidePanelEditFolderPickerSubView } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditFolderPickerSubView'; +import { SidePanelEditLinkItemView } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditLinkItemView'; +import { SidePanelEditObjectViewBase } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditObjectViewBase'; +import { SidePanelEditOrganizeActions } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditOrganizeActions'; +import { SidePanelEditOwnerSection } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditOwnerSection'; +import { useNavigationMenuItemEditOrganizeActions } from '@/side-panel/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions'; +import { getOrganizeActionsSelectableItemIds } from '@/side-panel/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { useNavigationMenuItemsDraftState } from '@/navigation-menu-item/hooks/useNavigationMenuItemsDraftState'; import { useOpenAddItemToFolderPage } from '@/navigation-menu-item/hooks/useOpenAddItemToFolderPage'; @@ -30,16 +30,16 @@ import { themeCssVariables } from 'twenty-ui/theme-constants'; const ADD_ITEM_TO_FOLDER_ACTION_ID = 'add-item-to-folder'; -const StyledCommandMenuPlaceholder = styled.p` +const StyledSidePanelPlaceholder = styled.p` color: ${themeCssVariables.font.color.tertiary}; font-size: ${themeCssVariables.font.size.sm}; `; -const StyledCommandMenuPageContainer = styled.div` +const StyledSidePanelPageContainer = styled.div` padding: ${themeCssVariables.spacing[3]}; `; -export const CommandMenuNavigationMenuItemEditPage = () => { +export const SidePanelNavigationMenuItemEditPage = () => { const { t } = useLingui(); const selectedNavigationMenuItemInEditMode = useAtomStateValue( @@ -87,17 +87,17 @@ export const CommandMenuNavigationMenuItemEditPage = () => { if (!selectedNavigationMenuItemInEditMode || !selectedItemLabel) { return ( - - + + {t`Select a navigation item to edit`} - - + + ); } if (isFolderPickerOpen) { return ( - setIsFolderPickerOpen(false)} /> ); @@ -107,7 +107,7 @@ export const CommandMenuNavigationMenuItemEditPage = () => { case NavigationMenuItemType.VIEW: if (!selectedItemObjectMetadata) return null; return ( - { selectedItem.itemType === NavigationMenuItemType.LINK ) { return ( - updateLinkInDraft(linkId, { link })} @@ -147,7 +147,7 @@ export const CommandMenuNavigationMenuItemEditPage = () => { return null; case NavigationMenuItemType.FOLDER: return ( - { ]} > {selectedItem && ( - + { hasSubMenu /> - - + )} - { onAddBefore={onAddBefore} onAddAfter={onAddAfter} /> - - + + ); default: return ( - {selectedItem && ( - - + - + )} - { showMoveToFolder onMoveToFolder={openFolderPicker} /> - + ); } }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemMainMenu.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemMainMenu.tsx similarity index 70% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemMainMenu.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemMainMenu.tsx index ed3e78c4e4..cfd9900411 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemMainMenu.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemMainMenu.tsx @@ -7,47 +7,47 @@ import { IconTable, } from 'twenty-ui/display'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; -import { CommandMenuAddToNavDraggablePlaceholder } from '@/command-menu/components/CommandMenuAddToNavDraggablePlaceholder'; -import { CommandMenuAddToNavDroppable } from '@/command-menu/components/CommandMenuAddToNavDroppable'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; +import { SidePanelAddToNavigationDraggablePlaceholder } from '@/side-panel/components/SidePanelAddToNavigationDraggablePlaceholder'; +import { SidePanelAddToNavigationDroppable } from '@/side-panel/components/SidePanelAddToNavigationDroppable'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { CommandMenuItemWithAddToNavigationDrag } from '@/command-menu/components/CommandMenuItemWithAddToNavigationDrag'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { useAddFolderToNavigationMenu } from '@/command-menu/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu'; -import { useAddLinkToNavigationMenu } from '@/command-menu/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu'; +import { SidePanelItemWithAddToNavigationDrag } from '@/side-panel/components/SidePanelItemWithAddToNavigationDrag'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { useAddFolderToNavigationMenu } from '@/side-panel/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu'; +import { useAddLinkToNavigationMenu } from '@/side-panel/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu'; import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/NavigationMenuItemStyleIcon'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { useContext } from 'react'; import { ThemeContext } from 'twenty-ui/theme-constants'; -type CommandMenuNewSidebarItemMainMenuProps = { +type SidePanelNewSidebarItemMainMenuProps = { onSelectObject: () => void; onSelectView: () => void; onSelectRecord: () => void; }; -export const CommandMenuNewSidebarItemMainMenu = ({ +export const SidePanelNewSidebarItemMainMenu = ({ onSelectObject, onSelectView, onSelectRecord, -}: CommandMenuNewSidebarItemMainMenuProps) => { - const { theme } = useContext(ThemeContext); +}: SidePanelNewSidebarItemMainMenuProps) => { const { t } = useLingui(); + const { theme } = useContext(ThemeContext); const { handleAddFolder } = useAddFolderToNavigationMenu(); const { handleAddLink } = useAddLinkToNavigationMenu(); return ( - + {({ innerRef, droppableProps, placeholder }) => ( - {/* eslint-disable-next-line react/jsx-props-no-spreading */}
- - + + ( @@ -62,8 +62,8 @@ export const CommandMenuNewSidebarItemMainMenu = ({ onClick={onSelectObject} /> - - + + ( @@ -78,8 +78,8 @@ export const CommandMenuNewSidebarItemMainMenu = ({ onClick={onSelectView} /> - - + + ( @@ -95,11 +95,11 @@ export const CommandMenuNewSidebarItemMainMenu = ({ onClick={onSelectRecord} /> - - - + + + - - - + {placeholder}
-
+ )} -
+ ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemObjectFlow.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemObjectFlow.tsx similarity index 82% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemObjectFlow.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemObjectFlow.tsx index 6a63f23191..abd06beade 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemObjectFlow.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemObjectFlow.tsx @@ -1,10 +1,10 @@ import { useLingui } from '@lingui/react/macro'; import { useState } from 'react'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { CommandMenuObjectPickerSubView } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuObjectPickerSubView'; -import { CommandMenuSystemObjectPickerSubView } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuSystemObjectPickerSubView'; -import { getAvailableObjectMetadataForNewSidebarItem } from '@/command-menu/pages/navigation-menu-item/utils/getAvailableObjectMetadataForNewSidebarItem'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { SidePanelObjectPickerSubView } from '@/side-panel/pages/navigation-menu-item/components/SidePanelObjectPickerSubView'; +import { SidePanelSystemObjectPickerSubView } from '@/side-panel/pages/navigation-menu-item/components/SidePanelSystemObjectPickerSubView'; +import { getAvailableObjectMetadataForNewSidebarItem } from '@/side-panel/pages/navigation-menu-item/utils/getAvailableObjectMetadataForNewSidebarItem'; import { useAddObjectToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddObjectToNavigationMenuDraft'; import { getStandardObjectIconColor } from '@/navigation-menu-item/utils/getStandardObjectIconColor'; import { useDraftNavigationMenuItems } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItems'; @@ -17,15 +17,15 @@ import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadat import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { ViewKey } from '@/views/types/ViewKey'; -type CommandMenuNewSidebarItemObjectFlowProps = { +type SidePanelNewSidebarItemObjectFlowProps = { onBack: () => void; }; -export const CommandMenuNewSidebarItemObjectFlow = ({ +export const SidePanelNewSidebarItemObjectFlow = ({ onBack, -}: CommandMenuNewSidebarItemObjectFlowProps) => { +}: SidePanelNewSidebarItemObjectFlowProps) => { const { t } = useLingui(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const [objectSearchInput, setObjectSearchInput] = useState(''); const [systemObjectSearchInput, setSystemObjectSearchInput] = useState(''); const [isInSystemPicker, setIsInSystemPicker] = useState(false); @@ -77,7 +77,7 @@ export const CommandMenuNewSidebarItemObjectFlow = ({ getStandardObjectIconColor(objectMetadataItem.nameSingular), ); setAddMenuItemInsertionContext(null); - closeCommandMenu(); + closeSidePanelMenu(); }; const handleBackToObjectList = () => { @@ -87,7 +87,7 @@ export const CommandMenuNewSidebarItemObjectFlow = ({ if (isInSystemPicker) { return ( - { + const [selectedOption, setSelectedOption] = useState(null); + + const handleBackToMain = () => { + setSelectedOption(null); + }; + + switch (selectedOption) { + case 'view': + return ; + case 'object': + return ; + case 'record': + return ; + default: + return ( + setSelectedOption('record')} + onSelectObject={() => setSelectedOption('object')} + onSelectView={() => setSelectedOption('view')} + /> + ); + } +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemRecordItem.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemRecordItem.tsx similarity index 87% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemRecordItem.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemRecordItem.tsx index dd1aba6033..5385e38996 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemRecordItem.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemRecordItem.tsx @@ -1,7 +1,7 @@ import { Avatar } from 'twenty-ui/display'; -import { CommandMenuItemWithAddToNavigationDrag } from '@/command-menu/components/CommandMenuItemWithAddToNavigationDrag'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { SidePanelItemWithAddToNavigationDrag } from '@/side-panel/components/SidePanelItemWithAddToNavigationDrag'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { useDraftNavigationMenuItems } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItems'; import { useAddRecordToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddRecordToNavigationMenuDraft'; @@ -20,16 +20,16 @@ type SearchRecord = { imageUrl?: string | null; }; -type CommandMenuNewSidebarItemRecordItemProps = { +type SidePanelNewSidebarItemRecordItemProps = { record: SearchRecord; dragIndex?: number; }; -export const CommandMenuNewSidebarItemRecordItem = ({ +export const SidePanelNewSidebarItemRecordItem = ({ record, dragIndex, -}: CommandMenuNewSidebarItemRecordItemProps) => { - const { closeCommandMenu } = useCommandMenu(); +}: SidePanelNewSidebarItemRecordItemProps) => { + const { closeSidePanelMenu } = useSidePanelMenu(); const { addRecordToDraft } = useAddRecordToNavigationMenuDraft(); const { currentDraft } = useDraftNavigationMenuItems(); const addMenuItemInsertionContext = useAtomStateValue( @@ -64,12 +64,12 @@ export const CommandMenuNewSidebarItemRecordItem = ({ addMenuItemInsertionContext?.targetIndex, ); setAddMenuItemInsertionContext(null); - closeCommandMenu(); + closeSidePanelMenu(); }; return ( - void; }; -export const CommandMenuNewSidebarItemRecordSubView = ({ +export const SidePanelNewSidebarItemRecordSubView = ({ onBack, -}: CommandMenuNewSidebarItemRecordSubViewProps) => { +}: SidePanelNewSidebarItemRecordSubViewProps) => { const { t } = useLingui(); const { currentDraft } = useDraftNavigationMenuItems(); const { objectMetadataItems } = useObjectMetadataItems(); @@ -82,16 +82,16 @@ export const CommandMenuNewSidebarItemRecordSubView = ({ : t`Type to search records`; return ( - - + {({ innerRef, droppableProps, placeholder }) => ( - {/* eslint-disable-next-line react/jsx-props-no-spreading */}
- + {availableSearchRecords.map((record, index) => ( - ))} - + {placeholder}
-
+ )} -
-
+ + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewFlow.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewFlow.tsx similarity index 78% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewFlow.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewFlow.tsx index 9e9547eb2e..bd6f2ce35d 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewFlow.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewFlow.tsx @@ -1,23 +1,23 @@ import { useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; -import { CommandMenuNewSidebarItemViewObjectPickerSubView } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewObjectPickerSubView'; -import { CommandMenuNewSidebarItemViewPickerSubView } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewPickerSubView'; -import { CommandMenuNewSidebarItemViewSystemSubView } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewSystemSubView'; -import { getAvailableObjectMetadataForNewSidebarItem } from '@/command-menu/pages/navigation-menu-item/utils/getAvailableObjectMetadataForNewSidebarItem'; +import { SidePanelNewSidebarItemViewObjectPickerSubView } from '@/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewObjectPickerSubView'; +import { SidePanelNewSidebarItemViewPickerSubView } from '@/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewPickerSubView'; +import { SidePanelNewSidebarItemViewSystemSubView } from '@/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewSystemSubView'; +import { getAvailableObjectMetadataForNewSidebarItem } from '@/side-panel/pages/navigation-menu-item/utils/getAvailableObjectMetadataForNewSidebarItem'; import { useDraftNavigationMenuItems } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItems'; import { useNavigationMenuObjectMetadataFromDraft } from '@/navigation-menu-item/hooks/useNavigationMenuObjectMetadataFromDraft'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { ViewKey } from '@/views/types/ViewKey'; -type CommandMenuNewSidebarItemViewFlowProps = { +type SidePanelNewSidebarItemViewFlowProps = { onBack: () => void; }; -export const CommandMenuNewSidebarItemViewFlow = ({ +export const SidePanelNewSidebarItemViewFlow = ({ onBack, -}: CommandMenuNewSidebarItemViewFlowProps) => { +}: SidePanelNewSidebarItemViewFlowProps) => { const [selectedObjectMetadataIdForView, setSelectedObjectMetadataIdForView] = useState(null); const [objectSearchInput, setObjectSearchInput] = useState(''); @@ -76,7 +76,7 @@ export const CommandMenuNewSidebarItemViewFlow = ({ if (isDefined(selectedObjectMetadataIdForView) && !isInSystemPicker) { return ( - @@ -85,7 +85,7 @@ export const CommandMenuNewSidebarItemViewFlow = ({ if (isInSystemPicker) { return ( - void; @@ -21,7 +21,7 @@ type CommandMenuNewSidebarItemViewObjectPickerSubViewProps = { showSystemObjectsOption?: boolean; }; -export const CommandMenuNewSidebarItemViewObjectPickerSubView = ({ +export const SidePanelNewSidebarItemViewObjectPickerSubView = ({ objects, searchValue, onSearchChange, @@ -29,11 +29,11 @@ export const CommandMenuNewSidebarItemViewObjectPickerSubView = ({ onOpenSystemPicker, onSelectObject, showSystemObjectsOption = true, -}: CommandMenuNewSidebarItemViewObjectPickerSubViewProps) => { +}: SidePanelNewSidebarItemViewObjectPickerSubViewProps) => { const { t } = useLingui(); const { getIcon } = useIcons(); const { filteredItems, selectableItemIds, isEmpty, hasSearchQuery } = - useFilteredPickerItems({ + useSidePanelFilteredPickerItems({ items: objects, searchQuery: searchValue, getSearchableValues: (item) => [item.labelPlural], @@ -44,20 +44,20 @@ export const CommandMenuNewSidebarItemViewObjectPickerSubView = ({ : t`No objects with views found`; return ( - - - + {filteredItems.map((objectMetadataItem) => ( )} - - - + + + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewPickerSubView.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewPickerSubView.tsx similarity index 80% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewPickerSubView.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewPickerSubView.tsx index 9abb0bf0a2..f93fa065df 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewPickerSubView.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewPickerSubView.tsx @@ -1,10 +1,10 @@ -import { CommandGroup } from '@/command-menu/components/CommandGroup'; -import { CommandMenuAddToNavDroppable } from '@/command-menu/components/CommandMenuAddToNavDroppable'; -import { CommandMenuItemWithAddToNavigationDrag } from '@/command-menu/components/CommandMenuItemWithAddToNavigationDrag'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { CommandMenuSubViewWithSearch } from '@/command-menu/components/CommandMenuSubViewWithSearch'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useFilteredPickerItems } from '@/command-menu/hooks/useFilteredPickerItems'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; +import { SidePanelAddToNavigationDroppable } from '@/side-panel/components/SidePanelAddToNavigationDroppable'; +import { SidePanelItemWithAddToNavigationDrag } from '@/side-panel/components/SidePanelItemWithAddToNavigationDrag'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { SidePanelSubViewWithSearch } from '@/side-panel/components/SidePanelSubViewWithSearch'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useSidePanelFilteredPickerItems } from '@/side-panel/hooks/useSidePanelFilteredPickerItems'; import { ObjectIconWithViewOverlay } from '@/navigation-menu-item/components/ObjectIconWithViewOverlay'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { useAddViewToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddViewToNavigationMenuDraft'; @@ -23,19 +23,19 @@ import { useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; -type CommandMenuNewSidebarItemViewPickerSubViewProps = { +type SidePanelNewSidebarItemViewPickerSubViewProps = { selectedObjectMetadataIdForView: string; onBack: () => void; }; -export const CommandMenuNewSidebarItemViewPickerSubView = ({ +export const SidePanelNewSidebarItemViewPickerSubView = ({ selectedObjectMetadataIdForView, onBack, -}: CommandMenuNewSidebarItemViewPickerSubViewProps) => { +}: SidePanelNewSidebarItemViewPickerSubViewProps) => { const { t } = useLingui(); const { getIcon } = useIcons(); const [searchValue, setSearchValue] = useState(''); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const { addViewToDraft } = useAddViewToNavigationMenuDraft(); const { currentDraft } = useDraftNavigationMenuItems(); const addMenuItemInsertionContext = useAtomStateValue( @@ -66,7 +66,7 @@ export const CommandMenuNewSidebarItemViewPickerSubView = ({ selectableItemIds, isEmpty, hasSearchQuery, - } = useFilteredPickerItems({ + } = useSidePanelFilteredPickerItems({ items: viewsForSelectedObject, searchQuery: searchValue, getSearchableValues: (view) => [view.name], @@ -86,20 +86,20 @@ export const CommandMenuNewSidebarItemViewPickerSubView = ({ : undefined, ); setAddMenuItemInsertionContext(null); - closeCommandMenu(); + closeSidePanelMenu(); }; return ( - - + {({ innerRef, droppableProps, placeholder }) => ( - {/* eslint-disable-next-line react/jsx-props-no-spreading */}
- + {filteredViews.map((view, index) => ( handleSelectView(view)} > - ))} - + {placeholder}
-
+ )} -
-
+ + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewSystemSubView.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewSystemSubView.tsx similarity index 76% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewSystemSubView.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewSystemSubView.tsx index 1c81adacfb..dc211d73ed 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewSystemSubView.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelNewSidebarItemViewSystemSubView.tsx @@ -1,17 +1,17 @@ import { useLingui } from '@lingui/react/macro'; import { useIcons } from 'twenty-ui/display'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { CommandMenuSubViewWithSearch } from '@/command-menu/components/CommandMenuSubViewWithSearch'; -import { useFilteredPickerItems } from '@/command-menu/hooks/useFilteredPickerItems'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { SidePanelSubViewWithSearch } from '@/side-panel/components/SidePanelSubViewWithSearch'; +import { useSidePanelFilteredPickerItems } from '@/side-panel/hooks/useSidePanelFilteredPickerItems'; import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/NavigationMenuItemStyleIcon'; import { getStandardObjectIconColor } from '@/navigation-menu-item/utils/getStandardObjectIconColor'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; -type CommandMenuNewSidebarItemViewSystemSubViewProps = { +type SidePanelNewSidebarItemViewSystemSubViewProps = { systemObjects: ObjectMetadataItem[]; searchValue: string; onSearchChange: (value: string) => void; @@ -19,13 +19,13 @@ type CommandMenuNewSidebarItemViewSystemSubViewProps = { onSelectObject: (objectMetadataItem: ObjectMetadataItem) => void; }; -export const CommandMenuNewSidebarItemViewSystemSubView = ({ +export const SidePanelNewSidebarItemViewSystemSubView = ({ systemObjects, searchValue, onSearchChange, onBack, onSelectObject, -}: CommandMenuNewSidebarItemViewSystemSubViewProps) => { +}: SidePanelNewSidebarItemViewSystemSubViewProps) => { const { t } = useLingui(); const { getIcon } = useIcons(); const { @@ -33,7 +33,7 @@ export const CommandMenuNewSidebarItemViewSystemSubView = ({ selectableItemIds, isEmpty, hasSearchQuery, - } = useFilteredPickerItems({ + } = useSidePanelFilteredPickerItems({ items: systemObjects, searchQuery: searchValue, getSearchableValues: (item) => [item.labelPlural], @@ -43,20 +43,20 @@ export const CommandMenuNewSidebarItemViewSystemSubView = ({ : t`No system objects with views found`; return ( - - - + {filteredSystemObjectMetadataItems.map((objectMetadataItem) => ( ))} - - - + + + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuObjectMenuItem.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelObjectMenuItem.tsx similarity index 91% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuObjectMenuItem.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelObjectMenuItem.tsx index ea7465f5ad..63bc9fa79e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuObjectMenuItem.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelObjectMenuItem.tsx @@ -3,7 +3,7 @@ import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { CommandMenuItemWithAddToNavigationDrag } from '@/command-menu/components/CommandMenuItemWithAddToNavigationDrag'; +import { SidePanelItemWithAddToNavigationDrag } from '@/side-panel/components/SidePanelItemWithAddToNavigationDrag'; import { NavigationMenuItemStyleIcon } from '@/navigation-menu-item/components/NavigationMenuItemStyleIcon'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { useDraftNavigationMenuItems } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItems'; @@ -14,7 +14,7 @@ import { SelectableListItem } from '@/ui/layout/selectable-list/components/Selec import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector'; -type CommandMenuObjectMenuItemProps = { +type SidePanelObjectMenuItemProps = { objectMetadataItem: ObjectMetadataItem; onSelect: ( objectMetadataItem: ObjectMetadataItem, @@ -24,12 +24,12 @@ type CommandMenuObjectMenuItemProps = { dragIndex?: number; }; -export const CommandMenuObjectMenuItem = ({ +export const SidePanelObjectMenuItem = ({ objectMetadataItem, onSelect, variant, dragIndex, -}: CommandMenuObjectMenuItemProps) => { +}: SidePanelObjectMenuItemProps) => { const { t } = useLingui(); const { getIcon } = useIcons(); const { currentDraft } = useDraftNavigationMenuItems(); @@ -60,7 +60,7 @@ export const CommandMenuObjectMenuItem = ({ return ( {variant === 'add' && !isDisabled ? ( - void; @@ -20,14 +20,14 @@ type CommandMenuObjectPickerItemProps = { dragIndex?: number; }; -export const CommandMenuObjectPickerItem = ({ +export const SidePanelObjectPickerItem = ({ objectMetadataItem, isViewItem, onSelectObjectForViewEdit, onChangeObject, objectMenuItemVariant = 'edit', dragIndex, -}: CommandMenuObjectPickerItemProps) => { +}: SidePanelObjectPickerItemProps) => { const { getIcon } = useIcons(); if (isViewItem && isDefined(onSelectObjectForViewEdit)) { @@ -54,7 +54,7 @@ export const CommandMenuObjectPickerItem = ({ } return ( - void; @@ -29,7 +29,7 @@ type CommandMenuObjectPickerSubViewProps = { emptyNoResultsText?: string; }; -export const CommandMenuObjectPickerSubView = ({ +export const SidePanelObjectPickerSubView = ({ objects, searchValue, onSearchChange, @@ -40,10 +40,10 @@ export const CommandMenuObjectPickerSubView = ({ onChangeObject, objectMenuItemVariant = 'edit', emptyNoResultsText, -}: CommandMenuObjectPickerSubViewProps) => { +}: SidePanelObjectPickerSubViewProps) => { const { t } = useLingui(); const { filteredItems, selectableItemIds, isEmpty, hasSearchQuery } = - useFilteredPickerItems({ + useSidePanelFilteredPickerItems({ items: objects, searchQuery: searchValue, getSearchableValues: (item) => [item.labelPlural], @@ -57,9 +57,9 @@ export const CommandMenuObjectPickerSubView = ({ const isAddVariant = objectMenuItemVariant === 'add'; const listContent = ( - + {filteredItems.map((objectMetadataItem, index) => ( - ))} {isAddVariant ? ( - + } @@ -80,7 +82,7 @@ export const CommandMenuObjectPickerSubView = ({ onClick={onOpenSystemPicker} /> - + ) : ( )} - + ); return ( - {isAddVariant ? ( - + {({ innerRef, droppableProps, placeholder }) => ( - - + )} - + ) : ( - {listContent} - + )} - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuSystemObjectPickerSubView.tsx b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelSystemObjectPickerSubView.tsx similarity index 67% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuSystemObjectPickerSubView.tsx rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelSystemObjectPickerSubView.tsx index 8f7d502857..38ee11ef8a 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuSystemObjectPickerSubView.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/components/SidePanelSystemObjectPickerSubView.tsx @@ -1,13 +1,13 @@ import { useLingui } from '@lingui/react/macro'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { CommandMenuObjectPickerItem } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuObjectPickerItem'; -import { CommandMenuSubViewWithSearch } from '@/command-menu/components/CommandMenuSubViewWithSearch'; -import { useFilteredPickerItems } from '@/command-menu/hooks/useFilteredPickerItems'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { SidePanelObjectPickerItem } from '@/side-panel/pages/navigation-menu-item/components/SidePanelObjectPickerItem'; +import { SidePanelSubViewWithSearch } from '@/side-panel/components/SidePanelSubViewWithSearch'; +import { useSidePanelFilteredPickerItems } from '@/side-panel/hooks/useSidePanelFilteredPickerItems'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -type CommandMenuSystemObjectPickerSubViewProps = { +type SidePanelSystemObjectPickerSubViewProps = { systemObjects: ObjectMetadataItem[]; searchValue: string; onSearchChange: (value: string) => void; @@ -22,7 +22,7 @@ type CommandMenuSystemObjectPickerSubViewProps = { emptyNoResultsText?: string; }; -export const CommandMenuSystemObjectPickerSubView = ({ +export const SidePanelSystemObjectPickerSubView = ({ systemObjects, searchValue, onSearchChange, @@ -32,10 +32,10 @@ export const CommandMenuSystemObjectPickerSubView = ({ onChangeObject, objectMenuItemVariant = 'edit', emptyNoResultsText, -}: CommandMenuSystemObjectPickerSubViewProps) => { +}: SidePanelSystemObjectPickerSubViewProps) => { const { t } = useLingui(); const { filteredItems, selectableItemIds, isEmpty, hasSearchQuery } = - useFilteredPickerItems({ + useSidePanelFilteredPickerItems({ items: systemObjects, searchQuery: searchValue, getSearchableValues: (item) => [item.labelPlural], @@ -46,22 +46,22 @@ export const CommandMenuSystemObjectPickerSubView = ({ : (emptyNoResultsText ?? t`No system objects available`); return ( - - - + {filteredItems.map((objectMetadataItem) => ( - ))} - - - + + + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts similarity index 89% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts index a3a6dcee99..1078718cf3 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts @@ -4,7 +4,7 @@ import { IconFolder } from 'twenty-ui/display'; import { useAddFolderToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddFolderToNavigationMenuDraft'; import { useNavigationMenuItemsDraftState } from '@/navigation-menu-item/hooks/useNavigationMenuItemsDraftState'; -import { useOpenNavigationMenuItemInCommandMenu } from '@/navigation-menu-item/hooks/useOpenNavigationMenuItemInCommandMenu'; +import { useOpenNavigationMenuItemInSidePanel } from '@/navigation-menu-item/hooks/useOpenNavigationMenuItemInSidePanel'; import { addMenuItemInsertionContextState } from '@/navigation-menu-item/states/addMenuItemInsertionContextState'; import { navigationMenuItemsDraftState } from '@/navigation-menu-item/states/navigationMenuItemsDraftState'; import { selectedNavigationMenuItemInEditModeState } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeState'; @@ -21,8 +21,8 @@ export const useAddFolderToNavigationMenu = () => { const setSelectedNavigationMenuItemInEditMode = useSetAtomState( selectedNavigationMenuItemInEditModeState, ); - const { openNavigationMenuItemInCommandMenu } = - useOpenNavigationMenuItemInCommandMenu(); + const { openNavigationMenuItemInSidePanel } = + useOpenNavigationMenuItemInSidePanel(); const addMenuItemInsertionContext = useAtomStateValue( addMenuItemInsertionContextState, ); @@ -47,7 +47,7 @@ export const useAddFolderToNavigationMenu = () => { setAddMenuItemInsertionContext(null); setSelectedNavigationMenuItemInEditMode(itemId); - openNavigationMenuItemInCommandMenu({ + openNavigationMenuItemInSidePanel({ pageTitle: t`Edit folder`, pageIcon: IconFolder, focusTitleInput: true, diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts similarity index 89% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts index d3339a86ce..f8ac4f5deb 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts @@ -4,7 +4,7 @@ import { IconLink } from 'twenty-ui/display'; import { useAddLinkToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddLinkToNavigationMenuDraft'; import { useNavigationMenuItemsDraftState } from '@/navigation-menu-item/hooks/useNavigationMenuItemsDraftState'; -import { useOpenNavigationMenuItemInCommandMenu } from '@/navigation-menu-item/hooks/useOpenNavigationMenuItemInCommandMenu'; +import { useOpenNavigationMenuItemInSidePanel } from '@/navigation-menu-item/hooks/useOpenNavigationMenuItemInSidePanel'; import { addMenuItemInsertionContextState } from '@/navigation-menu-item/states/addMenuItemInsertionContextState'; import { navigationMenuItemsDraftState } from '@/navigation-menu-item/states/navigationMenuItemsDraftState'; import { selectedNavigationMenuItemInEditModeState } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeState'; @@ -21,8 +21,8 @@ export const useAddLinkToNavigationMenu = () => { const setSelectedNavigationMenuItemInEditMode = useSetAtomState( selectedNavigationMenuItemInEditModeState, ); - const { openNavigationMenuItemInCommandMenu } = - useOpenNavigationMenuItemInCommandMenu(); + const { openNavigationMenuItemInSidePanel } = + useOpenNavigationMenuItemInSidePanel(); const addMenuItemInsertionContext = useAtomStateValue( addMenuItemInsertionContextState, ); @@ -48,7 +48,7 @@ export const useAddLinkToNavigationMenu = () => { setAddMenuItemInsertionContext(null); setSelectedNavigationMenuItemInEditMode(itemId); - openNavigationMenuItemInCommandMenu({ + openNavigationMenuItemInSidePanel({ pageTitle: t`Edit link`, pageIcon: IconLink, focusTitleInput: true, diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts similarity index 96% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts index a16f47de97..3bc4fd5b92 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts @@ -1,6 +1,6 @@ import { isDefined } from 'twenty-shared/utils'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { useDraftNavigationMenuItemsAllFolders } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItemsAllFolders'; import { useDraftNavigationMenuItemsWorkspaceFolders } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItemsWorkspaceFolders'; import { useSelectedNavigationMenuItemEditItem } from '@/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem'; @@ -45,7 +45,7 @@ type UseFolderPickerSelectionDataParams = { export const useFolderPickerSelectionData = ({ onCloseSubView, }: UseFolderPickerSelectionDataParams) => { - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const { moveToFolder } = useNavigationMenuItemMoveRemove(); const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeState, @@ -95,7 +95,7 @@ export const useFolderPickerSelectionData = ({ if (isDefined(selectedNavigationMenuItemInEditMode)) { moveToFolder(selectedNavigationMenuItemInEditMode, folderId); onCloseSubView(); - closeCommandMenu(); + closeSidePanelMenu(); } }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts similarity index 89% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts index 082c9c79fa..e77a68cec0 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts @@ -2,9 +2,9 @@ import { useLingui } from '@lingui/react/macro'; import { isDefined } from 'twenty-shared/utils'; import { IconColumnInsertRight } from 'twenty-ui/display'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { type OrganizeActionsProps } from '@/command-menu/pages/navigation-menu-item/components/CommandMenuEditOrganizeActions'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { type OrganizeActionsProps } from '@/side-panel/pages/navigation-menu-item/components/SidePanelEditOrganizeActions'; import { useNavigationMenuItemMoveRemove } from '@/navigation-menu-item/hooks/useNavigationMenuItemMoveRemove'; import { useNavigationMenuItemsDraftState } from '@/navigation-menu-item/hooks/useNavigationMenuItemsDraftState'; import { useWorkspaceSectionItems } from '@/navigation-menu-item/hooks/useWorkspaceSectionItems'; @@ -13,7 +13,7 @@ import { selectedNavigationMenuItemInEditModeState } from '@/navigation-menu-ite import { type AddMenuItemInsertionContext } from '@/navigation-menu-item/types/AddMenuItemInsertionContext'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; const getAddMenuItemInsertionContext = ( selectedItem: { id: string; folderId?: string | null }, @@ -47,8 +47,8 @@ const getAddMenuItemInsertionContext = ( export const useNavigationMenuItemEditOrganizeActions = (): OrganizeActionsProps => { const { t } = useLingui(); - const { closeCommandMenu } = useCommandMenu(); - const { navigateCommandMenu } = useNavigateCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); + const { navigateSidePanel } = useNavigateSidePanel(); const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeState, ); @@ -103,7 +103,7 @@ export const useNavigationMenuItemEditOrganizeActions = if (isDefined(selectedNavigationMenuItemInEditMode)) { remove(selectedNavigationMenuItemInEditMode); setSelectedNavigationMenuItemInEditMode(null); - closeCommandMenu(); + closeSidePanelMenu(); } }; @@ -116,8 +116,8 @@ export const useNavigationMenuItemEditOrganizeActions = ); if (!context) return; setAddMenuItemInsertionContext(context); - navigateCommandMenu({ - page: CommandMenuPages.NavigationMenuAddItem, + navigateSidePanel({ + page: SidePanelPages.NavigationMenuAddItem, pageTitle: t`New sidebar item`, pageIcon: IconColumnInsertRight, resetNavigationStack: true, diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/command-menu-navigation-item-actions.ts b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/side-panel-navigation-item-actions.ts similarity index 77% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/command-menu-navigation-item-actions.ts rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/side-panel-navigation-item-actions.ts index 9c2d3c1b3a..34c608d4e6 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/command-menu-navigation-item-actions.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/side-panel-navigation-item-actions.ts @@ -1,4 +1,4 @@ -export enum CommandMenuNavigationItemActions { +export enum SidePanelNavigationItemActions { MOVE_UP = 'move-up', MOVE_DOWN = 'move-down', MOVE_TO_FOLDER = 'move-to-folder', diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/utils/getAvailableObjectMetadataForNewSidebarItem.ts b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/utils/getAvailableObjectMetadataForNewSidebarItem.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/utils/getAvailableObjectMetadataForNewSidebarItem.ts rename to packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/utils/getAvailableObjectMetadataForNewSidebarItem.ts diff --git a/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds.ts b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds.ts new file mode 100644 index 0000000000..fa088f4f2a --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/navigation-menu-item/utils/getOrganizeActionsSelectableItemIds.ts @@ -0,0 +1,26 @@ +import { SidePanelNavigationItemActions } from '@/side-panel/pages/navigation-menu-item/side-panel-navigation-item-actions'; + +const ORGANIZE_ACTIONS_WITHOUT_MOVE_TO_FOLDER: SidePanelNavigationItemActions[] = + [ + SidePanelNavigationItemActions.MOVE_UP, + SidePanelNavigationItemActions.MOVE_DOWN, + SidePanelNavigationItemActions.ADD_BEFORE, + SidePanelNavigationItemActions.ADD_AFTER, + SidePanelNavigationItemActions.REMOVE, + ]; + +const ORGANIZE_ACTIONS_WITH_MOVE_TO_FOLDER: SidePanelNavigationItemActions[] = [ + SidePanelNavigationItemActions.MOVE_UP, + SidePanelNavigationItemActions.MOVE_DOWN, + SidePanelNavigationItemActions.MOVE_TO_FOLDER, + SidePanelNavigationItemActions.ADD_BEFORE, + SidePanelNavigationItemActions.ADD_AFTER, + SidePanelNavigationItemActions.REMOVE, +]; + +export const getOrganizeActionsSelectableItemIds = ( + includeMoveToFolder: boolean, +): SidePanelNavigationItemActions[] => + includeMoveToFolder + ? ORGANIZE_ACTIONS_WITH_MOVE_TO_FOLDER + : ORGANIZE_ACTIONS_WITHOUT_MOVE_TO_FOLDER; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettings.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/ChartFiltersSettings.tsx similarity index 75% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettings.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/ChartFiltersSettings.tsx index d7bf8814b4..536c270be2 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettings.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/ChartFiltersSettings.tsx @@ -1,14 +1,14 @@ -import { useCommandMenuHistory } from '@/command-menu/hooks/useCommandMenuHistory'; -import { SidePanelSubPageNavigationHeader } from '@/command-menu/pages/common/components/SidePanelSubPageNavigationHeader'; -import { ChartFiltersSettingsInitializeStateEffect } from '@/command-menu/pages/page-layout/components/ChartFiltersSettingsInitializeStateEffect'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { type ChartWidget } from '@/command-menu/pages/page-layout/types/ChartWidget'; -import { type ChartWidgetConfiguration } from '@/command-menu/pages/page-layout/types/ChartWidgetConfiguration'; -import { getChartFiltersSettingsInstanceId } from '@/command-menu/pages/page-layout/utils/getChartFiltersSettingsInstanceId'; +import { useSidePanelHistory } from '@/side-panel/hooks/useSidePanelHistory'; +import { SidePanelSubPageNavigationHeader } from '@/side-panel/pages/common/components/SidePanelSubPageNavigationHeader'; +import { ChartFiltersSettingsInitializeStateEffect } from '@/side-panel/pages/page-layout/components/ChartFiltersSettingsInitializeStateEffect'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { type ChartWidget } from '@/side-panel/pages/page-layout/types/ChartWidget'; +import { type ChartWidgetConfiguration } from '@/side-panel/pages/page-layout/types/ChartWidgetConfiguration'; +import { getChartFiltersSettingsInstanceId } from '@/side-panel/pages/page-layout/utils/getChartFiltersSettingsInstanceId'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { AdvancedFilterCommandMenuContainer } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer'; +import { AdvancedFilterSidePanelContainer } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelContainer'; import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; @@ -38,7 +38,7 @@ export const ChartFiltersSettings = ({ objectMetadataItem, widget, }: ChartFiltersSettingsProps) => { - const { goBackFromCommandMenu } = useCommandMenuHistory(); + const { goBackFromSidePanel } = useSidePanelHistory(); const { instanceId } = getChartFiltersSettingsInstanceId({ widgetId: widget.id, @@ -82,7 +82,7 @@ export const ChartFiltersSettings = ({ <>
@@ -93,7 +93,7 @@ export const ChartFiltersSettings = ({ - { - const { updateCommandMenuPageInfo } = useUpdateCommandMenuPageInfo(); + const { updateSidePanelPageInfo } = useUpdateSidePanelPageInfo(); const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); const { updateCurrentWidgetConfig } = useUpdateCurrentWidgetConfig(pageLayoutId); @@ -67,7 +67,7 @@ export const ChartSettings = ({ widget }: { widget: PageLayoutWidget }) => { configToUpdate, }); - updateCommandMenuPageInfo({ + updateSidePanelPageInfo({ pageIcon: GRAPH_TYPE_INFORMATION[graphType].icon, }); @@ -137,8 +137,8 @@ export const ChartSettings = ({ widget }: { widget: PageLayoutWidget }) => { : CHART_SETTINGS_HEADINGS.X_AXIS; return ( - - + + { const shouldShowBanner = group.heading.id === bannerTargetHeading.id; return ( - + {shouldShowBanner && hasWidgetTooManyGroups && ( { configuration={configuration} /> ))} - + ); })} - - + + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartTypeSelectionSection.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/ChartTypeSelectionSection.tsx similarity index 90% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartTypeSelectionSection.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/ChartTypeSelectionSection.tsx index 72f129bb0a..d746fa949e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartTypeSelectionSection.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/ChartTypeSelectionSection.tsx @@ -1,9 +1,9 @@ -import { GRAPH_TYPE_INFORMATION } from '@/command-menu/pages/page-layout/constants/GraphTypeInformation'; +import { GRAPH_TYPE_INFORMATION } from '@/side-panel/pages/page-layout/constants/GraphTypeInformation'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { styled } from '@linaria/react'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; -import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType'; +import { GraphType } from '@/side-panel/pages/page-layout/types/GraphType'; import { t } from '@lingui/core/macro'; import { MenuPicker } from 'twenty-ui/navigation'; import { themeCssVariables } from 'twenty-ui/theme-constants'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutChartSettings.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutChartSettings.tsx similarity index 79% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutChartSettings.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutChartSettings.tsx index 3e9632f2a7..92038948ee 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutChartSettings.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutChartSettings.tsx @@ -1,7 +1,7 @@ -import { ChartSettings } from '@/command-menu/pages/page-layout/components/ChartSettings'; -import { WidgetSettingsFooter } from '@/command-menu/pages/page-layout/components/WidgetSettingsFooter'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { isChartWidget } from '@/command-menu/pages/page-layout/utils/isChartWidget'; +import { ChartSettings } from '@/side-panel/pages/page-layout/components/ChartSettings'; +import { WidgetSettingsFooter } from '@/side-panel/pages/page-layout/components/WidgetSettingsFooter'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { isChartWidget } from '@/side-panel/pages/page-layout/utils/isChartWidget'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; @@ -15,7 +15,7 @@ const StyledContainer = styled.div` height: 100%; `; -export const CommandMenuPageLayoutChartSettings = () => { +export const SidePanelPageLayoutChartSettings = () => { const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); const pageLayoutDraft = useAtomComponentStateValue( diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutFieldsLayout.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutFieldsLayout.tsx similarity index 78% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutFieldsLayout.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutFieldsLayout.tsx index 03690c9f0d..3d01856631 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutFieldsLayout.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutFieldsLayout.tsx @@ -1,7 +1,7 @@ -import { useCommandMenuHistory } from '@/command-menu/hooks/useCommandMenuHistory'; -import { SidePanelSubPageNavigationHeader } from '@/command-menu/pages/common/components/SidePanelSubPageNavigationHeader'; -import { usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; +import { useSidePanelHistory } from '@/side-panel/hooks/useSidePanelHistory'; +import { SidePanelSubPageNavigationHeader } from '@/side-panel/pages/common/components/SidePanelSubPageNavigationHeader'; +import { usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; import { useTemporaryFieldsConfiguration } from '@/page-layout/hooks/useTemporaryFieldsConfiguration'; import { FieldsConfigurationEditor } from '@/page-layout/widgets/fields/components/FieldsConfigurationEditor'; import { FieldsWidgetGroupsDraftInitializationEffect } from '@/page-layout/widgets/fields/components/FieldsWidgetGroupsDraftInitializationEffect'; @@ -29,8 +29,8 @@ const StyledContainer = styled.div` overflow-y: auto; `; -export const CommandMenuPageLayoutFieldsLayout = () => { - const { goBackFromCommandMenu } = useCommandMenuHistory(); +export const SidePanelPageLayoutFieldsLayout = () => { + const { goBackFromSidePanel } = useSidePanelHistory(); const { pageLayoutId } = usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord(); @@ -54,7 +54,7 @@ export const CommandMenuPageLayoutFieldsLayout = () => { { +export const SidePanelPageLayoutFieldsSettings = () => { const { t } = useLingui(); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); const { pageLayoutId, objectNameSingular } = usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord(); @@ -54,8 +54,8 @@ export const CommandMenuPageLayoutFieldsSettings = () => { ); const handleNavigateToLayout = () => { - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutFieldsLayout, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutFieldsLayout, }); }; @@ -73,12 +73,9 @@ export const CommandMenuPageLayoutFieldsSettings = () => { return ( - - - + + + { contextualTextPosition="right" /> - - - + + + ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutGraphFilter.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutGraphFilter.tsx similarity index 84% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutGraphFilter.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutGraphFilter.tsx index 557c7cd389..a36b791ec2 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutGraphFilter.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutGraphFilter.tsx @@ -1,6 +1,6 @@ -import { ChartFiltersSettings } from '@/command-menu/pages/page-layout/components/ChartFiltersSettings'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { isChartWidget } from '@/command-menu/pages/page-layout/utils/isChartWidget'; +import { ChartFiltersSettings } from '@/side-panel/pages/page-layout/components/ChartFiltersSettings'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { isChartWidget } from '@/side-panel/pages/page-layout/utils/isChartWidget'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; @@ -8,7 +8,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; -export const CommandMenuPageLayoutGraphFilter = () => { +export const SidePanelPageLayoutGraphFilter = () => { const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); const pageLayoutDraft = useAtomComponentStateValue( diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutIframeSettings.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutIframeSettings.tsx similarity index 88% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutIframeSettings.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutIframeSettings.tsx index 84391efca7..9d598b6917 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutIframeSettings.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutIframeSettings.tsx @@ -1,6 +1,6 @@ -import { WidgetSettingsFooter } from '@/command-menu/pages/page-layout/components/WidgetSettingsFooter'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; +import { WidgetSettingsFooter } from '@/side-panel/pages/page-layout/components/WidgetSettingsFooter'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput'; import { useUpdatePageLayoutWidget } from '@/page-layout/hooks/useUpdatePageLayoutWidget'; import { styled } from '@linaria/react'; @@ -25,7 +25,7 @@ const StyledContainer = styled.div` padding: ${themeCssVariables.spacing[2]}; `; -export const CommandMenuPageLayoutIframeSettings = () => { +export const SidePanelPageLayoutIframeSettings = () => { const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); const { widgetInEditMode } = useWidgetInEditMode(pageLayoutId); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutTabSettings.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutTabSettings.tsx similarity index 85% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutTabSettings.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutTabSettings.tsx index 0de75cb603..4cadb83a85 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutTabSettings.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutTabSettings.tsx @@ -1,9 +1,9 @@ -import { CommandGroup } from '@/command-menu/components/CommandGroup'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { TAB_SETTINGS_SELECTABLE_ITEM_IDS } from '@/command-menu/pages/page-layout/constants/settings/TabSettingsSelectableItemIds'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { TAB_SETTINGS_SELECTABLE_ITEM_IDS } from '@/side-panel/pages/page-layout/constants/settings/TabSettingsSelectableItemIds'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; import { useDeletePageLayoutTab } from '@/page-layout/hooks/useDeletePageLayoutTab'; import { useDuplicatePageLayoutTab } from '@/page-layout/hooks/useDuplicatePageLayoutTab'; import { useMovePageLayoutTab } from '@/page-layout/hooks/useMovePageLayoutTab'; @@ -22,8 +22,8 @@ import { IconTrash, } from 'twenty-ui/display'; -export const CommandMenuPageLayoutTabSettings = () => { - const { closeCommandMenu } = useCommandMenu(); +export const SidePanelPageLayoutTabSettings = () => { + const { closeSidePanelMenu } = useSidePanelMenu(); const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); const pageLayoutDraft = useAtomComponentStateValue( @@ -58,7 +58,7 @@ export const CommandMenuPageLayoutTabSettings = () => { const handleDelete = () => { deleteTab(tab.id); setPageLayoutTabSettingsOpenTabId(null); - closeCommandMenu(); + closeSidePanelMenu(); }; const selectableItemIds = [ @@ -70,8 +70,8 @@ export const CommandMenuPageLayoutTabSettings = () => { return ( <> - - + + {canMoveLeft && ( { /> )} - - + + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutWidgetTypeSelect.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutWidgetTypeSelect.tsx similarity index 84% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutWidgetTypeSelect.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutWidgetTypeSelect.tsx index 6e8e296d53..2822d01192 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutWidgetTypeSelect.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SidePanelPageLayoutWidgetTypeSelect.tsx @@ -1,11 +1,11 @@ -import { CommandGroup } from '@/command-menu/components/CommandGroup'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { getFrontComponentWidgetTypeSelectItemId } from '@/command-menu/pages/page-layout/utils/getFrontComponentWidgetTypeSelectItemId'; -import { isExistingWidgetMissingOrDifferentType } from '@/command-menu/pages/page-layout/utils/isExistingWidgetMissingOrDifferentType'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { useNavigatePageLayoutSidePanel } from '@/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { getFrontComponentWidgetTypeSelectItemId } from '@/side-panel/pages/page-layout/utils/getFrontComponentWidgetTypeSelectItemId'; +import { isExistingWidgetMissingOrDifferentType } from '@/side-panel/pages/page-layout/utils/isExistingWidgetMissingOrDifferentType'; import { FIND_MANY_FRONT_COMPONENTS } from '@/front-components/graphql/queries/findManyFrontComponents'; import { useCreatePageLayoutFrontComponentWidget } from '@/page-layout/hooks/useCreatePageLayoutFrontComponentWidget'; import { useCreatePageLayoutGraphWidget } from '@/page-layout/hooks/useCreatePageLayoutGraphWidget'; @@ -21,7 +21,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useQuery } from '@apollo/client'; import { t } from '@lingui/core/macro'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { IconAlignBoxLeftTop, @@ -35,12 +35,12 @@ import { WidgetType, } from '~/generated-metadata/graphql'; -export const CommandMenuPageLayoutWidgetTypeSelect = () => { +export const SidePanelPageLayoutWidgetTypeSelect = () => { const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); - const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); + const { navigatePageLayoutSidePanel } = useNavigatePageLayoutSidePanel(); const { buildBarChartFieldSelection } = useOpportunityDefaultChartConfig(); @@ -111,8 +111,8 @@ export const CommandMenuPageLayoutWidgetTypeSelect = () => { setPageLayoutEditingWidgetId(newWidget.id); } - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutGraphTypeSelect, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutGraphTypeSelect, focusTitleInput: true, }); }; @@ -132,8 +132,8 @@ export const CommandMenuPageLayoutWidgetTypeSelect = () => { setPageLayoutEditingWidgetId(newWidget.id); } - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutIframeSettings, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutIframeSettings, focusTitleInput: true, }); }; @@ -156,7 +156,7 @@ export const CommandMenuPageLayoutWidgetTypeSelect = () => { setPageLayoutEditingWidgetId(newWidget.id); } - closeCommandMenu(); + closeSidePanelMenu(); }; const handleCreateFrontComponentWidget = (frontComponent: FrontComponent) => { @@ -177,7 +177,7 @@ export const CommandMenuPageLayoutWidgetTypeSelect = () => { setPageLayoutEditingWidgetId(newWidget.id); } - closeCommandMenu(); + closeSidePanelMenu(); }; const selectableItemIds = [ @@ -188,8 +188,8 @@ export const CommandMenuPageLayoutWidgetTypeSelect = () => { ]; return ( - - + + { onClick={handleNavigateToRichTextSettings} /> - + {isApplicationEnabled && frontComponentsWithSelectItemId.length > 0 && ( - + {frontComponentsWithSelectItemId.map( ({ frontComponent, selectItemId }) => ( { ), )} - + )} - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/WidgetSettingsFooter.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsFooter.tsx similarity index 96% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/WidgetSettingsFooter.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsFooter.tsx index 7f4f315999..2d07d73845 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/WidgetSettingsFooter.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsFooter.tsx @@ -3,7 +3,7 @@ import { useDuplicatePageLayoutWidget } from '@/page-layout/hooks/useDuplicatePa import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { OptionsDropdownMenu } from '@/ui/layout/dropdown/components/OptionsDropdownMenu'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter'; +import { SidePanelFooter } from '@/ui/layout/side-panel/components/SidePanelFooter'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; @@ -48,7 +48,7 @@ export const WidgetSettingsFooter = ({ ); return ( - { - navigatePageLayoutCommandMenu({ - commandMenuPage: CommandMenuPages.PageLayoutGraphFilter, + navigatePageLayoutSidePanel({ + sidePanelPage: SidePanelPages.PageLayoutGraphFilter, }); }; if (item.id === CHART_CONFIGURATION_SETTING_IDS.FILTER) { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx similarity index 89% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx index ad1282b72c..a399214242 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx @@ -1,7 +1,7 @@ -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; import { convertExtendedAggregateOperationToAggregateOperation } from '@/object-record/utils/convertExtendedAggregateOperationToAggregateOperation'; import { DASHBOARD_AGGREGATE_OPERATION_RATIO } from '@/page-layout/widgets/graph/constants/DashboardAggregateOperationRatio'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectionDropdownContent.tsx similarity index 90% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectionDropdownContent.tsx index dd8b15c94c..c7a722dc30 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectionDropdownContent.tsx @@ -1,9 +1,9 @@ -import { ChartAggregateOperationSelectableListItem } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem'; -import { ChartRatioAggregateOperationSelectableListItem } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem'; -import { ChartRatioOptionValueSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionValueSelectionDropdownContent'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { ChartAggregateOperationSelectableListItem } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem'; +import { ChartRatioAggregateOperationSelectableListItem } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem'; +import { ChartRatioOptionValueSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionValueSelectionDropdownContent'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations'; import { getAvailableAggregateOperationsForFieldMetadataType } from '@/object-record/record-table/record-table-footer/utils/getAvailableAggregateOperationsForFieldMetadataType'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx similarity index 85% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx index aaceda0c5a..86c72f0aea 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx @@ -1,8 +1,8 @@ -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { getChartAxisNameDisplayOptions } from '@/command-menu/pages/page-layout/utils/getChartAxisNameDisplayOptions'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { getChartAxisNameDisplayOptions } from '@/side-panel/pages/page-layout/utils/getChartAxisNameDisplayOptions'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx index 70e7ebaf5a..a245aea865 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorGradientOption.tsx @@ -1,4 +1,4 @@ -import { CHART_SETTINGS_PALETTE_COLOR_GROUP_COUNT } from '@/command-menu/pages/page-layout/constants/ChartSettingsPaletteColorGroupCount'; +import { CHART_SETTINGS_PALETTE_COLOR_GROUP_COUNT } from '@/side-panel/pages/page-layout/constants/ChartSettingsPaletteColorGroupCount'; import { createGraphColorRegistry } from '@/page-layout/widgets/graph/utils/createGraphColorRegistry'; import { generateGroupColor } from '@/page-layout/widgets/graph/utils/generateGroupColor'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx index 50f51fde3e..6670a6c419 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorPaletteOption.tsx @@ -1,4 +1,4 @@ -import { CHART_SETTINGS_PALETTE_COLOR_GROUP_COUNT } from '@/command-menu/pages/page-layout/constants/ChartSettingsPaletteColorGroupCount'; +import { CHART_SETTINGS_PALETTE_COLOR_GROUP_COUNT } from '@/side-panel/pages/page-layout/constants/ChartSettingsPaletteColorGroupCount'; import { createGraphColorRegistry } from '@/page-layout/widgets/graph/utils/createGraphColorRegistry'; import { getColorSchemeByIndex } from '@/page-layout/widgets/graph/utils/getColorSchemeByIndex'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx similarity index 86% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx index 9c585c95b4..76ed4cd8c1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx @@ -1,10 +1,10 @@ -import { ChartColorGradientOption } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartColorGradientOption'; -import { ChartColorPaletteOption } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartColorPaletteOption'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { ChartColorGradientOption } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartColorGradientOption'; +import { ChartColorPaletteOption } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartColorPaletteOption'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx index 63f890e14c..5965c8e2f9 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx @@ -1,7 +1,7 @@ -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useResetChartDraftFiltersSettings } from '@/command-menu/pages/page-layout/hooks/useResetChartDraftFiltersSettings'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useResetChartDraftFiltersSettings } from '@/side-panel/pages/page-layout/hooks/useResetChartDraftFiltersSettings'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx similarity index 90% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx index bb2dfb0e2c..7c511f9cca 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx @@ -1,9 +1,9 @@ -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { getDateGranularityLabel } from '@/command-menu/pages/page-layout/utils/getDateGranularityLabel'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { getDateGranularityLabel } from '@/side-panel/pages/page-layout/utils/getDateGranularityLabel'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type FieldConfiguration } from '@/page-layout/types/FieldConfiguration'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularityXSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularityXSelectionDropdownContent.tsx similarity index 66% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularityXSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularityXSelectionDropdownContent.tsx index 813768a490..349805714e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularityXSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularityXSelectionDropdownContent.tsx @@ -1,4 +1,4 @@ -import { ChartDateGranularitySelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent'; +import { ChartDateGranularitySelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent'; export const ChartDateGranularityXSelectionDropdownContent = () => { return ; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularityYSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularityYSelectionDropdownContent.tsx similarity index 66% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularityYSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularityYSelectionDropdownContent.tsx index d631aa3f6a..bafa17ad3c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularityYSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularityYSelectionDropdownContent.tsx @@ -1,4 +1,4 @@ -import { ChartDateGranularitySelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent'; +import { ChartDateGranularitySelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent'; export const ChartDateGranularityYSelectionDropdownContent = () => { return ; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx similarity index 92% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx index 78512519c4..649ff92eb2 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx @@ -1,7 +1,7 @@ -import { ChartAggregateOperationSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectionDropdownContent'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { ChartAggregateOperationSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectionDropdownContent'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView.tsx similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView.tsx diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContent.tsx similarity index 53% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContent.tsx index d06b3423bf..43af03f6f4 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContent.tsx @@ -1,6 +1,6 @@ -import { ChartGroupByFieldSelectionDropdownContentBase } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase'; -import { type TypedBarChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedBarChartConfiguration'; -import { type TypedLineChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedLineChartConfiguration'; +import { ChartGroupByFieldSelectionDropdownContentBase } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase'; +import { type TypedBarChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedBarChartConfiguration'; +import { type TypedLineChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedLineChartConfiguration'; export const ChartGroupByFieldSelectionDropdownContent = () => { return ( diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx similarity index 92% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx index 5ad61adbb8..11ed7cc0b1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx @@ -1,10 +1,10 @@ -import { ChartGroupByFieldSelectionCompositeFieldView } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView'; -import { ChartGroupByFieldSelectionRelationFieldView } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { buildChartGroupByFieldConfigUpdate } from '@/command-menu/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate'; +import { ChartGroupByFieldSelectionCompositeFieldView } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView'; +import { ChartGroupByFieldSelectionRelationFieldView } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { buildChartGroupByFieldConfigUpdate } from '@/side-panel/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx similarity index 98% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx index f487ecddff..0614e68329 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx @@ -1,4 +1,4 @@ -import { ChartGroupByFieldSelectionCompositeFieldView } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView'; +import { ChartGroupByFieldSelectionCompositeFieldView } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent.tsx similarity index 88% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent.tsx index 374ca103de..3a1e18c598 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent.tsx @@ -1,11 +1,11 @@ import { type DropResult } from '@hello-pangea/dnd'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; -import { getManualSortOrderFromConfig } from '@/command-menu/pages/page-layout/utils/getManualSortOrderFromConfig'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { getManualSortOrderFromConfig } from '@/side-panel/pages/page-layout/utils/getManualSortOrderFromConfig'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { sortOptionsForManualOrder } from '@/page-layout/widgets/graph/utils/sortOptionsForManualOrder'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartPieFieldSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartPieFieldSelectionDropdownContent.tsx similarity index 59% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartPieFieldSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartPieFieldSelectionDropdownContent.tsx index bf76377c8e..0ee39b6e2c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartPieFieldSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartPieFieldSelectionDropdownContent.tsx @@ -1,5 +1,5 @@ -import { ChartGroupByFieldSelectionDropdownContentBase } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase'; -import { type TypedPieChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedPieChartConfiguration'; +import { ChartGroupByFieldSelectionDropdownContentBase } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase'; +import { type TypedPieChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedPieChartConfiguration'; export const ChartPieFieldSelectionDropdownContent = () => { return ( diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx similarity index 86% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx index b980fbef24..292b2a325d 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx @@ -1,6 +1,6 @@ -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { DASHBOARD_AGGREGATE_OPERATION_RATIO } from '@/page-layout/widgets/graph/constants/DashboardAggregateOperationRatio'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx similarity index 86% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx index 6bc9b18e7f..38fb1e9ee8 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx @@ -1,7 +1,7 @@ -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx similarity index 86% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx index ec2df8c85e..8de708e809 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx @@ -1,7 +1,7 @@ -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionValueSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionValueSelectionDropdownContent.tsx similarity index 88% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionValueSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionValueSelectionDropdownContent.tsx index 6d3d33e66d..5e0a058484 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionValueSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionValueSelectionDropdownContent.tsx @@ -1,8 +1,8 @@ -import { ChartRatioOptionBooleanSelectableListItem } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem'; -import { ChartRatioOptionSelectSelectableListItem } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { ChartRatioOptionBooleanSelectableListItem } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem'; +import { ChartRatioOptionSelectSelectableListItem } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader'; import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx similarity index 83% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx index 0665d50f93..f19096011f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx @@ -1,15 +1,15 @@ import { useState } from 'react'; -import { ChartManualSortSubMenuContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent'; -import { AGGREGATE_SORT_BY_OPTIONS } from '@/command-menu/pages/page-layout/constants/AggregateSortByOptions'; -import { useGraphGroupBySortOptionLabels } from '@/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { filterSortOptionsByFieldType } from '@/command-menu/pages/page-layout/utils/filterSortOptionsByFieldType'; -import { getDefaultManualSortOrder } from '@/command-menu/pages/page-layout/utils/getDefaultManualSortOrder'; -import { getSortIconForFieldType } from '@/command-menu/pages/page-layout/utils/getSortIconForFieldType'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { ChartManualSortSubMenuContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent'; +import { AGGREGATE_SORT_BY_OPTIONS } from '@/side-panel/pages/page-layout/constants/AggregateSortByOptions'; +import { useGraphGroupBySortOptionLabels } from '@/side-panel/pages/page-layout/hooks/useGraphGroupBySortOptionLabels'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { filterSortOptionsByFieldType } from '@/side-panel/pages/page-layout/utils/filterSortOptionsByFieldType'; +import { getDefaultManualSortOrder } from '@/side-panel/pages/page-layout/utils/getDefaultManualSortOrder'; +import { getSortIconForFieldType } from '@/side-panel/pages/page-layout/utils/getSortIconForFieldType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx similarity index 86% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx index 4e87fe2491..147cf301ff 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx @@ -1,15 +1,15 @@ import { useState } from 'react'; -import { ChartManualSortSubMenuContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent'; -import { X_SORT_BY_OPTIONS } from '@/command-menu/pages/page-layout/constants/XSortByOptions'; -import { useGraphXSortOptionLabels } from '@/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels'; -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useUpdateCurrentWidgetConfig } from '@/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { filterSortOptionsByFieldType } from '@/command-menu/pages/page-layout/utils/filterSortOptionsByFieldType'; -import { getDefaultManualSortOrder } from '@/command-menu/pages/page-layout/utils/getDefaultManualSortOrder'; -import { getSortIconForFieldType } from '@/command-menu/pages/page-layout/utils/getSortIconForFieldType'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { ChartManualSortSubMenuContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartManualSortSubMenuContent'; +import { X_SORT_BY_OPTIONS } from '@/side-panel/pages/page-layout/constants/XSortByOptions'; +import { useGraphXSortOptionLabels } from '@/side-panel/pages/page-layout/hooks/useGraphXSortOptionLabels'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useUpdateCurrentWidgetConfig } from '@/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { filterSortOptionsByFieldType } from '@/side-panel/pages/page-layout/utils/filterSortOptionsByFieldType'; +import { getDefaultManualSortOrder } from '@/side-panel/pages/page-layout/utils/getDefaultManualSortOrder'; +import { getSortIconForFieldType } from '@/side-panel/pages/page-layout/utils/getSortIconForFieldType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartXAxisFieldSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartXAxisFieldSelectionDropdownContent.tsx similarity index 53% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartXAxisFieldSelectionDropdownContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartXAxisFieldSelectionDropdownContent.tsx index 2c62b33340..331fe32127 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartXAxisFieldSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dropdown-content/ChartXAxisFieldSelectionDropdownContent.tsx @@ -1,6 +1,6 @@ -import { ChartGroupByFieldSelectionDropdownContentBase } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase'; -import { type TypedBarChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedBarChartConfiguration'; -import { type TypedLineChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedLineChartConfiguration'; +import { ChartGroupByFieldSelectionDropdownContentBase } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase'; +import { type TypedBarChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedBarChartConfiguration'; +import { type TypedLineChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedLineChartConfiguration'; export const ChartXAxisFieldSelectionDropdownContent = () => { return ( diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/AggregateChartSettings.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/AggregateChartSettings.ts new file mode 100644 index 0000000000..668883666f --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/AggregateChartSettings.ts @@ -0,0 +1,22 @@ +import { CHART_SETTINGS_HEADINGS } from '@/side-panel/pages/page-layout/constants/ChartSettingsHeadings'; +import { CHART_DATA_SOURCE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting'; +import { DATA_DISPLAY_AGGREGATE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataDisplayAggregateSetting'; +import { FILTER_SETTING } from '@/side-panel/pages/page-layout/constants/settings/FilterSetting'; +import { PREFIX_SETTING } from '@/side-panel/pages/page-layout/constants/settings/PrefixSetting'; +import { SUFFIX_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SuffixSetting'; +import { type ChartSettingsGroup } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; + +export const AGGREGATE_CHART_SETTINGS: ChartSettingsGroup[] = [ + { + heading: CHART_SETTINGS_HEADINGS.DATA, + items: [ + CHART_DATA_SOURCE_SETTING, + FILTER_SETTING, + DATA_DISPLAY_AGGREGATE_SETTING, + ], + }, + { + heading: CHART_SETTINGS_HEADINGS.STYLE, + items: [PREFIX_SETTING, SUFFIX_SETTING], + }, +]; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/AggregateSortByOptions.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/AggregateSortByOptions.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/AggregateSortByOptions.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/AggregateSortByOptions.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/ChartSettingsHeadings.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/ChartSettingsHeadings.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/ChartSettingsHeadings.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/ChartSettingsHeadings.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/ChartSettingsPaletteColorGroupCount.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/ChartSettingsPaletteColorGroupCount.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/ChartSettingsPaletteColorGroupCount.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/ChartSettingsPaletteColorGroupCount.ts diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/GaugeChartSettings.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/GaugeChartSettings.ts new file mode 100644 index 0000000000..a62615b503 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/GaugeChartSettings.ts @@ -0,0 +1,16 @@ +import { CHART_SETTINGS_HEADINGS } from '@/side-panel/pages/page-layout/constants/ChartSettingsHeadings'; +import { CHART_DATA_SOURCE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting'; +import { DATA_LABELS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataLabelsSetting'; +import { FILTER_SETTING } from '@/side-panel/pages/page-layout/constants/settings/FilterSetting'; +import { type ChartSettingsGroup } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; + +export const GAUGE_CHART_SETTINGS: ChartSettingsGroup[] = [ + { + heading: CHART_SETTINGS_HEADINGS.DATA, + items: [CHART_DATA_SOURCE_SETTING, FILTER_SETTING], + }, + { + heading: CHART_SETTINGS_HEADINGS.STYLE, + items: [DATA_LABELS_SETTING], + }, +]; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/GraphConfigurationTypeToConfigTypename.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/GraphConfigurationTypeToConfigTypename.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/GraphConfigurationTypeToConfigTypename.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/GraphConfigurationTypeToConfigTypename.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/GraphTypeInformation.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/GraphTypeInformation.ts similarity index 64% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/GraphTypeInformation.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/GraphTypeInformation.ts index 64169cd867..4cf733eeb1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/GraphTypeInformation.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/GraphTypeInformation.ts @@ -1,10 +1,10 @@ -import { AGGREGATE_CHART_SETTINGS } from '@/command-menu/pages/page-layout/constants/AggregateChartSettings'; -import { GAUGE_CHART_SETTINGS } from '@/command-menu/pages/page-layout/constants/GaugeChartSettings'; -import { LINE_CHART_SETTINGS } from '@/command-menu/pages/page-layout/constants/LineChartSettings'; -import { PIE_CHART_SETTINGS } from '@/command-menu/pages/page-layout/constants/PieChartSettings'; -import { type ChartSettingsGroup } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType'; -import { getBarChartSettings } from '@/command-menu/pages/page-layout/utils/getBarChartSettings'; +import { AGGREGATE_CHART_SETTINGS } from '@/side-panel/pages/page-layout/constants/AggregateChartSettings'; +import { GAUGE_CHART_SETTINGS } from '@/side-panel/pages/page-layout/constants/GaugeChartSettings'; +import { LINE_CHART_SETTINGS } from '@/side-panel/pages/page-layout/constants/LineChartSettings'; +import { PIE_CHART_SETTINGS } from '@/side-panel/pages/page-layout/constants/PieChartSettings'; +import { type ChartSettingsGroup } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { GraphType } from '@/side-panel/pages/page-layout/types/GraphType'; +import { getBarChartSettings } from '@/side-panel/pages/page-layout/utils/getBarChartSettings'; import { type MessageDescriptor } from '@lingui/core'; import { msg } from '@lingui/core/macro'; import { diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/LineChartSettings.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/LineChartSettings.ts new file mode 100644 index 0000000000..fa9f0129a1 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/LineChartSettings.ts @@ -0,0 +1,62 @@ +import { CHART_SETTINGS_HEADINGS } from '@/side-panel/pages/page-layout/constants/ChartSettingsHeadings'; +import { AXIS_NAME_SETTING } from '@/side-panel/pages/page-layout/constants/settings/AxisNameSetting'; +import { CHART_DATA_SOURCE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting'; +import { COLORS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ColorsSetting'; +import { CUMULATIVE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/CumulativeSetting'; +import { DATA_DISPLAY_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataDisplayXSetting'; +import { DATA_DISPLAY_Y_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataDisplayYSetting'; +import { DATA_LABELS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataLabelsSetting'; +import { DATE_GRANULARITY_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DateGranularityXSetting'; +import { DATE_GRANULARITY_Y_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DateGranularityYSetting'; +import { FILTER_SETTING } from '@/side-panel/pages/page-layout/constants/settings/FilterSetting'; +import { GROUP_BY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/GroupBySetting'; +import { OMIT_NULL_VALUES_SETTING } from '@/side-panel/pages/page-layout/constants/settings/OmitNullValuesSetting'; +import { PRIMARY_SORT_BY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/PrimarySortBySetting'; +import { RANGE_MAX_SETTING } from '@/side-panel/pages/page-layout/constants/settings/RangeMaxSetting'; +import { RANGE_MIN_SETTING } from '@/side-panel/pages/page-layout/constants/settings/RangeMinSetting'; +import { SHOW_LEGEND_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ShowLegendSetting'; +import { SORT_BY_GROUP_BY_FIELD_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SortByGroupByFieldSetting'; +import { SPLIT_MULTI_VALUE_FIELDS_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting'; +import { SPLIT_MULTI_VALUE_FIELDS_Y_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting'; +import { STACKED_LINES_SETTING } from '@/side-panel/pages/page-layout/constants/settings/StackedLineSettings'; +import { type ChartSettingsGroup } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; + +export const LINE_CHART_SETTINGS: ChartSettingsGroup[] = [ + { + heading: CHART_SETTINGS_HEADINGS.DATA, + items: [CHART_DATA_SOURCE_SETTING, FILTER_SETTING], + }, + { + heading: CHART_SETTINGS_HEADINGS.X_AXIS, + items: [ + DATA_DISPLAY_X_SETTING, + DATE_GRANULARITY_X_SETTING, + PRIMARY_SORT_BY_SETTING, + OMIT_NULL_VALUES_SETTING, + SPLIT_MULTI_VALUE_FIELDS_X_SETTING, + ], + }, + { + heading: CHART_SETTINGS_HEADINGS.Y_AXIS, + items: [ + DATA_DISPLAY_Y_SETTING, + GROUP_BY_SETTING, + DATE_GRANULARITY_Y_SETTING, + SORT_BY_GROUP_BY_FIELD_SETTING, + CUMULATIVE_SETTING, + RANGE_MIN_SETTING, + RANGE_MAX_SETTING, + SPLIT_MULTI_VALUE_FIELDS_Y_SETTING, + ], + }, + { + heading: CHART_SETTINGS_HEADINGS.STYLE, + items: [ + COLORS_SETTING, + AXIS_NAME_SETTING, + STACKED_LINES_SETTING, + DATA_LABELS_SETTING, + SHOW_LEGEND_SETTING, + ], + }, +]; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/PieChartSettings.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/PieChartSettings.ts new file mode 100644 index 0000000000..431e5306b1 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/PieChartSettings.ts @@ -0,0 +1,39 @@ +import { CHART_SETTINGS_HEADINGS } from '@/side-panel/pages/page-layout/constants/ChartSettingsHeadings'; +import { CENTER_METRIC_SETTING } from '@/side-panel/pages/page-layout/constants/settings/CenterMetricSetting'; +import { CHART_DATA_SOURCE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting'; +import { COLORS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ColorsSetting'; +import { DATA_DISPLAY_PIE_CHART_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataDisplayPieChartSetting'; +import { DATA_LABELS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataLabelsSetting'; +import { DATE_GRANULARITY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DateGranularitySetting'; +import { EACH_SLICE_REPRESENTS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/EachSliceRepresentsSetting'; +import { FILTER_SETTING } from '@/side-panel/pages/page-layout/constants/settings/FilterSetting'; +import { HIDE_EMPTY_CATEGORY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/HideEmptyCategorySetting'; +import { PRIMARY_SORT_BY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/PrimarySortBySetting'; +import { SHOW_LEGEND_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ShowLegendSetting'; +import { SPLIT_MULTI_VALUE_FIELDS_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting'; +import { type ChartSettingsGroup } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; + +export const PIE_CHART_SETTINGS: ChartSettingsGroup[] = [ + { + heading: CHART_SETTINGS_HEADINGS.DATA, + items: [ + CHART_DATA_SOURCE_SETTING, + FILTER_SETTING, + DATA_DISPLAY_PIE_CHART_SETTING, + DATE_GRANULARITY_SETTING, + EACH_SLICE_REPRESENTS_SETTING, + PRIMARY_SORT_BY_SETTING, + HIDE_EMPTY_CATEGORY_SETTING, + SPLIT_MULTI_VALUE_FIELDS_X_SETTING, + ], + }, + { + heading: CHART_SETTINGS_HEADINGS.STYLE, + items: [ + COLORS_SETTING, + DATA_LABELS_SETTING, + SHOW_LEGEND_SETTING, + CENTER_METRIC_SETTING, + ], + }, +]; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/XSortByOptions.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/XSortByOptions.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/XSortByOptions.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/XSortByOptions.ts diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/AxisNameSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/AxisNameSetting.ts new file mode 100644 index 0000000000..a0b6bf1d22 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/AxisNameSetting.ts @@ -0,0 +1,13 @@ +import { ChartAxisNameSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconGizmo } from 'twenty-ui/display'; + +export const AXIS_NAME_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconGizmo, + label: CHART_CONFIGURATION_SETTING_LABELS.AXIS_NAME, + id: CHART_CONFIGURATION_SETTING_IDS.AXIS_NAME, + DropdownContent: ChartAxisNameSelectionDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/CenterMetricSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/CenterMetricSetting.ts new file mode 100644 index 0000000000..73bc0fbc75 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/CenterMetricSetting.ts @@ -0,0 +1,11 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconNumber123 } from 'twenty-ui/display'; + +export const CENTER_METRIC_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconNumber123, + label: CHART_CONFIGURATION_SETTING_LABELS.CENTER_METRIC, + id: CHART_CONFIGURATION_SETTING_IDS.CENTER_METRIC, +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels.ts diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting.ts new file mode 100644 index 0000000000..f70d1d05fa --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting.ts @@ -0,0 +1,13 @@ +import { ChartDataSourceDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconDatabase } from 'twenty-ui/display'; + +export const CHART_DATA_SOURCE_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconDatabase, + label: CHART_CONFIGURATION_SETTING_LABELS.SOURCE, + id: CHART_CONFIGURATION_SETTING_IDS.SOURCE, + DropdownContent: ChartDataSourceDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ColorsSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ColorsSetting.ts new file mode 100644 index 0000000000..8ed2aa33cb --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ColorsSetting.ts @@ -0,0 +1,15 @@ +import { ChartColorSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; +import { IconColorSwatch } from 'twenty-ui/display'; + +export const COLORS_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconColorSwatch, + label: CHART_CONFIGURATION_SETTING_LABELS.COLORS, + id: CHART_CONFIGURATION_SETTING_IDS.COLORS, + DropdownContent: ChartColorSelectionDropdownContent, + dropdownWidth: GenericDropdownContentWidth.ExtraLarge, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/CumulativeSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/CumulativeSetting.ts new file mode 100644 index 0000000000..684fae2d90 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/CumulativeSetting.ts @@ -0,0 +1,11 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconChartBarPopular } from 'twenty-ui/display'; + +export const CUMULATIVE_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconChartBarPopular, + label: CHART_CONFIGURATION_SETTING_LABELS.CUMULATIVE, + id: CHART_CONFIGURATION_SETTING_IDS.CUMULATIVE, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayAggregateSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayAggregateSetting.ts new file mode 100644 index 0000000000..fe6336e56a --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayAggregateSetting.ts @@ -0,0 +1,14 @@ +import { ChartFieldSelectionForAggregateOperationDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconSum } from 'twenty-ui/display'; + +export const DATA_DISPLAY_AGGREGATE_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconSum, + label: CHART_CONFIGURATION_SETTING_LABELS.DATA_ON_DISPLAY_AGGREGATE, + id: CHART_CONFIGURATION_SETTING_IDS.DATA_ON_DISPLAY_AGGREGATE, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], + DropdownContent: ChartFieldSelectionForAggregateOperationDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayPieChartSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayPieChartSetting.ts new file mode 100644 index 0000000000..140d03eb26 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayPieChartSetting.ts @@ -0,0 +1,14 @@ +import { ChartPieFieldSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartPieFieldSelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconChartPie } from 'twenty-ui/display'; + +export const DATA_DISPLAY_PIE_CHART_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconChartPie, + label: CHART_CONFIGURATION_SETTING_LABELS.DATA_ON_DISPLAY_PIE_CHART, + id: CHART_CONFIGURATION_SETTING_IDS.DATA_ON_DISPLAY_PIE_CHART, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], + DropdownContent: ChartPieFieldSelectionDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayXSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayXSetting.ts new file mode 100644 index 0000000000..0c4190f1e5 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayXSetting.ts @@ -0,0 +1,14 @@ +import { ChartXAxisFieldSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartXAxisFieldSelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconAxisX } from 'twenty-ui/display'; + +export const DATA_DISPLAY_X_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconAxisX, + label: CHART_CONFIGURATION_SETTING_LABELS.DATA_ON_DISPLAY_X, + id: CHART_CONFIGURATION_SETTING_IDS.DATA_ON_DISPLAY_X, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], + DropdownContent: ChartXAxisFieldSelectionDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayYSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayYSetting.ts new file mode 100644 index 0000000000..241c580970 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataDisplayYSetting.ts @@ -0,0 +1,14 @@ +import { ChartFieldSelectionForAggregateOperationDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconAxisY } from 'twenty-ui/display'; + +export const DATA_DISPLAY_Y_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconAxisY, + label: CHART_CONFIGURATION_SETTING_LABELS.DATA_ON_DISPLAY_Y, + id: CHART_CONFIGURATION_SETTING_IDS.DATA_ON_DISPLAY_Y, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], + DropdownContent: ChartFieldSelectionForAggregateOperationDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataLabelsSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataLabelsSetting.ts new file mode 100644 index 0000000000..c9f4acf9f3 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DataLabelsSetting.ts @@ -0,0 +1,11 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconBadge2k } from 'twenty-ui/display'; + +export const DATA_LABELS_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconBadge2k, + label: CHART_CONFIGURATION_SETTING_LABELS.DATA_LABELS, + id: CHART_CONFIGURATION_SETTING_IDS.DATA_LABELS, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularitySetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularitySetting.ts new file mode 100644 index 0000000000..6b1710f7a9 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularitySetting.ts @@ -0,0 +1,13 @@ +import { ChartDateGranularitySelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconCalendar } from 'twenty-ui/display'; + +export const DATE_GRANULARITY_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconCalendar, + label: CHART_CONFIGURATION_SETTING_LABELS.DATE_GRANULARITY, + id: CHART_CONFIGURATION_SETTING_IDS.DATE_GRANULARITY, + DropdownContent: ChartDateGranularitySelectionDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularityXSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularityXSetting.ts similarity index 50% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularityXSetting.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularityXSetting.ts index b2b41b0344..6e1a3b7696 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularityXSetting.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularityXSetting.ts @@ -1,7 +1,7 @@ -import { ChartDateGranularityXSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularityXSelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; +import { ChartDateGranularityXSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularityXSelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; import { IconCalendar } from 'twenty-ui/display'; export const DATE_GRANULARITY_X_SETTING: ChartSettingsItem = { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularityYSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularityYSetting.ts similarity index 50% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularityYSetting.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularityYSetting.ts index c45aaf57a8..e7170b34bd 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/DateGranularityYSetting.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/DateGranularityYSetting.ts @@ -1,7 +1,7 @@ -import { ChartDateGranularityYSelectionDropdownContent } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularityYSelectionDropdownContent'; -import { CHART_CONFIGURATION_SETTING_LABELS } from '@/command-menu/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; +import { ChartDateGranularityYSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartDateGranularityYSelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; import { IconCalendar } from 'twenty-ui/display'; export const DATE_GRANULARITY_Y_SETTING: ChartSettingsItem = { diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/EachSliceRepresentsSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/EachSliceRepresentsSetting.ts new file mode 100644 index 0000000000..40955d2a13 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/EachSliceRepresentsSetting.ts @@ -0,0 +1,13 @@ +import { ChartFieldSelectionForAggregateOperationDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconChartPie } from 'twenty-ui/display'; + +export const EACH_SLICE_REPRESENTS_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconChartPie, + label: CHART_CONFIGURATION_SETTING_LABELS.EACH_SLICE_REPRESENTS, + id: CHART_CONFIGURATION_SETTING_IDS.EACH_SLICE_REPRESENTS, + DropdownContent: ChartFieldSelectionForAggregateOperationDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/FilterSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/FilterSetting.ts new file mode 100644 index 0000000000..2d0b614920 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/FilterSetting.ts @@ -0,0 +1,12 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconFilter } from 'twenty-ui/display'; + +export const FILTER_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconFilter, + label: CHART_CONFIGURATION_SETTING_LABELS.FILTER, + id: CHART_CONFIGURATION_SETTING_IDS.FILTER, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/GroupBySetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/GroupBySetting.ts new file mode 100644 index 0000000000..72b99f54a8 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/GroupBySetting.ts @@ -0,0 +1,14 @@ +import { ChartGroupByFieldSelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconFilters } from 'twenty-ui/display'; + +export const GROUP_BY_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconFilters, + label: CHART_CONFIGURATION_SETTING_LABELS.GROUP_BY, + id: CHART_CONFIGURATION_SETTING_IDS.GROUP_BY, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.SOURCE], + DropdownContent: ChartGroupByFieldSelectionDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/HideEmptyCategorySetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/HideEmptyCategorySetting.ts new file mode 100644 index 0000000000..222081037a --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/HideEmptyCategorySetting.ts @@ -0,0 +1,11 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconEyeOff } from 'twenty-ui/display'; + +export const HIDE_EMPTY_CATEGORY_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconEyeOff, + label: CHART_CONFIGURATION_SETTING_LABELS.HIDE_EMPTY_CATEGORY, + id: CHART_CONFIGURATION_SETTING_IDS.HIDE_EMPTY_CATEGORY, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/OmitNullValuesSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/OmitNullValuesSetting.ts new file mode 100644 index 0000000000..76f838b9fb --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/OmitNullValuesSetting.ts @@ -0,0 +1,11 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconEyeOff } from 'twenty-ui/display'; + +export const OMIT_NULL_VALUES_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconEyeOff, + label: CHART_CONFIGURATION_SETTING_LABELS.OMIT_NULL_VALUES, + id: CHART_CONFIGURATION_SETTING_IDS.OMIT_NULL_VALUES, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/PrefixSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/PrefixSetting.ts new file mode 100644 index 0000000000..7450a78c4b --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/PrefixSetting.ts @@ -0,0 +1,14 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { msg } from '@lingui/core/macro'; +import { IconCaretLeft } from 'twenty-ui/display'; + +export const PREFIX_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconCaretLeft, + label: CHART_CONFIGURATION_SETTING_LABELS.PREFIX, + id: CHART_CONFIGURATION_SETTING_IDS.PREFIX, + isTextInput: true, + inputPlaceholder: msg`unit`, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/PrimarySortBySetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/PrimarySortBySetting.ts new file mode 100644 index 0000000000..9111dcd06d --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/PrimarySortBySetting.ts @@ -0,0 +1,13 @@ +import { ChartSortBySelectionDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconArrowsSort } from 'twenty-ui/display'; + +export const PRIMARY_SORT_BY_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconArrowsSort, + label: CHART_CONFIGURATION_SETTING_LABELS.PRIMARY_SORT_BY, + id: CHART_CONFIGURATION_SETTING_IDS.PRIMARY_SORT_BY, + DropdownContent: ChartSortBySelectionDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/RangeMaxSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/RangeMaxSetting.ts new file mode 100644 index 0000000000..60abecc6a6 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/RangeMaxSetting.ts @@ -0,0 +1,14 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { msg } from '@lingui/core/macro'; +import { IconMathMax } from 'twenty-ui/display'; + +export const RANGE_MAX_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconMathMax, + label: CHART_CONFIGURATION_SETTING_LABELS.MAX_RANGE, + id: CHART_CONFIGURATION_SETTING_IDS.MAX_RANGE, + isNumberInput: true, + inputPlaceholder: msg`Max`, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/RangeMinSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/RangeMinSetting.ts new file mode 100644 index 0000000000..6e920816cd --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/RangeMinSetting.ts @@ -0,0 +1,14 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { msg } from '@lingui/core/macro'; +import { IconMathMin } from 'twenty-ui/display'; + +export const RANGE_MIN_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconMathMin, + label: CHART_CONFIGURATION_SETTING_LABELS.MIN_RANGE, + id: CHART_CONFIGURATION_SETTING_IDS.MIN_RANGE, + isNumberInput: true, + inputPlaceholder: msg`Min`, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ShowLegendSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ShowLegendSetting.ts new file mode 100644 index 0000000000..3f26ab9b04 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/ShowLegendSetting.ts @@ -0,0 +1,12 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconTextCaption } from 'twenty-ui/display'; + +export const SHOW_LEGEND_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconTextCaption, + label: CHART_CONFIGURATION_SETTING_LABELS.SHOW_LEGEND, + id: CHART_CONFIGURATION_SETTING_IDS.SHOW_LEGEND, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.GROUP_BY], +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SortByGroupByFieldSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SortByGroupByFieldSetting.ts new file mode 100644 index 0000000000..394dda0b54 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SortByGroupByFieldSetting.ts @@ -0,0 +1,14 @@ +import { ChartSortByGroupByFieldDropdownContent } from '@/side-panel/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent'; +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconArrowsSort } from 'twenty-ui/display'; + +export const SORT_BY_GROUP_BY_FIELD_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconArrowsSort, + label: CHART_CONFIGURATION_SETTING_LABELS.SORT_BY_GROUP_BY_FIELD, + id: CHART_CONFIGURATION_SETTING_IDS.SORT_BY_GROUP_BY_FIELD, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.GROUP_BY], + DropdownContent: ChartSortByGroupByFieldDropdownContent, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting.ts new file mode 100644 index 0000000000..ec61c4ad03 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting.ts @@ -0,0 +1,11 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconArrowsSplit2 } from 'twenty-ui/display'; + +export const SPLIT_MULTI_VALUE_FIELDS_X_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconArrowsSplit2, + label: CHART_CONFIGURATION_SETTING_LABELS.SPLIT_MULTI_VALUE_FIELDS_X, + id: CHART_CONFIGURATION_SETTING_IDS.SPLIT_MULTI_VALUE_FIELDS_X, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting.ts new file mode 100644 index 0000000000..a7e6f66ff4 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting.ts @@ -0,0 +1,11 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconArrowsSplit2 } from 'twenty-ui/display'; + +export const SPLIT_MULTI_VALUE_FIELDS_Y_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconArrowsSplit2, + label: CHART_CONFIGURATION_SETTING_LABELS.SPLIT_MULTI_VALUE_FIELDS_Y, + id: CHART_CONFIGURATION_SETTING_IDS.SPLIT_MULTI_VALUE_FIELDS_Y, +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/StackedBarsSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/StackedBarsSetting.ts new file mode 100644 index 0000000000..50298477a9 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/StackedBarsSetting.ts @@ -0,0 +1,12 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconStack2 } from 'twenty-ui/display'; + +export const STACKED_BARS_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconStack2, + label: CHART_CONFIGURATION_SETTING_LABELS.STACKED_BARS, + id: CHART_CONFIGURATION_SETTING_IDS.STACKED_BARS, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.GROUP_BY], +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/StackedLineSettings.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/StackedLineSettings.ts new file mode 100644 index 0000000000..20c82a5885 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/StackedLineSettings.ts @@ -0,0 +1,12 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconStack2 } from 'twenty-ui/display'; + +export const STACKED_LINES_SETTING: ChartSettingsItem = { + isBoolean: true, + Icon: IconStack2, + label: CHART_CONFIGURATION_SETTING_LABELS.STACKED_LINES, + id: CHART_CONFIGURATION_SETTING_IDS.STACKED_LINES, + dependsOn: [CHART_CONFIGURATION_SETTING_IDS.GROUP_BY], +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SuffixSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SuffixSetting.ts new file mode 100644 index 0000000000..6f609f8a3d --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/SuffixSetting.ts @@ -0,0 +1,14 @@ +import { CHART_CONFIGURATION_SETTING_LABELS } from '@/side-panel/pages/page-layout/constants/settings/ChartConfigurationSettingLabels'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { msg } from '@lingui/core/macro'; +import { IconCaretRight } from 'twenty-ui/display'; + +export const SUFFIX_SETTING: ChartSettingsItem = { + isBoolean: false, + Icon: IconCaretRight, + label: CHART_CONFIGURATION_SETTING_LABELS.SUFFIX, + id: CHART_CONFIGURATION_SETTING_IDS.SUFFIX, + isTextInput: true, + inputPlaceholder: msg`unit`, +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/TabSettingsSelectableItemIds.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/TabSettingsSelectableItemIds.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/constants/settings/TabSettingsSelectableItemIds.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/constants/settings/TabSettingsSelectableItemIds.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/__tests__/useChartSettingsValues.test.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/__tests__/useChartSettingsValues.test.tsx similarity index 97% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/__tests__/useChartSettingsValues.test.tsx rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/__tests__/useChartSettingsValues.test.tsx index 61b572fc70..b918aebce0 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/__tests__/useChartSettingsValues.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/__tests__/useChartSettingsValues.test.tsx @@ -1,9 +1,9 @@ import { renderHook } from '@testing-library/react'; import { Provider as JotaiProvider } from 'jotai'; -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type TypedBarChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedBarChartConfiguration'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type TypedBarChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedBarChartConfiguration'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { @@ -15,7 +15,7 @@ import { GraphOrderBy, WidgetConfigurationType, } from '~/generated-metadata/graphql'; -import { useChartSettingsValues } from '@/command-menu/pages/page-layout/hooks/useChartSettingsValues'; +import { useChartSettingsValues } from '@/side-panel/pages/page-layout/hooks/useChartSettingsValues'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; const mockObjectMetadataItem: ObjectMetadataItem = { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useChartSettingsValues.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useChartSettingsValues.ts similarity index 93% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useChartSettingsValues.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useChartSettingsValues.ts index 6847144531..02cd207de3 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useChartSettingsValues.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useChartSettingsValues.ts @@ -1,11 +1,11 @@ -import { useGraphGroupBySortOptionLabels } from '@/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels'; -import { useGraphXSortOptionLabels } from '@/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels'; -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { getChartAxisNameDisplayOptions } from '@/command-menu/pages/page-layout/utils/getChartAxisNameDisplayOptions'; -import { getChartFilterRulesCount } from '@/command-menu/pages/page-layout/utils/getChartFilterRulesCount'; -import { getDateGranularityLabel } from '@/command-menu/pages/page-layout/utils/getDateGranularityLabel'; -import { getFieldLabelWithSubField } from '@/command-menu/pages/page-layout/utils/getFieldLabelWithSubField'; +import { useGraphGroupBySortOptionLabels } from '@/side-panel/pages/page-layout/hooks/useGraphGroupBySortOptionLabels'; +import { useGraphXSortOptionLabels } from '@/side-panel/pages/page-layout/hooks/useGraphXSortOptionLabels'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { getChartAxisNameDisplayOptions } from '@/side-panel/pages/page-layout/utils/getChartAxisNameDisplayOptions'; +import { getChartFilterRulesCount } from '@/side-panel/pages/page-layout/utils/getChartFilterRulesCount'; +import { getDateGranularityLabel } from '@/side-panel/pages/page-layout/utils/getDateGranularityLabel'; +import { getFieldLabelWithSubField } from '@/side-panel/pages/page-layout/utils/getFieldLabelWithSubField'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { getAggregateOperationLabel } from '@/object-record/record-board/record-board-column/utils/getAggregateOperationLabel'; import { convertAggregateOperationToExtendedAggregateOperation } from '@/object-record/utils/convertAggregateOperationToExtendedAggregateOperation'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts similarity index 89% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts index 32ee3a713e..640d83cb68 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts @@ -1,5 +1,5 @@ -import { getFieldLabelWithSubField } from '@/command-menu/pages/page-layout/utils/getFieldLabelWithSubField'; -import { getSortLabelSuffixForFieldType } from '@/command-menu/pages/page-layout/utils/getSortLabelSuffixForFieldType'; +import { getFieldLabelWithSubField } from '@/side-panel/pages/page-layout/utils/getFieldLabelWithSubField'; +import { getSortLabelSuffixForFieldType } from '@/side-panel/pages/page-layout/utils/getSortLabelSuffixForFieldType'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { t } from '@lingui/core/macro'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useGraphXSortOptionLabels.ts similarity index 92% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useGraphXSortOptionLabels.ts index 53a3d8e0f9..7d5fbfba62 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useGraphXSortOptionLabels.ts @@ -1,5 +1,5 @@ -import { getFieldLabelWithSubField } from '@/command-menu/pages/page-layout/utils/getFieldLabelWithSubField'; -import { getSortLabelSuffixForFieldType } from '@/command-menu/pages/page-layout/utils/getSortLabelSuffixForFieldType'; +import { getFieldLabelWithSubField } from '@/side-panel/pages/page-layout/utils/getFieldLabelWithSubField'; +import { getSortLabelSuffixForFieldType } from '@/side-panel/pages/page-layout/utils/getSortLabelSuffixForFieldType'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { getAggregateOperationLabel } from '@/object-record/record-board/record-board-column/utils/getAggregateOperationLabel'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel.ts new file mode 100644 index 0000000000..1e5161228f --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useNavigatePageLayoutSidePanel.ts @@ -0,0 +1,46 @@ +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { type PageLayoutSidePanelPage } from '@/side-panel/pages/page-layout/types/PageLayoutSidePanelPage'; +import { getPageLayoutIcon } from '@/side-panel/pages/page-layout/utils/getPageLayoutIcon'; +import { getPageLayoutPageTitle } from '@/side-panel/pages/page-layout/utils/getPageLayoutPageTitle'; +import { useCallback } from 'react'; +import { isDefined } from 'twenty-shared/utils'; +import { type IconComponent } from 'twenty-ui/display'; + +type NavigatePageLayoutSidePanelProps = { + sidePanelPage: PageLayoutSidePanelPage; + pageTitle?: string; + pageIcon?: IconComponent; + focusTitleInput?: boolean; + resetNavigationStack?: boolean; +}; + +export const useNavigatePageLayoutSidePanel = () => { + const { navigateSidePanel } = useNavigateSidePanel(); + + const navigatePageLayoutSidePanel = useCallback( + ({ + sidePanelPage, + pageTitle, + pageIcon, + focusTitleInput = false, + resetNavigationStack = false, + }: NavigatePageLayoutSidePanelProps) => { + navigateSidePanel({ + page: sidePanelPage, + pageTitle: isDefined(pageTitle) + ? pageTitle + : getPageLayoutPageTitle(sidePanelPage), + pageIcon: isDefined(pageIcon) + ? pageIcon + : getPageLayoutIcon(sidePanelPage), + focusTitleInput, + resetNavigationStack, + }); + }, + [navigateSidePanel], + ); + + return { + navigatePageLayoutSidePanel, + }; +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useResetChartDraftFiltersSettings.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useResetChartDraftFiltersSettings.ts similarity index 86% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useResetChartDraftFiltersSettings.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useResetChartDraftFiltersSettings.ts index 40a305c983..58065852de 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useResetChartDraftFiltersSettings.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useResetChartDraftFiltersSettings.ts @@ -1,6 +1,6 @@ -import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; -import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; -import { getChartFiltersSettingsInstanceId } from '@/command-menu/pages/page-layout/utils/getChartFiltersSettingsInstanceId'; +import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/side-panel/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord'; +import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode'; +import { getChartFiltersSettingsInstanceId } from '@/side-panel/pages/page-layout/utils/getChartFiltersSettingsInstanceId'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { hasInitializedCurrentRecordFilterGroupsComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFilterGroupsComponentFamilyState'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingInput.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingInput.ts similarity index 70% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingInput.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingInput.ts index 2d3d9e93b0..14915667af 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingInput.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingInput.ts @@ -1,5 +1,5 @@ -import { type CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { getConfigKeyFromSettingId } from '@/command-menu/pages/page-layout/utils/getConfigKeyFromSettingId'; +import { type CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { getConfigKeyFromSettingId } from '@/side-panel/pages/page-layout/utils/getConfigKeyFromSettingId'; import { useUpdateCurrentWidgetConfig } from './useUpdateCurrentWidgetConfig'; export const useUpdateChartSettingInput = (pageLayoutId: string) => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingTextInput.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingTextInput.ts similarity index 70% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingTextInput.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingTextInput.ts index 9ff5877da5..e8e9b04d34 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingTextInput.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingTextInput.ts @@ -1,5 +1,5 @@ -import { type CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { getConfigKeyFromSettingId } from '@/command-menu/pages/page-layout/utils/getConfigKeyFromSettingId'; +import { type CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { getConfigKeyFromSettingId } from '@/side-panel/pages/page-layout/utils/getConfigKeyFromSettingId'; import { useUpdateCurrentWidgetConfig } from './useUpdateCurrentWidgetConfig'; export const useUpdateChartSettingTextInput = (pageLayoutId: string) => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingToggle.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingToggle.ts similarity index 83% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingToggle.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingToggle.ts index b54662f4f7..b47a824dee 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateChartSettingToggle.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateChartSettingToggle.ts @@ -1,6 +1,6 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { getConfigKeyFromSettingId } from '@/command-menu/pages/page-layout/utils/getConfigKeyFromSettingId'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { getConfigKeyFromSettingId } from '@/side-panel/pages/page-layout/utils/getConfigKeyFromSettingId'; import { BarChartGroupMode } from '~/generated-metadata/graphql'; import { useChartSettingsValues } from './useChartSettingsValues'; import { useUpdateCurrentWidgetConfig } from './useUpdateCurrentWidgetConfig'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateCurrentWidgetConfig.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts similarity index 84% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts index fdbdbc0a94..aa9717c353 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts @@ -1,12 +1,12 @@ -import { GRAPH_CONFIGURATION_TYPE_TO_CONFIG_TYPENAME } from '@/command-menu/pages/page-layout/constants/GraphConfigurationTypeToConfigTypename'; -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType'; -import { convertAggregateOperationForDateField } from '@/command-menu/pages/page-layout/utils/convertAggregateOperationForDateField'; -import { convertBarOrLineChartConfigToPieChart } from '@/command-menu/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart'; -import { convertPieChartConfigToBarOrLineChart } from '@/command-menu/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart'; -import { getConfigurationTypeFromGraphType } from '@/command-menu/pages/page-layout/utils/getConfigurationTypeFromGraphType'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; -import { isWidgetConfigurationOfTypeGraph } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph'; +import { GRAPH_CONFIGURATION_TYPE_TO_CONFIG_TYPENAME } from '@/side-panel/pages/page-layout/constants/GraphConfigurationTypeToConfigTypename'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { GraphType } from '@/side-panel/pages/page-layout/types/GraphType'; +import { convertAggregateOperationForDateField } from '@/side-panel/pages/page-layout/utils/convertAggregateOperationForDateField'; +import { convertBarOrLineChartConfigToPieChart } from '@/side-panel/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart'; +import { convertPieChartConfigToBarOrLineChart } from '@/side-panel/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart'; +import { getConfigurationTypeFromGraphType } from '@/side-panel/pages/page-layout/utils/getConfigurationTypeFromGraphType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfTypeGraph } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { pageLayoutCurrentLayoutsComponentState } from '@/page-layout/states/pageLayoutCurrentLayoutsComponentState'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useWidgetInEditMode.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useWidgetInEditMode.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useWidgetInEditMode.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/hooks/useWidgetInEditMode.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/states/hasInitializedChartFiltersComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/states/hasInitializedChartFiltersComponentState.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/states/hasInitializedChartFiltersComponentState.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/states/hasInitializedChartFiltersComponentState.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/BarLineChartConvertibleFields.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/BarLineChartConvertibleFields.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/BarLineChartConvertibleFields.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/BarLineChartConvertibleFields.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartConfiguration.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartConfiguration.ts similarity index 81% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartConfiguration.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartConfiguration.ts index ca246be4d4..cbf6807fe9 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartConfiguration.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartConfiguration.ts @@ -1,4 +1,4 @@ -import { type TypedGaugeChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedGaugeChartConfiguration'; +import { type TypedGaugeChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedGaugeChartConfiguration'; import { type TypedAggregateChartConfiguration } from './TypedAggregateChartConfiguration'; import { type TypedBarChartConfiguration } from './TypedBarChartConfiguration'; import { type TypedLineChartConfiguration } from './TypedLineChartConfiguration'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartConfigurationSettingIds.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartConfigurationSettingIds.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartConfigurationSettingIds.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartConfigurationSettingIds.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartFilters.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartFilters.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartFilters.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartFilters.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartSettingsGroup.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartSettingsGroup.ts similarity index 83% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartSettingsGroup.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartSettingsGroup.ts index 7a8a9b269d..9fe1dd2ecf 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartSettingsGroup.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartSettingsGroup.ts @@ -1,4 +1,4 @@ -import { type CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; import { type MessageDescriptor } from '@lingui/core'; import { type ComponentType } from 'react'; import { type IconComponent } from 'twenty-ui/display'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartWidget.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartWidget.ts similarity index 75% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartWidget.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartWidget.ts index 5ecb12c618..d83ec19ea2 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/ChartWidget.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartWidget.ts @@ -1,4 +1,4 @@ -import { type ChartWidgetConfiguration } from '@/command-menu/pages/page-layout/types/ChartWidgetConfiguration'; +import { type ChartWidgetConfiguration } from '@/side-panel/pages/page-layout/types/ChartWidgetConfiguration'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { type ModifiedProperties } from 'twenty-shared/types'; import { type WidgetType } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartWidgetConfiguration.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartWidgetConfiguration.ts new file mode 100644 index 0000000000..45b75bd815 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/ChartWidgetConfiguration.ts @@ -0,0 +1,12 @@ +import { type TypedAggregateChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedAggregateChartConfiguration'; +import { type TypedBarChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedBarChartConfiguration'; +import { type TypedGaugeChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedGaugeChartConfiguration'; +import { type TypedLineChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedLineChartConfiguration'; +import { type TypedPieChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedPieChartConfiguration'; + +export type ChartWidgetConfiguration = + | TypedBarChartConfiguration + | TypedGaugeChartConfiguration + | TypedLineChartConfiguration + | TypedAggregateChartConfiguration + | TypedPieChartConfiguration; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/GraphType.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/GraphType.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/GraphType.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/GraphType.ts diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/PageLayoutSidePanelPage.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/PageLayoutSidePanelPage.ts new file mode 100644 index 0000000000..f845295944 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/PageLayoutSidePanelPage.ts @@ -0,0 +1,10 @@ +import { type SidePanelPages } from 'twenty-shared/types'; + +export type PageLayoutSidePanelPage = + | SidePanelPages.PageLayoutWidgetTypeSelect + | SidePanelPages.PageLayoutGraphTypeSelect + | SidePanelPages.PageLayoutIframeSettings + | SidePanelPages.PageLayoutGraphFilter + | SidePanelPages.PageLayoutTabSettings + | SidePanelPages.PageLayoutFieldsSettings + | SidePanelPages.PageLayoutFieldsLayout; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/PieChartConvertibleFields.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/PieChartConvertibleFields.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/PieChartConvertibleFields.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/PieChartConvertibleFields.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedAggregateChartConfiguration.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedAggregateChartConfiguration.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedAggregateChartConfiguration.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedAggregateChartConfiguration.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedBarChartConfiguration.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedBarChartConfiguration.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedBarChartConfiguration.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedBarChartConfiguration.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedGaugeChartConfiguration.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedGaugeChartConfiguration.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedGaugeChartConfiguration.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedGaugeChartConfiguration.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedLineChartConfiguration.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedLineChartConfiguration.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedLineChartConfiguration.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedLineChartConfiguration.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedPieChartConfiguration.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedPieChartConfiguration.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/types/TypedPieChartConfiguration.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/types/TypedPieChartConfiguration.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/assertChartWidgetOrThrow.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/assertChartWidgetOrThrow.test.ts similarity index 93% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/assertChartWidgetOrThrow.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/assertChartWidgetOrThrow.test.ts index 91cbff87cd..465ce72a7c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/assertChartWidgetOrThrow.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/assertChartWidgetOrThrow.test.ts @@ -1,4 +1,4 @@ -import { assertChartWidgetOrThrow } from '@/command-menu/pages/page-layout/utils/assertChartWidgetOrThrow'; +import { assertChartWidgetOrThrow } from '@/side-panel/pages/page-layout/utils/assertChartWidgetOrThrow'; import { ALL_CHART_CONFIGURATIONS, createTestWidget, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/buildChartGroupByFieldConfigUpdate.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/buildChartGroupByFieldConfigUpdate.test.ts similarity index 92% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/buildChartGroupByFieldConfigUpdate.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/buildChartGroupByFieldConfigUpdate.test.ts index 2e4dcfe7c5..38720b12ca 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/buildChartGroupByFieldConfigUpdate.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/buildChartGroupByFieldConfigUpdate.test.ts @@ -1,7 +1,7 @@ -import { type TypedBarChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedBarChartConfiguration'; -import { type TypedLineChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedLineChartConfiguration'; -import { type TypedPieChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedPieChartConfiguration'; -import { buildChartGroupByFieldConfigUpdate } from '@/command-menu/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate'; +import { type TypedBarChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedBarChartConfiguration'; +import { type TypedLineChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedLineChartConfiguration'; +import { type TypedPieChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedPieChartConfiguration'; +import { buildChartGroupByFieldConfigUpdate } from '@/side-panel/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { FieldMetadataType, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertAggregateOperationForDateField.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertAggregateOperationForDateField.test.ts similarity index 93% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertAggregateOperationForDateField.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertAggregateOperationForDateField.test.ts index e2c69d3a21..26385be5df 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertAggregateOperationForDateField.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertAggregateOperationForDateField.test.ts @@ -1,5 +1,5 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { convertAggregateOperationForDateField } from '@/command-menu/pages/page-layout/utils/convertAggregateOperationForDateField'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { convertAggregateOperationForDateField } from '@/side-panel/pages/page-layout/utils/convertAggregateOperationForDateField'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations'; import { FieldMetadataType } from 'twenty-shared/types'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertBarOrLineChartConfigToPieChart.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertBarOrLineChartConfigToPieChart.test.ts similarity index 93% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertBarOrLineChartConfigToPieChart.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertBarOrLineChartConfigToPieChart.test.ts index bf5adb294d..f019cb205f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertBarOrLineChartConfigToPieChart.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertBarOrLineChartConfigToPieChart.test.ts @@ -1,4 +1,4 @@ -import { convertBarOrLineChartConfigToPieChart } from '@/command-menu/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart'; +import { convertBarOrLineChartConfigToPieChart } from '@/side-panel/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart'; import { type BarChartConfiguration } from '~/generated-metadata/graphql'; import { TEST_BAR_CHART_CONFIGURATION, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertPieChartConfigToBarOrLineChart.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertPieChartConfigToBarOrLineChart.test.ts similarity index 93% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertPieChartConfigToBarOrLineChart.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertPieChartConfigToBarOrLineChart.test.ts index 8c9a6c3340..851608f666 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/convertPieChartConfigToBarOrLineChart.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/convertPieChartConfigToBarOrLineChart.test.ts @@ -1,4 +1,4 @@ -import { convertPieChartConfigToBarOrLineChart } from '@/command-menu/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart'; +import { convertPieChartConfigToBarOrLineChart } from '@/side-panel/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart'; import { type PieChartConfiguration } from '~/generated-metadata/graphql'; import { TEST_BAR_CHART_CONFIGURATION, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/filterSortOptionsByFieldType.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/filterSortOptionsByFieldType.test.ts similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/filterSortOptionsByFieldType.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/filterSortOptionsByFieldType.test.ts index a7084e721c..7c6af64b79 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/filterSortOptionsByFieldType.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/filterSortOptionsByFieldType.test.ts @@ -1,6 +1,6 @@ import { FieldMetadataType } from 'twenty-shared/types'; -import { filterSortOptionsByFieldType } from '@/command-menu/pages/page-layout/utils/filterSortOptionsByFieldType'; +import { filterSortOptionsByFieldType } from '@/side-panel/pages/page-layout/utils/filterSortOptionsByFieldType'; import { GraphOrderBy } from '~/generated-metadata/graphql'; describe('filterSortOptionsByFieldType', () => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getBarChartSettings.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getBarChartSettings.test.ts similarity index 73% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getBarChartSettings.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getBarChartSettings.test.ts index 5baef20e04..951fa427ee 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getBarChartSettings.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getBarChartSettings.test.ts @@ -1,23 +1,23 @@ -import { CHART_SETTINGS_HEADINGS } from '@/command-menu/pages/page-layout/constants/ChartSettingsHeadings'; -import { AXIS_NAME_SETTING } from '@/command-menu/pages/page-layout/constants/settings/AxisNameSetting'; -import { CHART_DATA_SOURCE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ChartDataSourceSetting'; -import { COLORS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ColorsSetting'; -import { CUMULATIVE_SETTING } from '@/command-menu/pages/page-layout/constants/settings/CumulativeSetting'; -import { DATA_DISPLAY_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataDisplayXSetting'; -import { DATA_DISPLAY_Y_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataDisplayYSetting'; -import { DATA_LABELS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DataLabelsSetting'; -import { DATE_GRANULARITY_X_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DateGranularityXSetting'; -import { DATE_GRANULARITY_Y_SETTING } from '@/command-menu/pages/page-layout/constants/settings/DateGranularityYSetting'; -import { FILTER_SETTING } from '@/command-menu/pages/page-layout/constants/settings/FilterSetting'; -import { GROUP_BY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/GroupBySetting'; -import { OMIT_NULL_VALUES_SETTING } from '@/command-menu/pages/page-layout/constants/settings/OmitNullValuesSetting'; -import { PRIMARY_SORT_BY_SETTING } from '@/command-menu/pages/page-layout/constants/settings/PrimarySortBySetting'; -import { RANGE_MAX_SETTING } from '@/command-menu/pages/page-layout/constants/settings/RangeMaxSetting'; -import { RANGE_MIN_SETTING } from '@/command-menu/pages/page-layout/constants/settings/RangeMinSetting'; -import { SHOW_LEGEND_SETTING } from '@/command-menu/pages/page-layout/constants/settings/ShowLegendSetting'; -import { SORT_BY_GROUP_BY_FIELD_SETTING } from '@/command-menu/pages/page-layout/constants/settings/SortByGroupByFieldSetting'; -import { STACKED_BARS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/StackedBarsSetting'; -import { getBarChartSettings } from '@/command-menu/pages/page-layout/utils/getBarChartSettings'; +import { CHART_SETTINGS_HEADINGS } from '@/side-panel/pages/page-layout/constants/ChartSettingsHeadings'; +import { AXIS_NAME_SETTING } from '@/side-panel/pages/page-layout/constants/settings/AxisNameSetting'; +import { CHART_DATA_SOURCE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting'; +import { COLORS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ColorsSetting'; +import { CUMULATIVE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/CumulativeSetting'; +import { DATA_DISPLAY_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataDisplayXSetting'; +import { DATA_DISPLAY_Y_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataDisplayYSetting'; +import { DATA_LABELS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataLabelsSetting'; +import { DATE_GRANULARITY_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DateGranularityXSetting'; +import { DATE_GRANULARITY_Y_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DateGranularityYSetting'; +import { FILTER_SETTING } from '@/side-panel/pages/page-layout/constants/settings/FilterSetting'; +import { GROUP_BY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/GroupBySetting'; +import { OMIT_NULL_VALUES_SETTING } from '@/side-panel/pages/page-layout/constants/settings/OmitNullValuesSetting'; +import { PRIMARY_SORT_BY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/PrimarySortBySetting'; +import { RANGE_MAX_SETTING } from '@/side-panel/pages/page-layout/constants/settings/RangeMaxSetting'; +import { RANGE_MIN_SETTING } from '@/side-panel/pages/page-layout/constants/settings/RangeMinSetting'; +import { SHOW_LEGEND_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ShowLegendSetting'; +import { SORT_BY_GROUP_BY_FIELD_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SortByGroupByFieldSetting'; +import { STACKED_BARS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/StackedBarsSetting'; +import { getBarChartSettings } from '@/side-panel/pages/page-layout/utils/getBarChartSettings'; import { IconAxisX, IconAxisY } from 'twenty-ui/display'; import { BarChartLayout } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartDefaultOrderByForFieldType.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartDefaultOrderByForFieldType.test.ts similarity index 89% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartDefaultOrderByForFieldType.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartDefaultOrderByForFieldType.test.ts index 6a70f7b12f..a40754c83c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartDefaultOrderByForFieldType.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartDefaultOrderByForFieldType.test.ts @@ -1,6 +1,6 @@ import { FieldMetadataType } from 'twenty-shared/types'; -import { getChartDefaultOrderByForFieldType } from '@/command-menu/pages/page-layout/utils/getChartDefaultOrderByForFieldType'; +import { getChartDefaultOrderByForFieldType } from '@/side-panel/pages/page-layout/utils/getChartDefaultOrderByForFieldType'; import { GraphOrderBy } from '~/generated-metadata/graphql'; describe('getChartDefaultOrderByForFieldType', () => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartFilterRulesCount.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartFilterRulesCount.test.ts similarity index 87% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartFilterRulesCount.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartFilterRulesCount.test.ts index 1cec14447a..709bd9b5fe 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartFilterRulesCount.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartFilterRulesCount.test.ts @@ -1,5 +1,5 @@ -import { type ChartFilters } from '@/command-menu/pages/page-layout/types/ChartFilters'; -import { getChartFilterRulesCount } from '@/command-menu/pages/page-layout/utils/getChartFilterRulesCount'; +import { type ChartFilters } from '@/side-panel/pages/page-layout/types/ChartFilters'; +import { getChartFilterRulesCount } from '@/side-panel/pages/page-layout/utils/getChartFilterRulesCount'; describe('getChartFilterRulesCount', () => { it('should return 0 for undefined filter', () => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartLimitMessage.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartLimitMessage.test.ts similarity index 95% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartLimitMessage.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartLimitMessage.test.ts index 04fb4228f9..876cb6ac53 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getChartLimitMessage.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getChartLimitMessage.test.ts @@ -1,4 +1,4 @@ -import { getChartLimitMessage } from '@/command-menu/pages/page-layout/utils/getChartLimitMessage'; +import { getChartLimitMessage } from '@/side-panel/pages/page-layout/utils/getChartLimitMessage'; import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types'; import { WidgetConfigurationType } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getConfigurationTypeFromGraphType.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getConfigurationTypeFromGraphType.test.ts similarity index 87% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getConfigurationTypeFromGraphType.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getConfigurationTypeFromGraphType.test.ts index ceda91f3f1..be32e0af2c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getConfigurationTypeFromGraphType.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getConfigurationTypeFromGraphType.test.ts @@ -1,5 +1,5 @@ -import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType'; -import { getConfigurationTypeFromGraphType } from '@/command-menu/pages/page-layout/utils/getConfigurationTypeFromGraphType'; +import { GraphType } from '@/side-panel/pages/page-layout/types/GraphType'; +import { getConfigurationTypeFromGraphType } from '@/side-panel/pages/page-layout/utils/getConfigurationTypeFromGraphType'; import { WidgetConfigurationType } from '~/generated-metadata/graphql'; describe('getConfigurationTypeFromGraphType', () => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getCurrentGraphTypeFromConfig.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getCurrentGraphTypeFromConfig.test.ts similarity index 86% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getCurrentGraphTypeFromConfig.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getCurrentGraphTypeFromConfig.test.ts index 95c1edbb2b..ca0fe00d2f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getCurrentGraphTypeFromConfig.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getCurrentGraphTypeFromConfig.test.ts @@ -1,6 +1,6 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType'; -import { getCurrentGraphTypeFromConfig } from '@/command-menu/pages/page-layout/utils/getCurrentGraphTypeFromConfig'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { GraphType } from '@/side-panel/pages/page-layout/types/GraphType'; +import { getCurrentGraphTypeFromConfig } from '@/side-panel/pages/page-layout/utils/getCurrentGraphTypeFromConfig'; import { TEST_AGGREGATE_CHART_CONFIGURATION, TEST_BAR_CHART_CONFIGURATION, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getDateGranularityPluralLabel.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getDateGranularityPluralLabel.test.ts similarity index 93% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getDateGranularityPluralLabel.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getDateGranularityPluralLabel.test.ts index 144a979acb..d24b4da884 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getDateGranularityPluralLabel.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getDateGranularityPluralLabel.test.ts @@ -1,4 +1,4 @@ -import { getDateGranularityPluralLabel } from '@/command-menu/pages/page-layout/utils/getDateGranularityPluralLabel'; +import { getDateGranularityPluralLabel } from '@/side-panel/pages/page-layout/utils/getDateGranularityPluralLabel'; import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types'; describe('getDateGranularityPluralLabel', () => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getDefaultManualSortOrder.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getDefaultManualSortOrder.test.ts similarity index 87% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getDefaultManualSortOrder.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getDefaultManualSortOrder.test.ts index bf973b9d52..1fbaf06766 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getDefaultManualSortOrder.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getDefaultManualSortOrder.test.ts @@ -1,4 +1,4 @@ -import { getDefaultManualSortOrder } from '@/command-menu/pages/page-layout/utils/getDefaultManualSortOrder'; +import { getDefaultManualSortOrder } from '@/side-panel/pages/page-layout/utils/getDefaultManualSortOrder'; describe('getDefaultManualSortOrder', () => { it('should return empty array for null options', () => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getManualSortOrderFromConfig.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getManualSortOrderFromConfig.test.ts similarity index 96% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getManualSortOrderFromConfig.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getManualSortOrderFromConfig.test.ts index 98d637a9e4..8698f2d203 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getManualSortOrderFromConfig.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getManualSortOrderFromConfig.test.ts @@ -1,4 +1,4 @@ -import { getManualSortOrderFromConfig } from '@/command-menu/pages/page-layout/utils/getManualSortOrderFromConfig'; +import { getManualSortOrderFromConfig } from '@/side-panel/pages/page-layout/utils/getManualSortOrderFromConfig'; import { WidgetConfigurationType, type BarChartConfiguration, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getSortIconForFieldType.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getSortIconForFieldType.test.ts similarity index 98% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getSortIconForFieldType.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getSortIconForFieldType.test.ts index 4c9e2e8e78..db1429ad85 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getSortIconForFieldType.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getSortIconForFieldType.test.ts @@ -8,7 +8,7 @@ import { IconSortDescendingNumbers, } from 'twenty-ui/display'; -import { getSortIconForFieldType } from '@/command-menu/pages/page-layout/utils/getSortIconForFieldType'; +import { getSortIconForFieldType } from '@/side-panel/pages/page-layout/utils/getSortIconForFieldType'; import { GraphOrderBy } from '~/generated-metadata/graphql'; describe('getSortIconForFieldType', () => { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getSortLabelSuffixForFieldType.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getSortLabelSuffixForFieldType.test.ts similarity index 88% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getSortLabelSuffixForFieldType.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getSortLabelSuffixForFieldType.test.ts index 2ae9c01073..3be9a8544e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/getSortLabelSuffixForFieldType.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/getSortLabelSuffixForFieldType.test.ts @@ -1,4 +1,4 @@ -import { getSortLabelSuffixForFieldType } from '@/command-menu/pages/page-layout/utils/getSortLabelSuffixForFieldType'; +import { getSortLabelSuffixForFieldType } from '@/side-panel/pages/page-layout/utils/getSortLabelSuffixForFieldType'; import { FieldMetadataType } from 'twenty-shared/types'; import { GraphOrderBy } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isChartWidget.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isChartWidget.test.ts similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isChartWidget.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isChartWidget.test.ts index 6e0fb86064..0be16cb000 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isChartWidget.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isChartWidget.test.ts @@ -1,4 +1,4 @@ -import { isChartWidget } from '@/command-menu/pages/page-layout/utils/isChartWidget'; +import { isChartWidget } from '@/side-panel/pages/page-layout/utils/isChartWidget'; import { createTestWidget, TEST_BAR_CHART_CONFIGURATION, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isFieldOrNestedFieldDateKind.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isFieldOrNestedFieldDateKind.test.ts similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isFieldOrNestedFieldDateKind.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isFieldOrNestedFieldDateKind.test.ts index 8d8b4f0cc2..c3c2e6dd76 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isFieldOrNestedFieldDateKind.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isFieldOrNestedFieldDateKind.test.ts @@ -1,4 +1,4 @@ -import { isFieldOrRelationNestedFieldDateKind } from '@/command-menu/pages/page-layout/utils/isFieldOrNestedFieldDateKind'; +import { isFieldOrRelationNestedFieldDateKind } from '@/side-panel/pages/page-layout/utils/isFieldOrNestedFieldDateKind'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { FieldMetadataType } from 'twenty-shared/types'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isMinMaxRangeValid.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isMinMaxRangeValid.test.ts similarity index 95% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isMinMaxRangeValid.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isMinMaxRangeValid.test.ts index 283e3a6ef6..1f1e06c8f3 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isMinMaxRangeValid.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isMinMaxRangeValid.test.ts @@ -1,6 +1,6 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { isMinMaxRangeValid } from '@/command-menu/pages/page-layout/utils/isMinMaxRangeValid'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { isMinMaxRangeValid } from '@/side-panel/pages/page-layout/utils/isMinMaxRangeValid'; import { BarChartLayout, WidgetConfigurationType, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isWidgetConfigurationOfType.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isWidgetConfigurationOfType.test.ts similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isWidgetConfigurationOfType.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isWidgetConfigurationOfType.test.ts index 924c6d001f..1679184886 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isWidgetConfigurationOfType.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isWidgetConfigurationOfType.test.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { ALL_CHART_CONFIGURATIONS, TEST_BAR_CHART_CONFIGURATION, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isWidgetConfigurationOfTypeGraph.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isWidgetConfigurationOfTypeGraph.test.ts similarity index 90% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isWidgetConfigurationOfTypeGraph.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isWidgetConfigurationOfTypeGraph.test.ts index 99d63c897a..cdd5474fa0 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/isWidgetConfigurationOfTypeGraph.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/isWidgetConfigurationOfTypeGraph.test.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfTypeGraph } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph'; +import { isWidgetConfigurationOfTypeGraph } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph'; import { ALL_CHART_CONFIGURATIONS, TEST_FIELDS_CONFIGURATION, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/shouldHideChartSetting.test.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/shouldHideChartSetting.test.ts similarity index 97% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/shouldHideChartSetting.test.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/shouldHideChartSetting.test.ts index ff614f657b..7309b76ba7 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/__tests__/shouldHideChartSetting.test.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/__tests__/shouldHideChartSetting.test.ts @@ -1,7 +1,7 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { shouldHideChartSetting } from '@/command-menu/pages/page-layout/utils/shouldHideChartSetting'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { shouldHideChartSetting } from '@/side-panel/pages/page-layout/utils/shouldHideChartSetting'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { msg } from '@lingui/core/macro'; import { FieldMetadataType } from 'twenty-shared/types'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/assertChartWidgetOrThrow.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/assertChartWidgetOrThrow.ts similarity index 92% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/assertChartWidgetOrThrow.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/assertChartWidgetOrThrow.ts index 01f5eeca27..9c18262ff1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/assertChartWidgetOrThrow.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/assertChartWidgetOrThrow.ts @@ -1,4 +1,4 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { isNonEmptyString } from '@sniptt/guards'; import { assertIsDefinedOrThrow } from 'twenty-shared/utils'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate.ts similarity index 91% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate.ts index 41f97db084..2eed1c8c8e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate.ts @@ -1,7 +1,7 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { getChartDefaultOrderByForFieldType } from '@/command-menu/pages/page-layout/utils/getChartDefaultOrderByForFieldType'; -import { isFieldOrRelationNestedFieldDateKind } from '@/command-menu/pages/page-layout/utils/isFieldOrNestedFieldDateKind'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { getChartDefaultOrderByForFieldType } from '@/side-panel/pages/page-layout/utils/getChartDefaultOrderByForFieldType'; +import { isFieldOrRelationNestedFieldDateKind } from '@/side-panel/pages/page-layout/utils/isFieldOrNestedFieldDateKind'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types'; import { isDefined, isFieldMetadataArrayKind } from 'twenty-shared/utils'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertAggregateOperationForDateField.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertAggregateOperationForDateField.ts similarity index 91% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertAggregateOperationForDateField.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertAggregateOperationForDateField.ts index 2b98c7a02e..8f9328c374 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertAggregateOperationForDateField.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertAggregateOperationForDateField.ts @@ -1,4 +1,4 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations'; import { isDefined, isFieldMetadataDateKind } from 'twenty-shared/utils'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart.ts similarity index 87% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart.ts index 0b7e76eb08..e91c3bcf3d 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart.ts @@ -1,4 +1,4 @@ -import { type PieChartConvertibleFields } from '@/command-menu/pages/page-layout/types/PieChartConvertibleFields'; +import { type PieChartConvertibleFields } from '@/side-panel/pages/page-layout/types/PieChartConvertibleFields'; import { type BarChartConfiguration, type LineChartConfiguration, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart.ts similarity index 75% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart.ts index deac52765b..b5573dad1e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart.ts @@ -1,5 +1,5 @@ -import { type BarLineChartConvertibleFields } from '@/command-menu/pages/page-layout/types/BarLineChartConvertibleFields'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { type BarLineChartConvertibleFields } from '@/side-panel/pages/page-layout/types/BarLineChartConvertibleFields'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type PieChartConfiguration } from '~/generated-metadata/graphql'; export const convertPieChartConfigToBarOrLineChart = ( diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/filterSortOptionsByFieldType.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/filterSortOptionsByFieldType.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/filterSortOptionsByFieldType.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/filterSortOptionsByFieldType.ts diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getBarChartSettings.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getBarChartSettings.ts new file mode 100644 index 0000000000..51a1a64bb1 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getBarChartSettings.ts @@ -0,0 +1,80 @@ +import { CHART_SETTINGS_HEADINGS } from '@/side-panel/pages/page-layout/constants/ChartSettingsHeadings'; +import { AXIS_NAME_SETTING } from '@/side-panel/pages/page-layout/constants/settings/AxisNameSetting'; +import { CHART_DATA_SOURCE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ChartDataSourceSetting'; +import { COLORS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ColorsSetting'; +import { CUMULATIVE_SETTING } from '@/side-panel/pages/page-layout/constants/settings/CumulativeSetting'; +import { DATA_DISPLAY_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataDisplayXSetting'; +import { DATA_DISPLAY_Y_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataDisplayYSetting'; +import { DATA_LABELS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DataLabelsSetting'; +import { DATE_GRANULARITY_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DateGranularityXSetting'; +import { DATE_GRANULARITY_Y_SETTING } from '@/side-panel/pages/page-layout/constants/settings/DateGranularityYSetting'; +import { FILTER_SETTING } from '@/side-panel/pages/page-layout/constants/settings/FilterSetting'; +import { GROUP_BY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/GroupBySetting'; +import { OMIT_NULL_VALUES_SETTING } from '@/side-panel/pages/page-layout/constants/settings/OmitNullValuesSetting'; +import { PRIMARY_SORT_BY_SETTING } from '@/side-panel/pages/page-layout/constants/settings/PrimarySortBySetting'; +import { RANGE_MAX_SETTING } from '@/side-panel/pages/page-layout/constants/settings/RangeMaxSetting'; +import { RANGE_MIN_SETTING } from '@/side-panel/pages/page-layout/constants/settings/RangeMinSetting'; +import { SHOW_LEGEND_SETTING } from '@/side-panel/pages/page-layout/constants/settings/ShowLegendSetting'; +import { SORT_BY_GROUP_BY_FIELD_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SortByGroupByFieldSetting'; +import { SPLIT_MULTI_VALUE_FIELDS_X_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsXSetting'; +import { SPLIT_MULTI_VALUE_FIELDS_Y_SETTING } from '@/side-panel/pages/page-layout/constants/settings/SplitMultiValueFieldsYSetting'; +import { STACKED_BARS_SETTING } from '@/side-panel/pages/page-layout/constants/settings/StackedBarsSetting'; +import { type ChartSettingsGroup } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { IconAxisX, IconAxisY } from 'twenty-ui/display'; +import { BarChartLayout } from '~/generated-metadata/graphql'; + +export const getBarChartSettings = ( + layout: BarChartLayout, +): ChartSettingsGroup[] => { + const isHorizontal = layout === BarChartLayout.HORIZONTAL; + + const dataDisplayXIcon = isHorizontal ? IconAxisY : IconAxisX; + const dataDisplayYIcon = isHorizontal ? IconAxisX : IconAxisY; + + const primaryAxisItems = [ + { ...DATA_DISPLAY_X_SETTING, Icon: dataDisplayXIcon }, + DATE_GRANULARITY_X_SETTING, + PRIMARY_SORT_BY_SETTING, + OMIT_NULL_VALUES_SETTING, + SPLIT_MULTI_VALUE_FIELDS_X_SETTING, + ]; + + const secondaryAxisItems = [ + { ...DATA_DISPLAY_Y_SETTING, Icon: dataDisplayYIcon }, + GROUP_BY_SETTING, + DATE_GRANULARITY_Y_SETTING, + SORT_BY_GROUP_BY_FIELD_SETTING, + CUMULATIVE_SETTING, + RANGE_MIN_SETTING, + RANGE_MAX_SETTING, + SPLIT_MULTI_VALUE_FIELDS_Y_SETTING, + ]; + + const xAxisItems = isHorizontal ? secondaryAxisItems : primaryAxisItems; + const yAxisItems = isHorizontal ? primaryAxisItems : secondaryAxisItems; + + return [ + { + heading: CHART_SETTINGS_HEADINGS.DATA, + items: [CHART_DATA_SOURCE_SETTING, FILTER_SETTING], + }, + { + heading: CHART_SETTINGS_HEADINGS.X_AXIS, + items: xAxisItems, + }, + { + heading: CHART_SETTINGS_HEADINGS.Y_AXIS, + items: yAxisItems, + }, + { + heading: CHART_SETTINGS_HEADINGS.STYLE, + items: [ + COLORS_SETTING, + AXIS_NAME_SETTING, + STACKED_BARS_SETTING, + DATA_LABELS_SETTING, + SHOW_LEGEND_SETTING, + ], + }, + ]; +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartAxisNameDisplayOptions.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartAxisNameDisplayOptions.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartAxisNameDisplayOptions.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartAxisNameDisplayOptions.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartDefaultOrderByForFieldType.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartDefaultOrderByForFieldType.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartDefaultOrderByForFieldType.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartDefaultOrderByForFieldType.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartFilterRulesCount.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartFilterRulesCount.ts similarity index 89% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartFilterRulesCount.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartFilterRulesCount.ts index da231a1a04..da13bf930f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartFilterRulesCount.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartFilterRulesCount.ts @@ -1,4 +1,4 @@ -import { type ChartFilters } from '@/command-menu/pages/page-layout/types/ChartFilters'; +import { type ChartFilters } from '@/side-panel/pages/page-layout/types/ChartFilters'; import { isDefined } from 'twenty-shared/utils'; export const getChartFilterRulesCount = ( diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartFiltersSettingsInstanceId.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartFiltersSettingsInstanceId.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartFiltersSettingsInstanceId.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartFiltersSettingsInstanceId.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartLimitMessage.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartLimitMessage.ts similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartLimitMessage.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartLimitMessage.ts index d53e2510a7..906c86d666 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getChartLimitMessage.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getChartLimitMessage.ts @@ -1,4 +1,4 @@ -import { getDateGranularityPluralLabel } from '@/command-menu/pages/page-layout/utils/getDateGranularityPluralLabel'; +import { getDateGranularityPluralLabel } from '@/side-panel/pages/page-layout/utils/getDateGranularityPluralLabel'; import { BAR_CHART_CONSTANTS } from '@/page-layout/widgets/graph/graphWidgetBarChart/constants/BarChartConstants'; import { LINE_CHART_CONSTANTS } from '@/page-layout/widgets/graph/graphWidgetLineChart/constants/LineChartConstants'; import { PIE_CHART_MAXIMUM_NUMBER_OF_SLICES } from '@/page-layout/widgets/graph/graphWidgetPieChart/constants/PieChartMaximumNumberOfSlices.constant'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getConfigKeyFromSettingId.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getConfigKeyFromSettingId.ts similarity index 84% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getConfigKeyFromSettingId.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getConfigKeyFromSettingId.ts index 50928b789b..45b7d5f280 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getConfigKeyFromSettingId.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getConfigKeyFromSettingId.ts @@ -1,7 +1,7 @@ import { type CHART_CONFIGURATION_SETTING_IDS, CHART_CONFIGURATION_SETTING_TO_CONFIG_KEY_MAP, -} from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; +} from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; export const getConfigKeyFromSettingId = ( settingId: CHART_CONFIGURATION_SETTING_IDS, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getConfigurationTypeFromGraphType.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getConfigurationTypeFromGraphType.ts similarity index 90% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getConfigurationTypeFromGraphType.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getConfigurationTypeFromGraphType.ts index 68e958ea9c..6b9404c55f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getConfigurationTypeFromGraphType.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getConfigurationTypeFromGraphType.ts @@ -1,4 +1,4 @@ -import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType'; +import { GraphType } from '@/side-panel/pages/page-layout/types/GraphType'; import { assertUnreachable } from 'twenty-shared/utils'; import { WidgetConfigurationType } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getCurrentGraphTypeFromConfig.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getCurrentGraphTypeFromConfig.ts similarity index 76% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getCurrentGraphTypeFromConfig.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getCurrentGraphTypeFromConfig.ts index 69cda0cce3..e24fcac5f6 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getCurrentGraphTypeFromConfig.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getCurrentGraphTypeFromConfig.ts @@ -1,6 +1,6 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { GraphType } from '@/side-panel/pages/page-layout/types/GraphType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { t } from '@lingui/core/macro'; import { BarChartLayout } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getDateGranularityLabel.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getDateGranularityLabel.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getDateGranularityLabel.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getDateGranularityLabel.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getDateGranularityPluralLabel.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getDateGranularityPluralLabel.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getDateGranularityPluralLabel.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getDateGranularityPluralLabel.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getDefaultManualSortOrder.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getDefaultManualSortOrder.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getDefaultManualSortOrder.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getDefaultManualSortOrder.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getFieldLabelWithSubField.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getFieldLabelWithSubField.ts similarity index 93% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getFieldLabelWithSubField.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getFieldLabelWithSubField.ts index dddea9a219..c4be5e12e4 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getFieldLabelWithSubField.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getFieldLabelWithSubField.ts @@ -1,4 +1,4 @@ -import { getRelationFieldLabel } from '@/command-menu/pages/page-layout/utils/getRelationFieldLabel'; +import { getRelationFieldLabel } from '@/side-panel/pages/page-layout/utils/getRelationFieldLabel'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { getCompositeSubFieldLabel } from '@/object-record/object-filter-dropdown/utils/getCompositeSubFieldLabel'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getFrontComponentWidgetTypeSelectItemId.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getFrontComponentWidgetTypeSelectItemId.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getFrontComponentWidgetTypeSelectItemId.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getFrontComponentWidgetTypeSelectItemId.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getManualSortOrderFromConfig.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getManualSortOrderFromConfig.ts similarity index 87% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getManualSortOrderFromConfig.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getManualSortOrderFromConfig.ts index f3f9ff7960..7b9817a95f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getManualSortOrderFromConfig.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getManualSortOrderFromConfig.ts @@ -1,4 +1,4 @@ -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { isDefined } from 'twenty-shared/utils'; import { type WidgetConfiguration } from '~/generated-metadata/graphql'; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getPageLayoutIcon.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getPageLayoutIcon.ts new file mode 100644 index 0000000000..681e82cb3c --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getPageLayoutIcon.ts @@ -0,0 +1,32 @@ +import { type PageLayoutSidePanelPage } from '@/side-panel/pages/page-layout/types/PageLayoutSidePanelPage'; +import { SidePanelPages } from 'twenty-shared/types'; +import { assertUnreachable } from 'twenty-shared/utils'; +import { + IconAppWindow, + IconChartPie, + IconFilter, + IconFrame, + IconLayoutSidebarRight, + IconList, +} from 'twenty-ui/display'; + +export const getPageLayoutIcon = (page: PageLayoutSidePanelPage) => { + switch (page) { + case SidePanelPages.PageLayoutWidgetTypeSelect: + return IconAppWindow; + case SidePanelPages.PageLayoutGraphTypeSelect: + return IconChartPie; + case SidePanelPages.PageLayoutIframeSettings: + return IconFrame; + case SidePanelPages.PageLayoutGraphFilter: + return IconFilter; + case SidePanelPages.PageLayoutTabSettings: + return IconAppWindow; + case SidePanelPages.PageLayoutFieldsSettings: + return IconList; + case SidePanelPages.PageLayoutFieldsLayout: + return IconLayoutSidebarRight; + default: + assertUnreachable(page); + } +}; diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getPageLayoutPageTitle.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getPageLayoutPageTitle.ts new file mode 100644 index 0000000000..d91afd5ea1 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getPageLayoutPageTitle.ts @@ -0,0 +1,25 @@ +import { type PageLayoutSidePanelPage } from '@/side-panel/pages/page-layout/types/PageLayoutSidePanelPage'; +import { t } from '@lingui/core/macro'; +import { SidePanelPages } from 'twenty-shared/types'; +import { assertUnreachable } from 'twenty-shared/utils'; + +export const getPageLayoutPageTitle = (page: PageLayoutSidePanelPage) => { + switch (page) { + case SidePanelPages.PageLayoutWidgetTypeSelect: + return t`Add Widget`; + case SidePanelPages.PageLayoutGraphTypeSelect: + return t`Select Graph Type`; + case SidePanelPages.PageLayoutIframeSettings: + return t`iFrame Settings`; + case SidePanelPages.PageLayoutGraphFilter: + return t`Configure filters`; + case SidePanelPages.PageLayoutTabSettings: + return t`Tab Settings`; + case SidePanelPages.PageLayoutFieldsSettings: + return t`Fields Settings`; + case SidePanelPages.PageLayoutFieldsLayout: + return t`Layout`; + default: + assertUnreachable(page); + } +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getRelationFieldLabel.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getRelationFieldLabel.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getRelationFieldLabel.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getRelationFieldLabel.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getSortIconForFieldType.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getSortIconForFieldType.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getSortIconForFieldType.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getSortIconForFieldType.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getSortLabelSuffixForFieldType.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getSortLabelSuffixForFieldType.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/getSortLabelSuffixForFieldType.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/getSortLabelSuffixForFieldType.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isChartWidget.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isChartWidget.ts similarity index 55% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isChartWidget.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isChartWidget.ts index dc1b341737..aab0aa1b97 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isChartWidget.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isChartWidget.ts @@ -1,5 +1,5 @@ -import { type ChartWidget } from '@/command-menu/pages/page-layout/types/ChartWidget'; -import { isWidgetConfigurationOfTypeGraph } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph'; +import { type ChartWidget } from '@/side-panel/pages/page-layout/types/ChartWidget'; +import { isWidgetConfigurationOfTypeGraph } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; export const isChartWidget = ( diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isExistingWidgetMissingOrDifferentType.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isExistingWidgetMissingOrDifferentType.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isExistingWidgetMissingOrDifferentType.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isExistingWidgetMissingOrDifferentType.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isFieldOrNestedFieldDateKind.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isFieldOrNestedFieldDateKind.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isFieldOrNestedFieldDateKind.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isFieldOrNestedFieldDateKind.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isMinMaxRangeValid.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isMinMaxRangeValid.ts similarity index 73% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isMinMaxRangeValid.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isMinMaxRangeValid.ts index 4f7b4410d0..b14ddab6b3 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isMinMaxRangeValid.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isMinMaxRangeValid.ts @@ -1,6 +1,6 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { isDefined } from 'twenty-shared/utils'; export const isMinMaxRangeValid = ( diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph.ts similarity index 78% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph.ts index 5da5e66a8a..5ef6c0bf69 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph.ts @@ -1,5 +1,5 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type FieldConfiguration } from '@/page-layout/types/FieldConfiguration'; import { type FieldsConfiguration, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/shouldHideChartSetting.ts b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/shouldHideChartSetting.ts similarity index 92% rename from packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/shouldHideChartSetting.ts rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/shouldHideChartSetting.ts index cf50e2ef5a..b587cc344d 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/utils/shouldHideChartSetting.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/utils/shouldHideChartSetting.ts @@ -1,7 +1,7 @@ -import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration'; -import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds'; -import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup'; -import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; +import { type ChartConfiguration } from '@/side-panel/pages/page-layout/types/ChartConfiguration'; +import { CHART_CONFIGURATION_SETTING_IDS } from '@/side-panel/pages/page-layout/types/ChartConfigurationSettingIds'; +import { type ChartSettingsItem } from '@/side-panel/pages/page-layout/types/ChartSettingsGroup'; +import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation'; import { isRelationNestedFieldDateKind } from '@/page-layout/widgets/graph/utils/isRelationNestedFieldDateKind'; diff --git a/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuMergeRecordPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelMergeRecordPage.tsx similarity index 68% rename from packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuMergeRecordPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelMergeRecordPage.tsx index ebc7fa4813..e9811383ee 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuMergeRecordPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelMergeRecordPage.tsx @@ -1,5 +1,5 @@ import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; @@ -7,40 +7,40 @@ import { MergeRecordsContainer } from '@/object-record/record-merge/components/M import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext'; import { styled } from '@linaria/react'; -const StyledRightDrawerRecord = styled.div` +const StyledSidePanelRecord = styled.div` height: 100%; `; -export const CommandMenuMergeRecordPage = () => { - const commandMenuPageInstanceId = useComponentInstanceStateContext( - CommandMenuPageComponentInstanceContext, +export const SidePanelMergeRecordPage = () => { + const sidePanelPageInstanceId = useComponentInstanceStateContext( + SidePanelPageComponentInstanceContext, )?.instanceId; const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow( - commandMenuPageInstanceId, + sidePanelPageInstanceId, ); - if (!commandMenuPageInstanceId) { + if (!sidePanelPageInstanceId) { throw new Error('Command menu page instance id is not defined'); } return ( - + - + diff --git a/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuRecordPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelRecordPage.tsx similarity index 77% rename from packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuRecordPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelRecordPage.tsx index 080a0d8868..fda2b13be3 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuRecordPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelRecordPage.tsx @@ -1,8 +1,8 @@ import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; import { TimelineActivityContext } from '@/activities/timeline-activities/contexts/TimelineActivityContext'; -import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; -import { viewableRecordNameSingularComponentState } from '@/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { viewableRecordIdComponentState } from '@/side-panel/pages/record-page/states/viewableRecordIdComponentState'; +import { viewableRecordNameSingularComponentState } from '@/side-panel/pages/record-page/states/viewableRecordNameSingularComponentState'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { INFORMATION_BANNER_HEIGHT } from '@/information-banner/constants/InformationBannerHeight'; import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; @@ -14,7 +14,7 @@ import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/use import { styled } from '@linaria/react'; import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; -const StyledRightDrawerRecord = styled.div<{ +const StyledSidePanelRecord = styled.div<{ hasDeletedRecordBanner: boolean; }>` height: ${({ hasDeletedRecordBanner }) => { @@ -25,7 +25,7 @@ const StyledRightDrawerRecord = styled.div<{ }}; `; -export const CommandMenuRecordPage = () => { +export const SidePanelRecordPage = () => { const viewableRecordNameSingular = useAtomComponentStateValue( viewableRecordNameSingularComponentState, ); @@ -55,11 +55,11 @@ export const CommandMenuRecordPage = () => { }, ); - const commandMenuPageInstanceId = useComponentInstanceStateContext( - CommandMenuPageComponentInstanceContext, + const sidePanelPageInstanceId = useComponentInstanceStateContext( + SidePanelPageComponentInstanceContext, )?.instanceId; - if (!commandMenuPageInstanceId) { + if (!sidePanelPageInstanceId) { throw new Error('Command menu page instance id is not defined'); } @@ -69,13 +69,13 @@ export const CommandMenuRecordPage = () => { > - + { id: objectRecordId, targetObjectNameSingular: objectNameSingular, }} - isInRightDrawer + isInSidePanel /> - + diff --git a/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuUpdateMultipleRecords.tsx b/packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelUpdateMultipleRecords.tsx similarity index 58% rename from packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuUpdateMultipleRecords.tsx rename to packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelUpdateMultipleRecords.tsx index ab3d4094c5..29435489df 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuUpdateMultipleRecords.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/record-page/components/SidePanelUpdateMultipleRecords.tsx @@ -1,33 +1,33 @@ -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { UpdateMultipleRecordsContainer } from '@/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer'; import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext'; import { styled } from '@linaria/react'; -const StyledRightDrawerRecord = styled.div` +const StyledSidePanelRecord = styled.div` height: 100%; `; -export const CommandMenuUpdateMultipleRecords = () => { - const commandMenuPageInstanceId = useComponentInstanceStateContext( - CommandMenuPageComponentInstanceContext, +export const SidePanelUpdateMultipleRecords = () => { + const sidePanelPageInstanceId = useComponentInstanceStateContext( + SidePanelPageComponentInstanceContext, )?.instanceId; - if (!commandMenuPageInstanceId) { + if (!sidePanelPageInstanceId) { throw new Error('Command menu page instance id is not defined'); } const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow( - commandMenuPageInstanceId, + sidePanelPageInstanceId, ); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/side-panel/pages/record-page/states/viewableRecordIdComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/record-page/states/viewableRecordIdComponentState.ts new file mode 100644 index 0000000000..7e347752be --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/record-page/states/viewableRecordIdComponentState.ts @@ -0,0 +1,10 @@ +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; + +export const viewableRecordIdComponentState = createAtomComponentState< + string | null +>({ + key: 'side-panel/viewable-record-id', + defaultValue: null, + componentInstanceContext: SidePanelPageComponentInstanceContext, +}); diff --git a/packages/twenty-front/src/modules/side-panel/pages/record-page/states/viewableRecordNameSingularComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/record-page/states/viewableRecordNameSingularComponentState.ts new file mode 100644 index 0000000000..fb8f85cb0a --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/record-page/states/viewableRecordNameSingularComponentState.ts @@ -0,0 +1,9 @@ +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; + +export const viewableRecordNameSingularComponentState = + createAtomComponentState({ + key: 'side-panel/viewable-record-name-singular', + defaultValue: null, + componentInstanceContext: SidePanelPageComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/rich-text-page/components/SidePanelEditRichTextPage.tsx similarity index 91% rename from packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/rich-text-page/components/SidePanelEditRichTextPage.tsx index d09a92b0f4..50826d9e8c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/rich-text-page/components/SidePanelEditRichTextPage.tsx @@ -1,5 +1,5 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader'; -import { viewableRichTextComponentState } from '@/command-menu/pages/rich-text-page/states/viewableRichTextComponentState'; +import { viewableRichTextComponentState } from '@/side-panel/pages/rich-text-page/states/viewableRichTextComponentState'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { styled } from '@linaria/react'; import { lazy, Suspense, useContext } from 'react'; @@ -33,7 +33,7 @@ const LoadingSkeleton = () => { ); }; -export const CommandMenuEditRichTextPage = () => { +export const SidePanelEditRichTextPage = () => { const { activityId, activityObjectNameSingular } = useAtomStateValue( viewableRichTextComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/states/viewableRichTextComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/rich-text-page/states/viewableRichTextComponentState.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/rich-text-page/states/viewableRichTextComponentState.ts rename to packages/twenty-front/src/modules/side-panel/pages/rich-text-page/states/viewableRichTextComponentState.ts diff --git a/packages/twenty-front/src/modules/command-menu/components/ResetContextToSelectionCommandButton.tsx b/packages/twenty-front/src/modules/side-panel/pages/root/components/SidePanelResetContextToSelectionButton.tsx similarity index 65% rename from packages/twenty-front/src/modules/command-menu/components/ResetContextToSelectionCommandButton.tsx rename to packages/twenty-front/src/modules/side-panel/pages/root/components/SidePanelResetContextToSelectionButton.tsx index 9e1df473c7..8e4d6f9ea1 100644 --- a/packages/twenty-front/src/modules/command-menu/components/ResetContextToSelectionCommandButton.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/root/components/SidePanelResetContextToSelectionButton.tsx @@ -1,8 +1,8 @@ -import { CommandMenuContextRecordsChip } from '@/command-menu/components/CommandMenuContextRecordsChip'; +import { SidePanelContextRecordsChip } from '@/side-panel/components/SidePanelContextRecordsChip'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; -import { COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuPreviousComponentInstanceId'; -import { RESET_CONTEXT_TO_SELECTION } from '@/command-menu/constants/ResetContextToSelection'; -import { useResetPreviousCommandMenuContext } from '@/command-menu/hooks/useResetPreviousCommandMenuContext'; +import { SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelPreviousComponentInstanceId'; +import { SIDE_PANEL_RESET_CONTEXT_TO_SELECTION } from '@/side-panel/constants/SidePanelResetContextToSelection'; +import { useResetPreviousSidePanelContext } from '@/side-panel/pages/root/hooks/useResetPreviousSidePanelContext'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; @@ -13,15 +13,15 @@ import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; import { IconArrowBackUp } from 'twenty-ui/display'; -export const ResetContextToSelectionCommandButton = () => { +export const SidePanelResetContextToSelectionButton = () => { const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, - 'command-menu-previous', + SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID, ); const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, - 'command-menu-previous', + SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID, ); const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); @@ -31,8 +31,7 @@ export const ResetContextToSelectionCommandButton = () => { objectMetadataItem.id === contextStoreCurrentObjectMetadataItemId, ); - const { resetPreviousCommandMenuContext } = - useResetPreviousCommandMenuContext(); + const { resetPreviousSidePanelContext } = useResetPreviousSidePanelContext(); if ( !isDefined(objectMetadataItem) || @@ -44,20 +43,20 @@ export const ResetContextToSelectionCommandButton = () => { return ( } - onClick={resetPreviousCommandMenuContext} + onClick={resetPreviousSidePanelContext} /> ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx b/packages/twenty-front/src/modules/side-panel/pages/root/components/SidePanelRootPage.tsx similarity index 66% rename from packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx rename to packages/twenty-front/src/modules/side-panel/pages/root/components/SidePanelRootPage.tsx index 7073987a82..5204efc9e0 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/root/components/SidePanelRootPage.tsx @@ -1,26 +1,22 @@ -import { type ActionConfig } from '@/action-menu/actions/types/ActionConfig'; -import { CommandGroup } from '@/command-menu/components/CommandGroup'; -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { ResetContextToSelectionCommandButton } from '@/command-menu/components/ResetContextToSelectionCommandButton'; -import { RESET_CONTEXT_TO_SELECTION } from '@/command-menu/constants/ResetContextToSelection'; -import { useMatchingCommandMenuActions } from '@/command-menu/hooks/useMatchingCommandMenuActions'; -import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; +import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelPreviousComponentInstanceId'; +import { SIDE_PANEL_RESET_CONTEXT_TO_SELECTION } from '@/side-panel/constants/SidePanelResetContextToSelection'; +import { sidePanelSearchState } from '@/side-panel/states/sidePanelSearchState'; +import { type SidePanelActionGroupConfig } from '@/side-panel/types/SidePanelActionGroupConfig'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; +import { SidePanelResetContextToSelectionButton } from '@/side-panel/pages/root/components/SidePanelResetContextToSelectionButton'; +import { useSidePanelMatchingActions } from '@/side-panel/pages/root/hooks/useSidePanelMatchingActions'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { isDefined } from 'twenty-shared/utils'; -export type ActionGroupConfig = { - heading: string; - items?: ActionConfig[]; -}; - -export const CommandMenu = () => { +export const SidePanelRootPage = () => { const { t } = useLingui(); - const commandMenuSearch = useAtomStateValue(commandMenuSearchState); + const sidePanelSearch = useAtomStateValue(sidePanelSearchState); const { objectMetadataItems } = useObjectMetadataItems(); const { @@ -35,15 +31,15 @@ export const CommandMenu = () => { matchingNavigateActions, fallbackActions, matchingCreateRelatedRecordActions, - } = useMatchingCommandMenuActions({ - commandMenuSearch, + } = useSidePanelMatchingActions({ + sidePanelSearch, }); // eslint-disable-next-line twenty/matching-state-variable const previousContextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, - 'command-menu-previous', + SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID, ); const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( @@ -53,7 +49,7 @@ export const CommandMenu = () => { (item) => item.id === contextStoreCurrentObjectMetadataItemId, ); - const commandGroups: ActionGroupConfig[] = [ + const commandGroups: SidePanelActionGroupConfig[] = [ { heading: t`Record Selection`, items: matchingStandardActionRecordSelectionActions @@ -76,7 +72,7 @@ export const CommandMenu = () => { .concat(matchingNavigateActions), }, { - heading: t`Search ''${commandMenuSearch}'' with...`, + heading: t`Search ''${sidePanelSearch}'' with...`, items: fallbackActions, }, ]; @@ -86,20 +82,20 @@ export const CommandMenu = () => { const selectableItemIds = selectableItems.map((item) => item.key); if (isDefined(previousContextStoreCurrentObjectMetadataItemId)) { - selectableItemIds.unshift(RESET_CONTEXT_TO_SELECTION); + selectableItemIds.unshift(SIDE_PANEL_RESET_CONTEXT_TO_SELECTION); } return ( - {isDefined(previousContextStoreCurrentObjectMetadataItemId) && ( - - - + + + )} - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useFilterActionsWithCommandMenuSearch.test.tsx b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/__tests__/useFilterActionsWithSidePanelSearch.test.tsx similarity index 70% rename from packages/twenty-front/src/modules/command-menu/hooks/__tests__/useFilterActionsWithCommandMenuSearch.test.tsx rename to packages/twenty-front/src/modules/side-panel/pages/root/hooks/__tests__/useFilterActionsWithSidePanelSearch.test.tsx index 7f235d838c..2fb9dc2e16 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useFilterActionsWithCommandMenuSearch.test.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/__tests__/useFilterActionsWithSidePanelSearch.test.tsx @@ -3,11 +3,11 @@ import { ActionScope } from '@/action-menu/actions/types/ActionScope'; import { ActionType } from '@/action-menu/actions/types/ActionType'; import { renderHook } from '@testing-library/react'; import { IconPlus } from 'twenty-ui/display'; -import { useFilterActionsWithCommandMenuSearch } from '@/command-menu/hooks/useFilterActionsWithCommandMenuSearch'; +import { useFilterActionsWithSidePanelSearch } from '@/side-panel/pages/root/hooks/useFilterActionsWithSidePanelSearch'; const MockComponent =
Mock Component
; -describe('useFilterActionsWithCommandMenuSearch', () => { +describe('useFilterActionsWithSidePanelSearch', () => { const mockActions: ActionConfig[] = [ { key: 'action-1', @@ -45,22 +45,22 @@ describe('useFilterActionsWithCommandMenuSearch', () => { it('should return all actions when search is empty', () => { const { result } = renderHook(() => - useFilterActionsWithCommandMenuSearch({ commandMenuSearch: '' }), + useFilterActionsWithSidePanelSearch({ sidePanelSearch: '' }), ); const filtered = - result.current.filterActionsWithCommandMenuSearch(mockActions); + result.current.filterActionsWithSidePanelSearch(mockActions); expect(filtered).toEqual(mockActions); }); it('should filter actions by label', () => { const { result } = renderHook(() => - useFilterActionsWithCommandMenuSearch({ commandMenuSearch: 'Create' }), + useFilterActionsWithSidePanelSearch({ sidePanelSearch: 'Create' }), ); const filtered = - result.current.filterActionsWithCommandMenuSearch(mockActions); + result.current.filterActionsWithSidePanelSearch(mockActions); expect(filtered).toHaveLength(1); expect(filtered[0].key).toBe('action-1'); @@ -68,11 +68,11 @@ describe('useFilterActionsWithCommandMenuSearch', () => { it('should filter actions by hotkeys', () => { const { result } = renderHook(() => - useFilterActionsWithCommandMenuSearch({ commandMenuSearch: 'del' }), + useFilterActionsWithSidePanelSearch({ sidePanelSearch: 'del' }), ); const filtered = - result.current.filterActionsWithCommandMenuSearch(mockActions); + result.current.filterActionsWithSidePanelSearch(mockActions); expect(filtered).toHaveLength(1); expect(filtered[0].key).toBe('action-2'); @@ -80,22 +80,22 @@ describe('useFilterActionsWithCommandMenuSearch', () => { it('should return empty array when no actions match', () => { const { result } = renderHook(() => - useFilterActionsWithCommandMenuSearch({ commandMenuSearch: 'xyz' }), + useFilterActionsWithSidePanelSearch({ sidePanelSearch: 'xyz' }), ); const filtered = - result.current.filterActionsWithCommandMenuSearch(mockActions); + result.current.filterActionsWithSidePanelSearch(mockActions); expect(filtered).toEqual([]); }); it('should match actions by either label or hotkeys', () => { const { result } = renderHook(() => - useFilterActionsWithCommandMenuSearch({ commandMenuSearch: 'Record' }), + useFilterActionsWithSidePanelSearch({ sidePanelSearch: 'Record' }), ); const filtered = - result.current.filterActionsWithCommandMenuSearch(mockActions); + result.current.filterActionsWithSidePanelSearch(mockActions); expect(filtered).toHaveLength(3); }); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useFilterActionsWithCommandMenuSearch.ts b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useFilterActionsWithSidePanelSearch.ts similarity index 68% rename from packages/twenty-front/src/modules/command-menu/hooks/useFilterActionsWithCommandMenuSearch.ts rename to packages/twenty-front/src/modules/side-panel/pages/root/hooks/useFilterActionsWithSidePanelSearch.ts index 79b8872bb5..66364e5946 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useFilterActionsWithCommandMenuSearch.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useFilterActionsWithSidePanelSearch.ts @@ -19,26 +19,26 @@ const checkInLabels = (action: ActionConfig, search: string) => { return false; }; -type UseFilterActionsWithCommandMenuSearchProps = { - commandMenuSearch: string; +type UseFilterActionsWithSidePanelSearchProps = { + sidePanelSearch: string; }; -export const useFilterActionsWithCommandMenuSearch = ({ - commandMenuSearch, -}: UseFilterActionsWithCommandMenuSearchProps) => { - const filterActionsWithCommandMenuSearch = useCallback( +export const useFilterActionsWithSidePanelSearch = ({ + sidePanelSearch, +}: UseFilterActionsWithSidePanelSearchProps) => { + const filterActionsWithSidePanelSearch = useCallback( (actions: ActionConfig[]) => { return actions.filter((action) => - commandMenuSearch.length > 0 - ? checkInShortcuts(action, commandMenuSearch) || - checkInLabels(action, commandMenuSearch) + sidePanelSearch.length > 0 + ? checkInShortcuts(action, sidePanelSearch) || + checkInLabels(action, sidePanelSearch) : true, ); }, - [commandMenuSearch], + [sidePanelSearch], ); return { - filterActionsWithCommandMenuSearch, + filterActionsWithSidePanelSearch, }; }; diff --git a/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useResetPreviousSidePanelContext.ts b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useResetPreviousSidePanelContext.ts new file mode 100644 index 0000000000..0bb145a7ec --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useResetPreviousSidePanelContext.ts @@ -0,0 +1,21 @@ +import { SIDE_PANEL_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelComponentInstanceId'; +import { SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID } from '@/side-panel/constants/SidePanelPreviousComponentInstanceId'; +import { useCopyContextStoreStates } from '@/command-menu/hooks/useCopyContextStoreAndActionMenuStates'; +import { useResetContextStoreStates } from '@/command-menu/hooks/useResetContextStoreStates'; + +export const useResetPreviousSidePanelContext = () => { + const { copyContextStoreStates } = useCopyContextStoreStates(); + const { resetContextStoreStates } = useResetContextStoreStates(); + + const resetPreviousSidePanelContext = () => { + copyContextStoreStates({ + instanceIdToCopyFrom: SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID, + instanceIdToCopyTo: SIDE_PANEL_COMPONENT_INSTANCE_ID, + }); + resetContextStoreStates(SIDE_PANEL_PREVIOUS_COMPONENT_INSTANCE_ID); + }; + + return { + resetPreviousSidePanelContext, + }; +}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuActions.tsx b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useSidePanelActions.tsx similarity index 98% rename from packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuActions.tsx rename to packages/twenty-front/src/modules/side-panel/pages/root/hooks/useSidePanelActions.tsx index 956f3079e2..c7ef18b527 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuActions.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useSidePanelActions.tsx @@ -4,7 +4,7 @@ import { ActionType } from '@/action-menu/actions/types/ActionType'; import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useContext } from 'react'; -export const useCommandMenuActions = () => { +export const useSidePanelActions = () => { const { actions } = useContext(ActionMenuContext); const navigateActions = actions?.filter( diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useMatchingCommandMenuActions.ts b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useSidePanelMatchingActions.ts similarity index 59% rename from packages/twenty-front/src/modules/command-menu/hooks/useMatchingCommandMenuActions.ts rename to packages/twenty-front/src/modules/side-panel/pages/root/hooks/useSidePanelMatchingActions.ts index f0843102c5..c1509a0777 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useMatchingCommandMenuActions.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/root/hooks/useSidePanelMatchingActions.ts @@ -1,14 +1,14 @@ -import { useCommandMenuActions } from '@/command-menu/hooks/useCommandMenuActions'; -import { useFilterActionsWithCommandMenuSearch } from '@/command-menu/hooks/useFilterActionsWithCommandMenuSearch'; +import { useFilterActionsWithSidePanelSearch } from '@/side-panel/pages/root/hooks/useFilterActionsWithSidePanelSearch'; +import { useSidePanelActions } from '@/side-panel/pages/root/hooks/useSidePanelActions'; -export const useMatchingCommandMenuActions = ({ - commandMenuSearch, +export const useSidePanelMatchingActions = ({ + sidePanelSearch, }: { - commandMenuSearch: string; + sidePanelSearch: string; }) => { - const { filterActionsWithCommandMenuSearch } = - useFilterActionsWithCommandMenuSearch({ - commandMenuSearch, + const { filterActionsWithSidePanelSearch } = + useFilterActionsWithSidePanelSearch({ + sidePanelSearch: sidePanelSearch, }); const { @@ -22,34 +22,35 @@ export const useMatchingCommandMenuActions = ({ frontComponentRecordSelectionActions, fallbackActions, createRelatedRecordActions, - } = useCommandMenuActions(); + } = useSidePanelActions(); const matchingNavigateActions = - filterActionsWithCommandMenuSearch(navigateActions); + filterActionsWithSidePanelSearch(navigateActions); const matchingStandardActionRecordSelectionActions = - filterActionsWithCommandMenuSearch(actionRecordSelectionActions); + filterActionsWithSidePanelSearch(actionRecordSelectionActions); const matchingStandardActionObjectActions = - filterActionsWithCommandMenuSearch(actionObjectActions); + filterActionsWithSidePanelSearch(actionObjectActions); const matchingStandardActionGlobalActions = - filterActionsWithCommandMenuSearch(actionGlobalActions); + filterActionsWithSidePanelSearch(actionGlobalActions); const matchingWorkflowRunRecordSelectionActions = - filterActionsWithCommandMenuSearch(workflowRunRecordSelectionActions); + filterActionsWithSidePanelSearch(workflowRunRecordSelectionActions); - const matchingWorkflowRunGlobalActions = filterActionsWithCommandMenuSearch( + const matchingWorkflowRunGlobalActions = filterActionsWithSidePanelSearch( workflowRunGlobalActions, ); - const matchingFrontComponentGlobalActions = - filterActionsWithCommandMenuSearch(frontComponentGlobalActions); + const matchingFrontComponentGlobalActions = filterActionsWithSidePanelSearch( + frontComponentGlobalActions, + ); const matchingFrontComponentRecordSelectionActions = - filterActionsWithCommandMenuSearch(frontComponentRecordSelectionActions); + filterActionsWithSidePanelSearch(frontComponentRecordSelectionActions); - const matchingCreateRelatedRecordActions = filterActionsWithCommandMenuSearch( + const matchingCreateRelatedRecordActions = filterActionsWithSidePanelSearch( createRelatedRecordActions, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/search/components/CommandMenuSearchRecordsPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx similarity index 52% rename from packages/twenty-front/src/modules/command-menu/pages/search/components/CommandMenuSearchRecordsPage.tsx rename to packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx index 15435c7042..8c65bb163f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/search/components/CommandMenuSearchRecordsPage.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx @@ -1,9 +1,9 @@ -import { CommandMenuList } from '@/command-menu/components/CommandMenuList'; -import { useCommandMenuSearchRecords } from '@/command-menu/hooks/useCommandMenuSearchRecords'; +import { SidePanelList } from '@/side-panel/components/SidePanelList'; +import { useSidePanelSearchRecords } from '@/side-panel/pages/search/hooks/useSidePanelSearchRecords'; import { useMemo } from 'react'; -export const CommandMenuSearchRecordsPage = () => { - const { commandGroups, loading, noResults } = useCommandMenuSearchRecords(); +export const SidePanelSearchRecordsPage = () => { + const { commandGroups, loading, noResults } = useSidePanelSearchRecords(); const selectableItemIds = useMemo(() => { return commandGroups @@ -12,7 +12,7 @@ export const CommandMenuSearchRecordsPage = () => { }, [commandGroups]); return ( - { - const commandMenuSearch = useAtomStateValue(commandMenuSearchState); +export const useSidePanelSearchRecords = () => { + const sidePanelSearch = useAtomStateValue(sidePanelSearchState); const coreClient = useApolloCoreClient(); - const [deferredCommandMenuSearch] = useDebounce(commandMenuSearch, 300); + const [deferredSidePanelSearch] = useDebounce(sidePanelSearch, 300); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); const { objectMetadataItems } = useObjectMetadataItems(); @@ -41,7 +41,7 @@ export const useCommandMenuSearchRecords = () => { const { data: searchData, loading } = useSearchQuery({ client: coreClient, variables: { - searchInput: deferredCommandMenuSearch ?? '', + searchInput: deferredSidePanelSearch ?? '', limit: MAX_SEARCH_RESULTS, excludedObjectNameSingulars: [ 'workspaceMember', @@ -50,7 +50,7 @@ export const useCommandMenuSearchRecords = () => { }, }); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const actionItems = useMemo(() => { return (searchData?.search.edges.map((edge) => edge.node) ?? []).map( @@ -92,11 +92,11 @@ export const useCommandMenuSearchRecords = () => { { searchRecord.objectNameSingular === 'task' - ? openRecordInCommandMenu({ + ? openRecordInSidePanel({ recordId: searchRecord.recordId, objectNameSingular: CoreObjectNameSingular.Task, }) - : openRecordInCommandMenu({ + : openRecordInSidePanel({ recordId: searchRecord.recordId, objectNameSingular: CoreObjectNameSingular.Note, }); @@ -121,7 +121,7 @@ export const useCommandMenuSearchRecords = () => { }; }, ); - }, [searchData, openRecordInCommandMenu, objectMetadataItems]); + }, [searchData, openRecordInSidePanel, objectMetadataItems]); return { loading, diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/SidePanelWorkflowSelectAction.tsx similarity index 77% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/SidePanelWorkflowSelectAction.tsx index 7c1a379796..3cea913751 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/SidePanelWorkflowSelectAction.tsx @@ -1,8 +1,8 @@ -import { WorkflowActionMenuItems } from '@/command-menu/pages/workflow/action/components/WorkflowActionMenuItems'; +import { WorkflowActionMenuItems } from '@/side-panel/pages/workflow/action/components/WorkflowActionMenuItems'; import { logicFunctionsState } from '@/settings/logic-functions/states/logicFunctionsState'; import { type WorkflowActionType } from '@/workflow/types/Workflow'; -import { RightDrawerStepListContainer } from '@/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepContainer'; -import { RightDrawerWorkflowSelectStepTitle } from '@/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepTitle'; +import { SidePanelStepListContainer } from '@/workflow/workflow-steps/components/SidePanelWorkflowSelectStepContainer'; +import { SidePanelWorkflowSelectStepTitle } from '@/workflow/workflow-steps/components/SidePanelWorkflowSelectStepTitle'; import { AI_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/constants/AiActions'; import { CORE_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/constants/CoreActions'; import { FLOW_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/constants/FlowActions'; @@ -21,7 +21,7 @@ export type WorkflowActionSelection = { defaultSettings?: Record; }; -export const CommandMenuWorkflowSelectAction = ({ +export const SidePanelWorkflowSelectAction = ({ onActionSelected, }: { onActionSelected: (selection: WorkflowActionSelection) => void; @@ -55,10 +55,10 @@ export const CommandMenuWorkflowSelectAction = ({ }; return ( - - + + {t`Data`} - + - + {t`AI`} - + )} - + {t`Flow`} - + - + {t`Core`} - + - + {t`Human Input`} - + 0 && ( <> - + {t`Applications`} - + {toolFunctions.map((fn) => ( )} - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/WorkflowActionMenuItems.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/WorkflowActionMenuItems.tsx similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/WorkflowActionMenuItems.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/action/components/WorkflowActionMenuItems.tsx diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow.ts new file mode 100644 index 0000000000..be30e26c10 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow.ts @@ -0,0 +1,14 @@ +import { sidePanelWorkflowIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowIdComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { isDefined } from 'twenty-shared/utils'; + +export const useSidePanelWorkflowIdOrThrow = () => { + const sidePanelWorkflowId = useAtomComponentStateValue( + sidePanelWorkflowIdComponentState, + ); + if (!isDefined(sidePanelWorkflowId)) { + throw new Error('Expected sidePanelWorkflowIdComponentState to be defined'); + } + + return sidePanelWorkflowId; +}; diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useWorkflowCommandMenu.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation.ts similarity index 55% rename from packages/twenty-front/src/modules/command-menu/hooks/useWorkflowCommandMenu.ts rename to packages/twenty-front/src/modules/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation.ts index ec47351016..ac19187b74 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useWorkflowCommandMenu.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation.ts @@ -1,14 +1,14 @@ -import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; -import { commandMenuWorkflowIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState'; -import { commandMenuWorkflowRunIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState'; -import { commandMenuWorkflowStepIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState'; -import { commandMenuWorkflowVersionIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState'; +import { useNavigateSidePanel } from '@/side-panel/hooks/useNavigateSidePanel'; +import { sidePanelWorkflowIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowIdComponentState'; +import { sidePanelWorkflowRunIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowRunIdComponentState'; +import { sidePanelWorkflowStepIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowStepIdComponentState'; +import { sidePanelWorkflowVersionIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowVersionIdComponentState'; import { type WorkflowRunStepStatus } from '@/workflow/types/Workflow'; -import { useSetInitialWorkflowRunRightDrawerTab } from '@/workflow/workflow-diagram/hooks/useSetInitialWorkflowRunRightDrawerTab'; +import { useSetInitialWorkflowRunSidePanelTab } from '@/workflow/workflow-diagram/hooks/useSetInitialWorkflowRunSidePanelTab'; import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; import { t } from '@lingui/core/macro'; import { useCallback } from 'react'; -import { CommandMenuPages } from 'twenty-shared/types'; +import { SidePanelPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { IconBolt, @@ -18,55 +18,55 @@ import { import { v4 } from 'uuid'; import { useStore } from 'jotai'; -export const useWorkflowCommandMenu = () => { +export const useSidePanelWorkflowNavigation = () => { const store = useStore(); - const { navigateCommandMenu } = useNavigateCommandMenu(); - const { setInitialWorkflowRunRightDrawerTab } = - useSetInitialWorkflowRunRightDrawerTab(); + const { navigateSidePanel } = useNavigateSidePanel(); + const { setInitialWorkflowRunSidePanelTab } = + useSetInitialWorkflowRunSidePanelTab(); - const openWorkflowTriggerTypeInCommandMenu = useCallback( + const openWorkflowTriggerTypeInSidePanel = useCallback( (workflowId: string) => { const pageId = v4(); store.set( - commandMenuWorkflowIdComponentState.atomFamily({ + sidePanelWorkflowIdComponentState.atomFamily({ instanceId: pageId, }), workflowId, ); - navigateCommandMenu({ - page: CommandMenuPages.WorkflowTriggerSelectType, + navigateSidePanel({ + page: SidePanelPages.WorkflowTriggerSelectType, pageTitle: t`Trigger Type`, pageIcon: IconBolt, pageId, }); }, - [navigateCommandMenu, store], + [navigateSidePanel, store], ); - const openWorkflowCreateStepInCommandMenu = useCallback( + const openWorkflowCreateStepInSidePanel = useCallback( (workflowId: string) => { const pageId = v4(); store.set( - commandMenuWorkflowIdComponentState.atomFamily({ + sidePanelWorkflowIdComponentState.atomFamily({ instanceId: pageId, }), workflowId, ); - navigateCommandMenu({ - page: CommandMenuPages.WorkflowStepCreate, + navigateSidePanel({ + page: SidePanelPages.WorkflowStepCreate, pageTitle: t`Select Action`, pageIcon: IconSettingsAutomation, pageId, }); }, - [navigateCommandMenu, store], + [navigateSidePanel, store], ); - const openWorkflowEditStepInCommandMenu = useCallback( + const openWorkflowEditStepInSidePanel = useCallback( ( workflowId: string, title: string, @@ -76,7 +76,7 @@ export const useWorkflowCommandMenu = () => { const pageId = v4(); store.set( - commandMenuWorkflowIdComponentState.atomFamily({ + sidePanelWorkflowIdComponentState.atomFamily({ instanceId: pageId, }), workflowId, @@ -84,7 +84,7 @@ export const useWorkflowCommandMenu = () => { if (isDefined(stepId)) { store.set( - commandMenuWorkflowStepIdComponentState.atomFamily({ + sidePanelWorkflowStepIdComponentState.atomFamily({ instanceId: pageId, }), stepId, @@ -98,38 +98,38 @@ export const useWorkflowCommandMenu = () => { ); } - navigateCommandMenu({ - page: CommandMenuPages.WorkflowStepEdit, + navigateSidePanel({ + page: SidePanelPages.WorkflowStepEdit, pageTitle: title, pageIcon: icon, pageId, }); }, - [navigateCommandMenu, store], + [navigateSidePanel, store], ); - const openWorkflowEditStepTypeInCommandMenu = useCallback( + const openWorkflowEditStepTypeInSidePanel = useCallback( (workflowId: string) => { const pageId = v4(); store.set( - commandMenuWorkflowIdComponentState.atomFamily({ + sidePanelWorkflowIdComponentState.atomFamily({ instanceId: pageId, }), workflowId, ); - navigateCommandMenu({ - page: CommandMenuPages.WorkflowStepEditType, + navigateSidePanel({ + page: SidePanelPages.WorkflowStepEditType, pageTitle: t`Select action`, pageIcon: IconSettingsAutomation, pageId, }); }, - [navigateCommandMenu, store], + [navigateSidePanel, store], ); - const openWorkflowViewStepInCommandMenu = useCallback( + const openWorkflowViewStepInSidePanel = useCallback( ({ workflowId, workflowVersionId, @@ -146,13 +146,13 @@ export const useWorkflowCommandMenu = () => { const pageId = v4(); store.set( - commandMenuWorkflowIdComponentState.atomFamily({ + sidePanelWorkflowIdComponentState.atomFamily({ instanceId: pageId, }), workflowId, ); store.set( - commandMenuWorkflowVersionIdComponentState.atomFamily({ + sidePanelWorkflowVersionIdComponentState.atomFamily({ instanceId: pageId, }), workflowVersionId, @@ -160,7 +160,7 @@ export const useWorkflowCommandMenu = () => { if (isDefined(stepId)) { store.set( - commandMenuWorkflowStepIdComponentState.atomFamily({ + sidePanelWorkflowStepIdComponentState.atomFamily({ instanceId: pageId, }), stepId, @@ -174,17 +174,17 @@ export const useWorkflowCommandMenu = () => { ); } - navigateCommandMenu({ - page: CommandMenuPages.WorkflowStepView, + navigateSidePanel({ + page: SidePanelPages.WorkflowStepView, pageTitle: title, pageIcon: icon, pageId, }); }, - [navigateCommandMenu, store], + [navigateSidePanel, store], ); - const openWorkflowRunViewStepInCommandMenu = useCallback( + const openWorkflowRunViewStepInSidePanel = useCallback( ({ workflowId, workflowRunId, @@ -203,19 +203,19 @@ export const useWorkflowCommandMenu = () => { const pageId = v4(); store.set( - commandMenuWorkflowIdComponentState.atomFamily({ + sidePanelWorkflowIdComponentState.atomFamily({ instanceId: pageId, }), workflowId, ); store.set( - commandMenuWorkflowRunIdComponentState.atomFamily({ + sidePanelWorkflowRunIdComponentState.atomFamily({ instanceId: pageId, }), workflowRunId, ); store.set( - commandMenuWorkflowStepIdComponentState.atomFamily({ + sidePanelWorkflowStepIdComponentState.atomFamily({ instanceId: pageId, }), workflowSelectedNode, @@ -228,27 +228,27 @@ export const useWorkflowCommandMenu = () => { workflowSelectedNode, ); - navigateCommandMenu({ - page: CommandMenuPages.WorkflowRunStepView, + navigateSidePanel({ + page: SidePanelPages.WorkflowRunStepView, pageTitle: title, pageIcon: icon, pageId, }); - setInitialWorkflowRunRightDrawerTab({ + setInitialWorkflowRunSidePanelTab({ workflowSelectedNode, stepExecutionStatus, }); }, - [navigateCommandMenu, setInitialWorkflowRunRightDrawerTab, store], + [navigateSidePanel, setInitialWorkflowRunSidePanelTab, store], ); return { - openWorkflowTriggerTypeInCommandMenu, - openWorkflowCreateStepInCommandMenu, - openWorkflowEditStepInCommandMenu, - openWorkflowEditStepTypeInCommandMenu, - openWorkflowViewStepInCommandMenu, - openWorkflowRunViewStepInCommandMenu, + openWorkflowTriggerTypeInSidePanel, + openWorkflowCreateStepInSidePanel, + openWorkflowEditStepInSidePanel, + openWorkflowEditStepTypeInSidePanel, + openWorkflowViewStepInSidePanel, + openWorkflowRunViewStepInSidePanel, }; }; diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowIdComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowIdComponentState.ts new file mode 100644 index 0000000000..b3f6e61bba --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowIdComponentState.ts @@ -0,0 +1,10 @@ +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; + +export const sidePanelWorkflowIdComponentState = createAtomComponentState< + string | undefined +>({ + key: 'side-panel/workflow-id', + defaultValue: undefined, + componentInstanceContext: SidePanelPageComponentInstanceContext, +}); diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowRunIdComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowRunIdComponentState.ts new file mode 100644 index 0000000000..6dc8d010cc --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowRunIdComponentState.ts @@ -0,0 +1,10 @@ +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; + +export const sidePanelWorkflowRunIdComponentState = createAtomComponentState< + string | undefined +>({ + key: 'side-panel/workflow-run-id', + defaultValue: undefined, + componentInstanceContext: SidePanelPageComponentInstanceContext, +}); diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowStepIdComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowStepIdComponentState.ts new file mode 100644 index 0000000000..eb28b9008a --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowStepIdComponentState.ts @@ -0,0 +1,10 @@ +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; + +export const sidePanelWorkflowStepIdComponentState = createAtomComponentState< + string | undefined +>({ + key: 'side-panel/workflow-step-id', + defaultValue: undefined, + componentInstanceContext: SidePanelPageComponentInstanceContext, +}); diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowVersionIdComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowVersionIdComponentState.ts new file mode 100644 index 0000000000..7c1ceab188 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/states/sidePanelWorkflowVersionIdComponentState.ts @@ -0,0 +1,9 @@ +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; + +export const sidePanelWorkflowVersionIdComponentState = + createAtomComponentState({ + key: 'side-panel/workflow-version-id', + defaultValue: undefined, + componentInstanceContext: SidePanelPageComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStep.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStep.tsx similarity index 56% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStep.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStep.tsx index 1b7669e8d9..6c98b8772f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStep.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStep.tsx @@ -1,10 +1,10 @@ -import { useCommandMenuWorkflowIdOrThrow } from '@/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow'; -import { CommandMenuWorkflowCreateStepContent } from '@/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStepContent'; +import { useSidePanelWorkflowIdOrThrow } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow'; +import { SidePanelWorkflowCreateStepContent } from '@/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStepContent'; import { getWorkflowVisualizerComponentInstanceId } from '@/workflow/utils/getWorkflowVisualizerComponentInstanceId'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const CommandMenuWorkflowCreateStep = () => { - const workflowId = useCommandMenuWorkflowIdOrThrow(); +export const SidePanelWorkflowCreateStep = () => { + const workflowId = useSidePanelWorkflowIdOrThrow(); return ( { }), }} > - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStepContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStepContent.tsx similarity index 83% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStepContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStepContent.tsx index 6100622daa..c94fe80c2c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStepContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/create/components/SidePanelWorkflowCreateStepContent.tsx @@ -1,9 +1,9 @@ -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; import { - CommandMenuWorkflowSelectAction, + SidePanelWorkflowSelectAction, type WorkflowActionSelection, -} from '@/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +} from '@/side-panel/pages/workflow/action/components/SidePanelWorkflowSelectAction'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; @@ -22,7 +22,7 @@ import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomStat import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; -export const CommandMenuWorkflowCreateStepContent = () => { +export const SidePanelWorkflowCreateStepContent = () => { const { getIcon } = useIcons(); const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, @@ -34,10 +34,10 @@ export const CommandMenuWorkflowCreateStepContent = () => { workflowVisualizerWorkflowId, ); - const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowEditStepInSidePanel } = useSidePanelWorkflowNavigation(); const { closeRightClickMenu } = useCloseRightClickMenu(); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); const [workflowInsertStepIds, setWorkflowInsertStepIds] = @@ -102,9 +102,9 @@ export const CommandMenuWorkflowCreateStepContent = () => { closeRightClickMenu(); - setCommandMenuNavigationStack([]); + setSidePanelNavigationStack([]); - openWorkflowEditStepInCommandMenu( + openWorkflowEditStepInSidePanel( workflowVisualizerWorkflowId, createdStep.name, getIcon(getActionIcon(createdStep.type as WorkflowActionType)), @@ -112,7 +112,5 @@ export const CommandMenuWorkflowCreateStepContent = () => { ); }; - return ( - - ); + return ; }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStep.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStep.tsx similarity index 57% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStep.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStep.tsx index a7bf32a661..508c0d5c69 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStep.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStep.tsx @@ -1,10 +1,10 @@ -import { useCommandMenuWorkflowIdOrThrow } from '@/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow'; -import { CommandMenuWorkflowEditStepContent } from '@/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent'; +import { useSidePanelWorkflowIdOrThrow } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow'; +import { SidePanelWorkflowEditStepContent } from '@/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepContent'; import { getWorkflowVisualizerComponentInstanceId } from '@/workflow/utils/getWorkflowVisualizerComponentInstanceId'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const CommandMenuWorkflowEditStep = () => { - const workflowId = useCommandMenuWorkflowIdOrThrow(); +export const SidePanelWorkflowEditStep = () => { + const workflowId = useSidePanelWorkflowIdOrThrow(); const instanceId = getWorkflowVisualizerComponentInstanceId({ recordId: workflowId, }); @@ -15,7 +15,7 @@ export const CommandMenuWorkflowEditStep = () => { instanceId, }} > - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepContent.tsx similarity index 95% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepContent.tsx index 3c2b7354a9..27e09c2a9d 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepContent.tsx @@ -13,7 +13,7 @@ const StyledContainer = styled.div` height: 100%; `; -export const CommandMenuWorkflowEditStepContent = () => { +export const SidePanelWorkflowEditStepContent = () => { const flow = useFlowOrThrow(); const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepType.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepType.tsx similarity index 55% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepType.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepType.tsx index e80bf478f3..d210637f67 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepType.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepType.tsx @@ -1,10 +1,10 @@ -import { useCommandMenuWorkflowIdOrThrow } from '@/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow'; -import { CommandMenuWorkflowEditStepTypeContent } from '@/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepTypeContent'; +import { useSidePanelWorkflowIdOrThrow } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow'; +import { SidePanelWorkflowEditStepTypeContent } from '@/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepTypeContent'; import { getWorkflowVisualizerComponentInstanceId } from '@/workflow/utils/getWorkflowVisualizerComponentInstanceId'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const CommandMenuWorkflowEditStepType = () => { - const workflowId = useCommandMenuWorkflowIdOrThrow(); +export const SidePanelWorkflowEditStepType = () => { + const workflowId = useSidePanelWorkflowIdOrThrow(); return ( { }), }} > - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepTypeContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepTypeContent.tsx similarity index 76% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepTypeContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepTypeContent.tsx index c780cd83d1..31902795f0 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepTypeContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepTypeContent.tsx @@ -1,9 +1,9 @@ -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; import { - CommandMenuWorkflowSelectAction, + SidePanelWorkflowSelectAction, type WorkflowActionSelection, -} from '@/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +} from '@/side-panel/pages/workflow/action/components/SidePanelWorkflowSelectAction'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -19,7 +19,7 @@ import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomStat import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; -export const CommandMenuWorkflowEditStepTypeContent = () => { +export const SidePanelWorkflowEditStepTypeContent = () => { const { getIcon } = useIcons(); const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, @@ -31,10 +31,10 @@ export const CommandMenuWorkflowEditStepTypeContent = () => { const { updateStep } = useUpdateStep(); - const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowEditStepInSidePanel } = useSidePanelWorkflowNavigation(); const { closeRightClickMenu } = useCloseRightClickMenu(); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); const handleUpdateStepType = async (selection: WorkflowActionSelection) => { @@ -66,9 +66,9 @@ export const CommandMenuWorkflowEditStepTypeContent = () => { closeRightClickMenu(); - setCommandMenuNavigationStack([]); + setSidePanelNavigationStack([]); - openWorkflowEditStepInCommandMenu( + openWorkflowEditStepInSidePanel( workflowVisualizerWorkflowId, updatedStep.name, getIcon(getActionIcon(updatedStep.type as WorkflowActionType)), @@ -77,6 +77,6 @@ export const CommandMenuWorkflowEditStepTypeContent = () => { }; return ( - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStep.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStep.tsx similarity index 54% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStep.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStep.tsx index 71ad1ffc32..43c468c006 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStep.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStep.tsx @@ -1,10 +1,10 @@ -import { CommandMenuWorkflowRunViewStepContent } from '@/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStepContent'; -import { useCommandMenuWorkflowRunIdOrThrow } from '@/command-menu/pages/workflow/step/view-run/hooks/useCommandMenuWorkflowRunIdOrThrow'; +import { SidePanelWorkflowRunViewStepContent } from '@/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStepContent'; +import { useSidePanelWorkflowRunIdOrThrow } from '@/side-panel/pages/workflow/step/view-run/hooks/useSidePanelWorkflowRunIdOrThrow'; import { getWorkflowVisualizerComponentInstanceId } from '@/workflow/utils/getWorkflowVisualizerComponentInstanceId'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const CommandMenuWorkflowRunViewStep = () => { - const workflowRunId = useCommandMenuWorkflowRunIdOrThrow(); +export const SidePanelWorkflowRunViewStep = () => { + const workflowRunId = useSidePanelWorkflowRunIdOrThrow(); return ( { }), }} > - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStepContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStepContent.tsx similarity index 79% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStepContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStepContent.tsx index 9ce0ebf431..3bb407606a 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStepContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStepContent.tsx @@ -1,8 +1,8 @@ -import { CommandMenuWorkflowRunStepContentComponentInstanceContext } from '@/command-menu/pages/workflow/step/view-run/states/contexts/CommandMenuWorkflowRunStepContentComponentInstanceContext'; -import { getIsInputTabDisabled } from '@/command-menu/pages/workflow/step/view-run/utils/getIsInputTabDisabled'; -import { getIsOutputTabDisabled } from '@/command-menu/pages/workflow/step/view-run/utils/getIsOutputTabDisabled'; -import { getShouldFocusNodeTab } from '@/command-menu/pages/workflow/step/view-run/utils/getShouldFocusNodeTab'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { SidePanelWorkflowRunStepContentComponentInstanceContext } from '@/side-panel/pages/workflow/step/view-run/states/contexts/SidePanelWorkflowRunStepContentComponentInstanceContext'; +import { getIsInputTabDisabled } from '@/side-panel/pages/workflow/step/view-run/utils/getIsInputTabDisabled'; +import { getIsOutputTabDisabled } from '@/side-panel/pages/workflow/step/view-run/utils/getIsOutputTabDisabled'; +import { getShouldFocusNodeTab } from '@/side-panel/pages/workflow/step/view-run/utils/getShouldFocusNodeTab'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps'; @@ -42,7 +42,7 @@ const StyledTabList = styled(TabList)` type TabId = WorkflowRunTabIdType; -export const CommandMenuWorkflowRunViewStepContent = () => { +export const SidePanelWorkflowRunViewStepContent = () => { const flow = useFlowOrThrow(); const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, @@ -51,18 +51,18 @@ export const CommandMenuWorkflowRunViewStepContent = () => { const workflowRun = useWorkflowRun({ workflowRunId }); - const commandMenuPageComponentInstance = useComponentInstanceStateContext( - CommandMenuPageComponentInstanceContext, + const sidePanelPageComponentInstance = useComponentInstanceStateContext( + SidePanelPageComponentInstanceContext, ); - if (isNull(commandMenuPageComponentInstance)) { + if (isNull(sidePanelPageComponentInstance)) { throw new Error( - 'CommandMenuPageComponentInstanceContext is not defined. This component should be used within CommandMenuPageComponentInstanceContext.', + 'SidePanelPageComponentInstanceContext is not defined. This component should be used within SidePanelPageComponentInstanceContext.', ); } const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, - commandMenuPageComponentInstance.instanceId, + sidePanelPageComponentInstance.instanceId, ); if (!isDefined(workflowRun) || !isDefined(workflowSelectedNode)) { @@ -116,7 +116,7 @@ export const CommandMenuWorkflowRunViewStepContent = () => { ]; return ( - { {activeTabId === WorkflowRunTabId.OUTPUT ? ( @@ -164,6 +164,6 @@ export const CommandMenuWorkflowRunViewStepContent = () => { )}
- + ); }; diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/hooks/useSidePanelWorkflowRunIdOrThrow.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/hooks/useSidePanelWorkflowRunIdOrThrow.ts new file mode 100644 index 0000000000..5fbd284e71 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/hooks/useSidePanelWorkflowRunIdOrThrow.ts @@ -0,0 +1,16 @@ +import { sidePanelWorkflowRunIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowRunIdComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { isDefined } from 'twenty-shared/utils'; + +export const useSidePanelWorkflowRunIdOrThrow = () => { + const sidePanelWorkflowRunId = useAtomComponentStateValue( + sidePanelWorkflowRunIdComponentState, + ); + if (!isDefined(sidePanelWorkflowRunId)) { + throw new Error( + 'Expected the sidePanelWorkflowRunIdComponentState to be defined.', + ); + } + + return sidePanelWorkflowRunId; +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/contexts/CommandMenuWorkflowRunStepContentComponentInstanceContext.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/states/contexts/SidePanelWorkflowRunStepContentComponentInstanceContext.ts similarity index 71% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/contexts/CommandMenuWorkflowRunStepContentComponentInstanceContext.ts rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/states/contexts/SidePanelWorkflowRunStepContentComponentInstanceContext.ts index 8c4410cb7e..fce510e7d1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/contexts/CommandMenuWorkflowRunStepContentComponentInstanceContext.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/states/contexts/SidePanelWorkflowRunStepContentComponentInstanceContext.ts @@ -1,6 +1,6 @@ import { createComponentInstanceContext } from '@/ui/utilities/state/component-state/utils/createComponentInstanceContext'; -export const CommandMenuWorkflowRunStepContentComponentInstanceContext = +export const SidePanelWorkflowRunStepContentComponentInstanceContext = createComponentInstanceContext({ instanceId: '', }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts similarity index 56% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts index 4b81ea626c..c20ca55ae9 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts @@ -1,4 +1,4 @@ -import { CommandMenuWorkflowRunStepContentComponentInstanceContext } from '@/command-menu/pages/workflow/step/view-run/states/contexts/CommandMenuWorkflowRunStepContentComponentInstanceContext'; +import { SidePanelWorkflowRunStepContentComponentInstanceContext } from '@/side-panel/pages/workflow/step/view-run/states/contexts/SidePanelWorkflowRunStepContentComponentInstanceContext'; import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const workflowRunIteratorSubStepIterationIndexComponentState = @@ -6,5 +6,5 @@ export const workflowRunIteratorSubStepIterationIndexComponentState = key: 'workflowRunIteratorSubStepIterationIndexComponentState', defaultValue: 0, componentInstanceContext: - CommandMenuWorkflowRunStepContentComponentInstanceContext, + SidePanelWorkflowRunStepContentComponentInstanceContext, }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/utils/getIsInputTabDisabled.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/utils/getIsInputTabDisabled.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/utils/getIsInputTabDisabled.ts rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/utils/getIsInputTabDisabled.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/utils/getIsOutputTabDisabled.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/utils/getIsOutputTabDisabled.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/utils/getIsOutputTabDisabled.ts rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/utils/getIsOutputTabDisabled.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/utils/getShouldFocusNodeTab.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/utils/getShouldFocusNodeTab.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/utils/getShouldFocusNodeTab.ts rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/utils/getShouldFocusNodeTab.ts diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStep.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/components/SidePanelWorkflowViewStep.tsx similarity index 54% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStep.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/components/SidePanelWorkflowViewStep.tsx index 4e644f0e6c..c16eb66fe5 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStep.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/components/SidePanelWorkflowViewStep.tsx @@ -1,10 +1,10 @@ -import { useCommandMenuWorkflowVersionIdOrThrow } from '@/command-menu/pages/workflow/step/view/hooks/useCommandMenuWorkflowVersionIdOrThrow'; -import { CommandMenuWorkflowViewStepContent } from '@/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStepContent'; +import { useSidePanelWorkflowVersionIdOrThrow } from '@/side-panel/pages/workflow/step/view/hooks/useSidePanelWorkflowVersionIdOrThrow'; +import { SidePanelWorkflowViewStepContent } from '@/side-panel/pages/workflow/step/view/components/SidePanelWorkflowViewStepContent'; import { getWorkflowVisualizerComponentInstanceId } from '@/workflow/utils/getWorkflowVisualizerComponentInstanceId'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const CommandMenuWorkflowViewStep = () => { - const workflowVersionId = useCommandMenuWorkflowVersionIdOrThrow(); +export const SidePanelWorkflowViewStep = () => { + const workflowVersionId = useSidePanelWorkflowVersionIdOrThrow(); return ( { }), }} > - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStepContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/components/SidePanelWorkflowViewStepContent.tsx similarity index 94% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStepContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/components/SidePanelWorkflowViewStepContent.tsx index 5c489ce111..a206ddecb7 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStepContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/components/SidePanelWorkflowViewStepContent.tsx @@ -11,7 +11,7 @@ const StyledContainer = styled.div` height: 100%; `; -export const CommandMenuWorkflowViewStepContent = () => { +export const SidePanelWorkflowViewStepContent = () => { const flow = useFlowOrThrow(); const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/hooks/useSidePanelWorkflowVersionIdOrThrow.ts b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/hooks/useSidePanelWorkflowVersionIdOrThrow.ts new file mode 100644 index 0000000000..fc4e5b8b1e --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view/hooks/useSidePanelWorkflowVersionIdOrThrow.ts @@ -0,0 +1,16 @@ +import { sidePanelWorkflowVersionIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowVersionIdComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { isDefined } from 'twenty-shared/utils'; + +export const useSidePanelWorkflowVersionIdOrThrow = () => { + const sidePanelWorkflowVersionId = useAtomComponentStateValue( + sidePanelWorkflowVersionIdComponentState, + ); + if (!isDefined(sidePanelWorkflowVersionId)) { + throw new Error( + 'Expected sidePanelWorkflowVersionIdComponentState to be defined', + ); + } + + return sidePanelWorkflowVersionId; +}; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerType.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerType.tsx similarity index 54% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerType.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerType.tsx index 66469d28c6..64bfa47fef 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerType.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerType.tsx @@ -1,10 +1,10 @@ -import { useCommandMenuWorkflowIdOrThrow } from '@/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow'; -import { CommandMenuWorkflowSelectTriggerTypeContent } from '@/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent'; +import { useSidePanelWorkflowIdOrThrow } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow'; +import { SidePanelWorkflowSelectTriggerTypeContent } from '@/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerTypeContent'; import { getWorkflowVisualizerComponentInstanceId } from '@/workflow/utils/getWorkflowVisualizerComponentInstanceId'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const CommandMenuWorkflowSelectTriggerType = () => { - const workflowId = useCommandMenuWorkflowIdOrThrow(); +export const SidePanelWorkflowSelectTriggerType = () => { + const workflowId = useSidePanelWorkflowIdOrThrow(); return ( { }), }} > - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerTypeContent.tsx similarity index 77% rename from packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx rename to packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerTypeContent.tsx index 04d231f43b..4b0155f907 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx +++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/trigger-type/components/SidePanelWorkflowSelectTriggerTypeContent.tsx @@ -1,5 +1,5 @@ -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { useCommandMenuWorkflowIdOrThrow } from '@/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { useSidePanelWorkflowIdOrThrow } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; @@ -8,8 +8,8 @@ import { type WorkflowTriggerType, } from '@/workflow/types/Workflow'; import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; -import { RightDrawerStepListContainer } from '@/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepContainer'; -import { RightDrawerWorkflowSelectStepTitle } from '@/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepTitle'; +import { SidePanelStepListContainer } from '@/workflow/workflow-steps/components/SidePanelWorkflowSelectStepContainer'; +import { SidePanelWorkflowSelectStepTitle } from '@/workflow/workflow-steps/components/SidePanelWorkflowSelectStepTitle'; import { DATABASE_TRIGGER_TYPES } from '@/workflow/workflow-trigger/constants/DatabaseTriggerTypes'; import { OTHER_TRIGGER_TYPES } from '@/workflow/workflow-trigger/constants/OtherTriggerTypes'; import { useUpdateWorkflowVersionTrigger } from '@/workflow/workflow-trigger/hooks/useUpdateWorkflowVersionTrigger'; @@ -22,10 +22,10 @@ import { useContext } from 'react'; import { MenuItem } from 'twenty-ui/navigation'; import { ThemeContext } from 'twenty-ui/theme-constants'; -export const CommandMenuWorkflowSelectTriggerTypeContent = () => { +export const SidePanelWorkflowSelectTriggerTypeContent = () => { const { theme } = useContext(ThemeContext); const { getIcon } = useIcons(); - const workflowId = useCommandMenuWorkflowIdOrThrow(); + const workflowId = useSidePanelWorkflowIdOrThrow(); const { updateTrigger } = useUpdateWorkflowVersionTrigger(); const { activeNonSystemObjectMetadataItems } = @@ -34,7 +34,7 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = () => { const setWorkflowSelectedNode = useSetAtomComponentState( workflowSelectedNodeComponentState, ); - const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowEditStepInSidePanel } = useSidePanelWorkflowNavigation(); const flow = useFlowOrThrow(); const handleTriggerTypeClick = ({ @@ -65,7 +65,7 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = () => { setWorkflowSelectedNode(TRIGGER_STEP_ID); - openWorkflowEditStepInCommandMenu( + openWorkflowEditStepInSidePanel( workflowId, defaultLabel, getIcon(icon), @@ -75,10 +75,10 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = () => { }; return ( - - + + {t`Data`} - + {DATABASE_TRIGGER_TYPES.map((action) => { const Icon = getIcon(action.icon); return ( @@ -92,9 +92,9 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = () => { ); })} - + {t`Others`} - + {OTHER_TRIGGER_TYPES.map((action) => { const Icon = getIcon(action.icon); return ( @@ -107,6 +107,6 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = () => { /> ); })} - + ); }; diff --git a/packages/twenty-front/src/modules/command-menu/states/contexts/CommandMenuPageComponentInstanceContext.tsx b/packages/twenty-front/src/modules/side-panel/states/contexts/SidePanelPageComponentInstanceContext.tsx similarity index 77% rename from packages/twenty-front/src/modules/command-menu/states/contexts/CommandMenuPageComponentInstanceContext.tsx rename to packages/twenty-front/src/modules/side-panel/states/contexts/SidePanelPageComponentInstanceContext.tsx index e1c6da4e3e..a9a244a5d1 100644 --- a/packages/twenty-front/src/modules/command-menu/states/contexts/CommandMenuPageComponentInstanceContext.tsx +++ b/packages/twenty-front/src/modules/side-panel/states/contexts/SidePanelPageComponentInstanceContext.tsx @@ -1,6 +1,6 @@ import { createComponentInstanceContext } from '@/ui/utilities/state/component-state/utils/createComponentInstanceContext'; -export const CommandMenuPageComponentInstanceContext = +export const SidePanelPageComponentInstanceContext = createComponentInstanceContext({ instanceId: '', }); diff --git a/packages/twenty-front/src/modules/side-panel/states/hasUserSelectedSidePanelListItemState.ts b/packages/twenty-front/src/modules/side-panel/states/hasUserSelectedSidePanelListItemState.ts new file mode 100644 index 0000000000..4d87706e02 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/states/hasUserSelectedSidePanelListItemState.ts @@ -0,0 +1,5 @@ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const hasUserSelectedSidePanelListItemState = createAtomState({ + key: 'hasUserSelectedSidePanelListItemState', + defaultValue: false, +}); diff --git a/packages/twenty-front/src/modules/command-menu/states/isSidePanelAnimatingState.ts b/packages/twenty-front/src/modules/side-panel/states/isSidePanelAnimatingState.ts similarity index 78% rename from packages/twenty-front/src/modules/command-menu/states/isSidePanelAnimatingState.ts rename to packages/twenty-front/src/modules/side-panel/states/isSidePanelAnimatingState.ts index f06d437daa..4f105b02bc 100644 --- a/packages/twenty-front/src/modules/command-menu/states/isSidePanelAnimatingState.ts +++ b/packages/twenty-front/src/modules/side-panel/states/isSidePanelAnimatingState.ts @@ -1,6 +1,6 @@ import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const isSidePanelAnimatingState = createAtomState({ - key: 'command-menu/isSidePanelAnimatingState', + key: 'side-panel/isSidePanelAnimatingState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/command-menu/states/hasUserSelectedCommandState.ts b/packages/twenty-front/src/modules/side-panel/states/isSidePanelClosingState.ts similarity index 52% rename from packages/twenty-front/src/modules/command-menu/states/hasUserSelectedCommandState.ts rename to packages/twenty-front/src/modules/side-panel/states/isSidePanelClosingState.ts index 7352a0f278..d4458b9b52 100644 --- a/packages/twenty-front/src/modules/command-menu/states/hasUserSelectedCommandState.ts +++ b/packages/twenty-front/src/modules/side-panel/states/isSidePanelClosingState.ts @@ -1,5 +1,5 @@ import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const hasUserSelectedCommandState = createAtomState({ - key: 'hasUserSelectedCommandState', +export const isSidePanelClosingState = createAtomState({ + key: 'side-panel/isSidePanelClosingState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/command-menu/states/isCommandMenuClosingState.ts b/packages/twenty-front/src/modules/side-panel/states/isSidePanelOpenedState.ts similarity index 50% rename from packages/twenty-front/src/modules/command-menu/states/isCommandMenuClosingState.ts rename to packages/twenty-front/src/modules/side-panel/states/isSidePanelOpenedState.ts index 0f0f4dd42d..a8fb6e8f74 100644 --- a/packages/twenty-front/src/modules/command-menu/states/isCommandMenuClosingState.ts +++ b/packages/twenty-front/src/modules/side-panel/states/isSidePanelOpenedState.ts @@ -1,5 +1,6 @@ import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isCommandMenuClosingState = createAtomState({ - key: 'command-menu/isCommandMenuClosingState', + +export const isSidePanelOpenedState = createAtomState({ + key: 'side-panel/isSidePanelOpenedState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationMorphItemsByPageState.ts b/packages/twenty-front/src/modules/side-panel/states/sidePanelNavigationMorphItemsByPageState.ts similarity index 61% rename from packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationMorphItemsByPageState.ts rename to packages/twenty-front/src/modules/side-panel/states/sidePanelNavigationMorphItemsByPageState.ts index 0d41a2e568..0a160c72e3 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationMorphItemsByPageState.ts +++ b/packages/twenty-front/src/modules/side-panel/states/sidePanelNavigationMorphItemsByPageState.ts @@ -1,9 +1,9 @@ import { type MorphItem } from '@/object-record/multiple-objects/types/MorphItem'; import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const commandMenuNavigationMorphItemsByPageState = createAtomState< +export const sidePanelNavigationMorphItemsByPageState = createAtomState< Map >({ - key: 'command-menu/commandMenuNavigationMorphItemsByPageState', + key: 'side-panel/sidePanelNavigationMorphItemsByPageState', defaultValue: new Map(), }); diff --git a/packages/twenty-front/src/modules/side-panel/states/sidePanelNavigationStackState.ts b/packages/twenty-front/src/modules/side-panel/states/sidePanelNavigationStackState.ts new file mode 100644 index 0000000000..5d16be87f4 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/states/sidePanelNavigationStackState.ts @@ -0,0 +1,18 @@ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +import { type SidePanelPages } from 'twenty-shared/types'; +import { type IconComponent } from 'twenty-ui/display'; + +export type SidePanelNavigationStackItem = { + page: SidePanelPages; + pageTitle: string; + pageIcon: IconComponent; + pageIconColor?: string; + pageId: string; +}; + +export const sidePanelNavigationStackState = createAtomState< + SidePanelNavigationStackItem[] +>({ + key: 'side-panel/sidePanelNavigationStackState', + defaultValue: [], +}); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuPageInfoState.ts b/packages/twenty-front/src/modules/side-panel/states/sidePanelPageInfoState.ts similarity index 73% rename from packages/twenty-front/src/modules/command-menu/states/commandMenuPageInfoState.ts rename to packages/twenty-front/src/modules/side-panel/states/sidePanelPageInfoState.ts index dbaebb8710..e1a6b70173 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuPageInfoState.ts +++ b/packages/twenty-front/src/modules/side-panel/states/sidePanelPageInfoState.ts @@ -1,12 +1,12 @@ -import { type IconComponent } from 'twenty-ui/display'; import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +import { type IconComponent } from 'twenty-ui/display'; -export const commandMenuPageInfoState = createAtomState<{ +export const sidePanelPageInfoState = createAtomState<{ title?: string; Icon?: IconComponent; instanceId: string; }>({ - key: 'command-menu/commandMenuPageInfoState', + key: 'side-panel/sidePanelPageInfoState', defaultValue: { title: undefined, Icon: undefined, diff --git a/packages/twenty-front/src/modules/side-panel/states/sidePanelPageState.ts b/packages/twenty-front/src/modules/side-panel/states/sidePanelPageState.ts new file mode 100644 index 0000000000..616cc5f089 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/states/sidePanelPageState.ts @@ -0,0 +1,7 @@ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +import { SidePanelPages } from 'twenty-shared/types'; + +export const sidePanelPageState = createAtomState({ + key: 'side-panel/sidePanelPageState', + defaultValue: SidePanelPages.Root, +}); diff --git a/packages/twenty-front/src/modules/side-panel/states/sidePanelSearchState.ts b/packages/twenty-front/src/modules/side-panel/states/sidePanelSearchState.ts new file mode 100644 index 0000000000..a0cdaff982 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/states/sidePanelSearchState.ts @@ -0,0 +1,5 @@ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const sidePanelSearchState = createAtomState({ + key: 'side-panel/sidePanelSearchState', + defaultValue: '', +}); diff --git a/packages/twenty-front/src/modules/side-panel/states/sidePanelShouldFocusTitleInputComponentState.ts b/packages/twenty-front/src/modules/side-panel/states/sidePanelShouldFocusTitleInputComponentState.ts new file mode 100644 index 0000000000..e6a8cc0165 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/states/sidePanelShouldFocusTitleInputComponentState.ts @@ -0,0 +1,10 @@ +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; + +import { SidePanelPageComponentInstanceContext } from './contexts/SidePanelPageComponentInstanceContext'; + +export const sidePanelShouldFocusTitleInputComponentState = + createAtomComponentState({ + key: 'sidePanelShouldFocusTitleInputComponentState', + defaultValue: false, + componentInstanceContext: SidePanelPageComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/side-panel/states/sidePanelWidthState.ts b/packages/twenty-front/src/modules/side-panel/states/sidePanelWidthState.ts new file mode 100644 index 0000000000..b84d3c44df --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/states/sidePanelWidthState.ts @@ -0,0 +1,10 @@ +import { SIDE_PANEL_CONSTRAINTS } from '@/side-panel/constants/SidePanelConstraints'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; + +export const SIDE_PANEL_WIDTH_VAR = '--side-panel-width'; + +export const sidePanelWidthState = createAtomState({ + key: 'sidePanelWidth', + defaultValue: SIDE_PANEL_CONSTRAINTS.default, + useLocalStorage: true, +}); diff --git a/packages/twenty-front/src/modules/side-panel/types/SidePanelActionGroupConfig.ts b/packages/twenty-front/src/modules/side-panel/types/SidePanelActionGroupConfig.ts new file mode 100644 index 0000000000..dcb54940ef --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/types/SidePanelActionGroupConfig.ts @@ -0,0 +1,6 @@ +import { type ActionConfig } from '@/action-menu/actions/types/ActionConfig'; + +export type SidePanelActionGroupConfig = { + heading: string; + items?: ActionConfig[]; +}; diff --git a/packages/twenty-front/src/modules/side-panel/types/SidePanelAnimationVariant.ts b/packages/twenty-front/src/modules/side-panel/types/SidePanelAnimationVariant.ts new file mode 100644 index 0000000000..469ef58fd5 --- /dev/null +++ b/packages/twenty-front/src/modules/side-panel/types/SidePanelAnimationVariant.ts @@ -0,0 +1,4 @@ +import { type SIDE_PANEL_ANIMATION_VARIANTS } from '@/side-panel/constants/SidePanelAnimationVariants'; + +export type SidePanelAnimationVariant = + keyof typeof SIDE_PANEL_ANIMATION_VARIANTS; diff --git a/packages/twenty-front/src/modules/command-menu/utils/getRecordContextText.ts b/packages/twenty-front/src/modules/side-panel/utils/getSelectedRecordsContextText.ts similarity index 100% rename from packages/twenty-front/src/modules/command-menu/utils/getRecordContextText.ts rename to packages/twenty-front/src/modules/side-panel/utils/getSelectedRecordsContextText.ts diff --git a/packages/twenty-front/src/modules/ui/layout/constants/RootStackingContextZIndices.ts b/packages/twenty-front/src/modules/ui/layout/constants/RootStackingContextZIndices.ts index 5a71a8720f..1a636f96d9 100644 --- a/packages/twenty-front/src/modules/ui/layout/constants/RootStackingContextZIndices.ts +++ b/packages/twenty-front/src/modules/ui/layout/constants/RootStackingContextZIndices.ts @@ -13,8 +13,8 @@ * TODO: add the other remaining components that can appear in the root stacking context */ export enum RootStackingContextZIndices { - CommandMenu = 21, - CommandMenuButton = 22, + SidePanel = 21, + SidePanelButton = 22, DropdownPortalBelowModal = 38, RootModalBackDrop = 39, RootModal = 40, diff --git a/packages/twenty-front/src/modules/ui/layout/contexts/LayoutRenderingContext.tsx b/packages/twenty-front/src/modules/ui/layout/contexts/LayoutRenderingContext.tsx index 88ad873c24..f5165763dc 100644 --- a/packages/twenty-front/src/modules/ui/layout/contexts/LayoutRenderingContext.tsx +++ b/packages/twenty-front/src/modules/ui/layout/contexts/LayoutRenderingContext.tsx @@ -10,7 +10,7 @@ export type LayoutRenderingContextType = { layoutType: PageLayoutType; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const [LayoutRenderingProvider, useLayoutRenderingContext] = diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/OptionsDropdownMenu.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/OptionsDropdownMenu.tsx index 28b911bbef..01cafb3cff 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/OptionsDropdownMenu.tsx +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/OptionsDropdownMenu.tsx @@ -1,4 +1,4 @@ -import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; +import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; diff --git a/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx b/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleSidePanelButton.tsx similarity index 68% rename from packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx rename to packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleSidePanelButton.tsx index ee6e079cad..abe8f7c48b 100644 --- a/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx +++ b/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleSidePanelButton.tsx @@ -1,9 +1,9 @@ -import { COMMAND_MENU_SEARCH_BAR_HEIGHT_MOBILE } from '@/command-menu/constants/CommandMenuSearchBarHeightMobile'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; +import { SIDE_PANEL_TOP_BAR_HEIGHT_MOBILE } from '@/side-panel/constants/SidePanelTopBarHeightMobile'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; import { isNavigationMenuInEditModeState } from '@/navigation-menu-item/states/isNavigationMenuInEditModeState'; import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices'; -import { PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/page-header/constants/PageHeaderCommandMenuButtonClickOutsideId'; +import { PAGE_HEADER_SIDE_PANEL_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/page-header/constants/PageHeaderSidePanelButtonClickOutsideId'; import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { styled } from '@linaria/react'; import { i18n } from '@lingui/core'; @@ -18,12 +18,12 @@ const StyledButtonWrapper = styled.div<{ alignToTop: boolean }>` align-items: ${({ alignToTop }) => (alignToTop ? 'center' : 'initial')}; display: ${({ alignToTop }) => (alignToTop ? 'flex' : 'block')}; height: ${({ alignToTop }) => - alignToTop ? `${COMMAND_MENU_SEARCH_BAR_HEIGHT_MOBILE}px` : 'auto'}; + alignToTop ? `${SIDE_PANEL_TOP_BAR_HEIGHT_MOBILE}px` : 'auto'}; position: ${({ alignToTop }) => (alignToTop ? 'fixed' : 'static')}; right: ${({ alignToTop }) => alignToTop ? themeCssVariables.spacing[3] : 'auto'}; top: ${({ alignToTop }) => (alignToTop ? '0' : 'auto')}; - z-index: ${RootStackingContextZIndices.CommandMenuButton}; + z-index: ${RootStackingContextZIndices.SidePanelButton}; `; const StyledTooltipWrapper = styled.div` @@ -38,9 +38,9 @@ const xPaths = { }; const AnimatedIcon = ({ - isCommandMenuOpened, + isSidePanelOpened, }: { - isCommandMenuOpened: boolean; + isSidePanelOpened: boolean; }) => { const { theme } = useContext(ThemeContext); @@ -64,8 +64,8 @@ const AnimatedIcon = ({ r="1" initial={{ opacity: 0 }} animate={{ - scale: isCommandMenuOpened ? 0 : 1, - opacity: isCommandMenuOpened ? 0 : 1, + scale: isSidePanelOpened ? 0 : 1, + opacity: isSidePanelOpened ? 0 : 1, }} transition={{ duration: theme.animation.duration.fast, @@ -79,13 +79,13 @@ const AnimatedIcon = ({ d={path} initial={{ pathLength: 0, opacity: 0 }} animate={{ - pathLength: isCommandMenuOpened ? 1 : 0, - opacity: isCommandMenuOpened ? 1 : 0, + pathLength: isSidePanelOpened ? 1 : 0, + opacity: isSidePanelOpened ? 1 : 0, }} transition={{ duration: theme.animation.duration.fast, ease: 'easeInOut', - delay: isCommandMenuOpened ? 0.1 : 0, + delay: isSidePanelOpened ? 0.1 : 0, }} /> ))} @@ -97,8 +97,8 @@ const AnimatedIcon = ({ r="1" initial={{ opacity: 0 }} animate={{ - scale: isCommandMenuOpened ? 0 : 1, - opacity: isCommandMenuOpened ? 0 : 1, + scale: isSidePanelOpened ? 0 : 1, + opacity: isSidePanelOpened ? 0 : 1, }} transition={{ duration: theme.animation.duration.fast, @@ -112,8 +112,8 @@ const AnimatedIcon = ({ r="1" initial={{ opacity: 0 }} animate={{ - scale: isCommandMenuOpened ? 0 : 1, - opacity: isCommandMenuOpened ? 0 : 1, + scale: isSidePanelOpened ? 0 : 1, + opacity: isSidePanelOpened ? 0 : 1, }} transition={{ duration: theme.animation.duration.fast, @@ -123,39 +123,38 @@ const AnimatedIcon = ({ ); }; -export const PageHeaderToggleCommandMenuButton = () => { - const { theme } = useContext(ThemeContext); - const { toggleCommandMenu } = useCommandMenu(); - const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState); +export const PageHeaderToggleSidePanelButton = () => { + const { toggleSidePanelMenu } = useSidePanelMenu(); + const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState); const isNavigationMenuInEditMode = useAtomStateValue( isNavigationMenuInEditModeState, ); const isMobile = useIsMobile(); - const alignWithCommandMenuTopBar = - isMobile && isNavigationMenuInEditMode && isCommandMenuOpened; + const alignWithSidePanelTopBar = + isMobile && isNavigationMenuInEditMode && isSidePanelOpened; - const ariaLabel = isCommandMenuOpened - ? t`Close command menu` - : t`Open command menu`; + const ariaLabel = isSidePanelOpened + ? t`Close side panel` + : t`Open side panel`; + + const { theme } = useContext(ThemeContext); return ( - -
+ +
- } - dataClickOutsideId={PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID} - dataTestId="page-header-command-menu-button" + animatedSvg={} + dataClickOutsideId={PAGE_HEADER_SIDE_PANEL_BUTTON_CLICK_OUTSIDE_ID} + dataTestId="page-header-side-panel-button" size={isMobile ? 'medium' : 'small'} variant="secondary" accent="default" hotkeys={[getOsControlSymbol(), 'K']} ariaLabel={ariaLabel} - onClick={toggleCommandMenu} + onClick={toggleSidePanelMenu} animate={{ - rotate: isCommandMenuOpened ? 90 : 0, + rotate: isSidePanelOpened ? 90 : 0, }} transition={{ duration: theme.animation.duration.normal, @@ -166,7 +165,7 @@ export const PageHeaderToggleCommandMenuButton = () => { ` diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/contexts/RightDrawerContext.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/contexts/RightDrawerContext.tsx deleted file mode 100644 index 55b9f3d691..0000000000 --- a/packages/twenty-front/src/modules/ui/layout/right-drawer/contexts/RightDrawerContext.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createRequiredContext } from '~/utils/createRequiredContext'; - -type RightDrawerContextType = { - isInRightDrawer: boolean; -}; - -export const [RightDrawerProvider, useIsInRightDrawerOrThrow] = - createRequiredContext('RightDrawer'); diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerFooter.tsx b/packages/twenty-front/src/modules/ui/layout/side-panel/components/SidePanelFooter.tsx similarity index 87% rename from packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerFooter.tsx rename to packages/twenty-front/src/modules/ui/layout/side-panel/components/SidePanelFooter.tsx index 662fac7ce4..e0bcd992dc 100644 --- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerFooter.tsx +++ b/packages/twenty-front/src/modules/ui/layout/side-panel/components/SidePanelFooter.tsx @@ -15,11 +15,11 @@ const StyledContainer = styled.div` width: 100%; `; -type RightDrawerFooterProps = { +type SidePanelFooterProps = { actions: React.ReactNode[]; }; -export const RightDrawerFooter = ({ actions }: RightDrawerFooterProps) => { +export const SidePanelFooter = ({ actions }: SidePanelFooterProps) => { return ( {actions.map((action, index) => ( diff --git a/packages/twenty-front/src/modules/ui/layout/side-panel/contexts/SidePanelContext.tsx b/packages/twenty-front/src/modules/ui/layout/side-panel/contexts/SidePanelContext.tsx new file mode 100644 index 0000000000..269c540d0d --- /dev/null +++ b/packages/twenty-front/src/modules/ui/layout/side-panel/contexts/SidePanelContext.tsx @@ -0,0 +1,8 @@ +import { createRequiredContext } from '~/utils/createRequiredContext'; + +type SidePanelContextType = { + isInSidePanel: boolean; +}; + +export const [SidePanelProvider, useIsInSidePanelOrThrow] = + createRequiredContext('SidePanel'); diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useListenToSidePanelClosing.ts b/packages/twenty-front/src/modules/ui/layout/side-panel/hooks/useListenToSidePanelClosing.ts similarity index 75% rename from packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useListenToSidePanelClosing.ts rename to packages/twenty-front/src/modules/ui/layout/side-panel/hooks/useListenToSidePanelClosing.ts index d3640744cd..c7e37aeff2 100644 --- a/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useListenToSidePanelClosing.ts +++ b/packages/twenty-front/src/modules/ui/layout/side-panel/hooks/useListenToSidePanelClosing.ts @@ -1,4 +1,4 @@ -import { SIDE_PANEL_CLOSE_EVENT_NAME } from '@/ui/layout/right-drawer/utils/emitSidePanelCloseEvent'; +import { SIDE_PANEL_CLOSE_EVENT_NAME } from '@/ui/layout/side-panel/utils/emitSidePanelCloseEvent'; import { useEffect } from 'react'; export const useListenToSidePanelClosing = (callback: () => void) => { diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useListenToSidePanelOpening.ts b/packages/twenty-front/src/modules/ui/layout/side-panel/hooks/useListenToSidePanelOpening.ts similarity index 75% rename from packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useListenToSidePanelOpening.ts rename to packages/twenty-front/src/modules/ui/layout/side-panel/hooks/useListenToSidePanelOpening.ts index 724ffd6393..eafad11c30 100644 --- a/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useListenToSidePanelOpening.ts +++ b/packages/twenty-front/src/modules/ui/layout/side-panel/hooks/useListenToSidePanelOpening.ts @@ -1,4 +1,4 @@ -import { SIDE_PANEL_OPEN_EVENT_NAME } from '@/ui/layout/right-drawer/utils/emitSidePanelOpenEvent'; +import { SIDE_PANEL_OPEN_EVENT_NAME } from '@/ui/layout/side-panel/utils/emitSidePanelOpenEvent'; import { useEffect } from 'react'; export const useListenToSidePanelOpening = (callback: () => void) => { diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/utils/emitSidePanelCloseEvent.ts b/packages/twenty-front/src/modules/ui/layout/side-panel/utils/emitSidePanelCloseEvent.ts similarity index 100% rename from packages/twenty-front/src/modules/ui/layout/right-drawer/utils/emitSidePanelCloseEvent.ts rename to packages/twenty-front/src/modules/ui/layout/side-panel/utils/emitSidePanelCloseEvent.ts diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/utils/emitSidePanelOpenEvent.ts b/packages/twenty-front/src/modules/ui/layout/side-panel/utils/emitSidePanelOpenEvent.ts similarity index 100% rename from packages/twenty-front/src/modules/ui/layout/right-drawer/utils/emitSidePanelOpenEvent.ts rename to packages/twenty-front/src/modules/ui/layout/side-panel/utils/emitSidePanelOpenEvent.ts diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx index 5f25f35579..9c74c3cb20 100644 --- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx +++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx @@ -46,7 +46,7 @@ export const TabList = ({ tabs, loading, behaveAsLinks = true, - isInRightDrawer, + isInSidePanel, className, componentInstanceId, onChangeTab, @@ -118,7 +118,7 @@ export const TabList = ({ > <> tab.id)} /> diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx index 5f843789c2..8df2fed7a1 100644 --- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx +++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx @@ -6,12 +6,12 @@ import { useLocation } from 'react-router-dom'; type TabListFromUrlOptionalEffectProps = { tabListIds: string[]; - isInRightDrawer: boolean; + isInSidePanel: boolean; }; export const TabListFromUrlOptionalEffect = ({ tabListIds, - isInRightDrawer, + isInSidePanel, }: TabListFromUrlOptionalEffectProps) => { const location = useLocation(); const activeTabId = useAtomComponentStateValue(activeTabIdComponentState); @@ -20,7 +20,7 @@ export const TabListFromUrlOptionalEffect = ({ const hash = location.hash.replace('#', ''); useEffect(() => { - if (isInRightDrawer) { + if (isInSidePanel) { return; } @@ -31,7 +31,7 @@ export const TabListFromUrlOptionalEffect = ({ if (tabListIds.includes(hash)) { setActiveTabId(hash); } - }, [hash, activeTabId, setActiveTabId, tabListIds, isInRightDrawer]); + }, [hash, activeTabId, setActiveTabId, tabListIds, isInSidePanel]); return <>; }; diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsx index 5612ec9496..8147efad4f 100644 --- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsx +++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsx @@ -76,7 +76,7 @@ export const Default: Story = { componentInstanceId={args.componentInstanceId} loading={args.loading} behaveAsLinks={args.behaveAsLinks} - isInRightDrawer={args.isInRightDrawer} + isInSidePanel={args.isInSidePanel} className={args.className} /> diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.ts b/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.ts index 50672054ae..9d769e4fbc 100644 --- a/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.ts +++ b/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.ts @@ -5,7 +5,7 @@ export type TabListProps = { loading?: boolean; behaveAsLinks?: boolean; className?: string; - isInRightDrawer?: boolean; + isInSidePanel?: boolean; componentInstanceId: string; onChangeTab?: (tabId: string) => void; }; diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx index 2a756f4599..ca516e9156 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx @@ -4,7 +4,7 @@ import { IconSearch } from 'twenty-ui/display'; import { LightIconButton } from 'twenty-ui/input'; import { themeCssVariables } from 'twenty-ui/theme-constants'; -import { useOpenRecordsSearchPageInCommandMenu } from '@/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu'; +import { useOpenRecordsSearchPageInSidePanel } from '@/side-panel/hooks/useOpenRecordsSearchPageInSidePanel'; import { PAGE_BAR_MIN_HEIGHT } from '@/ui/layout/page/constants/PageBarMinHeight'; import { MultiWorkspaceDropdownButton } from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/MultiWorkspaceDropdownButton'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; @@ -56,7 +56,7 @@ export const NavigationDrawerHeader = ({ showCollapseButton, }: NavigationDrawerHeaderProps) => { const isMobile = useIsMobile(); - const { openRecordsSearchPage } = useOpenRecordsSearchPageInCommandMenu(); + const { openRecordsSearchPage } = useOpenRecordsSearchPageInSidePanel(); const isNavigationDrawerExpanded = useAtomStateValue( isNavigationDrawerExpandedState, ); diff --git a/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowRunOpeningInCommandMenuSideEffects.ts b/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowRunOpeningInSidePanelEffects.ts similarity index 89% rename from packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowRunOpeningInCommandMenuSideEffects.ts rename to packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowRunOpeningInSidePanelEffects.ts index ad86323673..46696f551d 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowRunOpeningInCommandMenuSideEffects.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowRunOpeningInSidePanelEffects.ts @@ -1,4 +1,4 @@ -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; @@ -18,15 +18,16 @@ import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; import { useStore } from 'jotai'; -export const useRunWorkflowRunOpeningInCommandMenuSideEffects = () => { +export const useRunWorkflowRunOpeningInSidePanelEffects = () => { const store = useStore(); const apolloCoreClient = useApolloCoreClient(); - const { openWorkflowRunViewStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowRunViewStepInSidePanel } = + useSidePanelWorkflowNavigation(); const { getIcon } = useIcons(); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); - const runWorkflowRunOpeningInCommandMenuSideEffects = useCallback( + const runWorkflowRunOpeningInSidePanelEffects = useCallback( ({ objectMetadataItem, recordId, @@ -100,11 +101,11 @@ export const useRunWorkflowRunOpeningInCommandMenuSideEffects = () => { ...steps, { stepId: stepToOpenByDefault.id, - isInRightDrawer: true, + isInSidePanel: true, }, ], ); - openWorkflowRunViewStepInCommandMenu({ + openWorkflowRunViewStepInSidePanel({ workflowId: workflowRunRecord.workflowId, workflowRunId: workflowRunRecord.id, title: stepToOpenByDefault.data.name, @@ -116,13 +117,13 @@ export const useRunWorkflowRunOpeningInCommandMenuSideEffects = () => { [ apolloCoreClient.cache, objectPermissionsByObjectMetadataId, - openWorkflowRunViewStepInCommandMenu, + openWorkflowRunViewStepInSidePanel, getIcon, store, ], ); return { - runWorkflowRunOpeningInCommandMenuSideEffects, + runWorkflowRunOpeningInSidePanelEffects, }; }; diff --git a/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowVersion.tsx b/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowVersion.tsx index d957fffd02..7a07063ead 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowVersion.tsx +++ b/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowVersion.tsx @@ -1,6 +1,6 @@ import { triggerCreateRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerCreateRecordsOptimisticEffect'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useOpenRecordInCommandMenu } from '@/command-menu/hooks/useOpenRecordInCommandMenu'; +import { useOpenRecordInSidePanel } from '@/side-panel/hooks/useOpenRecordInSidePanel'; import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; @@ -62,7 +62,7 @@ export const useRunWorkflowVersion = () => { recordGqlFields: computedRecordGqlFields, }); - const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); + const { openRecordInSidePanel } = useOpenRecordInSidePanel(); const setRecordInStore = useCallback( (workflowRun: WorkflowRun) => { @@ -141,7 +141,7 @@ export const useRunWorkflowVersion = () => { variables: { input: { workflowVersionId, workflowRunId, payload } }, }); - openRecordInCommandMenu({ + openRecordInSidePanel({ objectNameSingular: CoreObjectNameSingular.WorkflowRun, recordId: workflowRunId, }); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx index fccc1c3a7b..ca852371cd 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx @@ -1,7 +1,7 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { commandMenuWidthState } from '@/command-menu/states/commandMenuWidthState'; -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; -import { useListenToSidePanelClosing } from '@/ui/layout/right-drawer/hooks/useListenToSidePanelClosing'; +import { sidePanelWidthState } from '@/side-panel/states/sidePanelWidthState'; +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; +import { useListenToSidePanelClosing } from '@/ui/layout/side-panel/hooks/useListenToSidePanelClosing'; import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; @@ -255,8 +255,8 @@ export const WorkflowDiagramCanvasBase = ({ return { nodes, edges }; }, [workflowDiagram, workflowInsertStepIds]); - const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState); - const { isInRightDrawer } = useContext(ActionMenuContext); + const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState); + const { isInSidePanel } = useContext(ActionMenuContext); const handleEdgesChange = ( edgeChanges: Array>, @@ -285,14 +285,14 @@ export const WorkflowDiagramCanvasBase = ({ const setFlowViewport = useCallback( ({ workflowDiagramFlowInitialized, - isCommandMenuOpened, + isSidePanelOpened, workflowDiagram, - isInRightDrawer, + isInSidePanel, }: { workflowDiagramFlowInitialized: boolean; - isCommandMenuOpened: boolean; + isSidePanelOpened: boolean; workflowDiagram: WorkflowDiagram | undefined; - isInRightDrawer: boolean; + isInSidePanel: boolean; }) => { if (!isDefined(containerRef.current) || !workflowDiagramFlowInitialized) { return; @@ -317,12 +317,12 @@ export const WorkflowDiagramCanvasBase = ({ let adjustedContainerWidth = baseContainerWidth; - const commandMenuWidth = store.get(commandMenuWidthState.atom); + const sidePanelWidth = store.get(sidePanelWidthState.atom); - if (!isInRightDrawer && isCommandMenuOpened) { - adjustedContainerWidth = baseContainerWidth - commandMenuWidth; - } else if (!isInRightDrawer && hasViewportBeenMoved) { - adjustedContainerWidth = baseContainerWidth + commandMenuWidth; + if (!isInSidePanel && isSidePanelOpened) { + adjustedContainerWidth = baseContainerWidth - sidePanelWidth; + } else if (!isInSidePanel && hasViewportBeenMoved) { + adjustedContainerWidth = baseContainerWidth + sidePanelWidth; } const flowBounds = reactflow.getNodesBounds(nodes); @@ -344,16 +344,16 @@ export const WorkflowDiagramCanvasBase = ({ const handleSetFlowViewportOnChange = useCallback( ({ workflowDiagramFlowInitialized, - isCommandMenuOpened, - isInRightDrawer, + isSidePanelOpened, + isInSidePanel, }: { workflowDiagramFlowInitialized: boolean; - isCommandMenuOpened: boolean; - isInRightDrawer: boolean; + isSidePanelOpened: boolean; + isInSidePanel: boolean; }) => { setFlowViewport({ - isInRightDrawer, - isCommandMenuOpened, + isInSidePanel, + isSidePanelOpened, workflowDiagramFlowInitialized, workflowDiagram: store.get(workflowDiagramCallbackState), }); @@ -364,14 +364,14 @@ export const WorkflowDiagramCanvasBase = ({ useEffect(() => { handleSetFlowViewportOnChange({ workflowDiagramFlowInitialized, - isCommandMenuOpened, - isInRightDrawer, + isSidePanelOpened, + isInSidePanel, }); }, [ handleSetFlowViewportOnChange, - isCommandMenuOpened, + isSidePanelOpened, workflowDiagramFlowInitialized, - isInRightDrawer, + isInSidePanel, ]); const handleNodesChanges = useCallback( @@ -407,19 +407,19 @@ export const WorkflowDiagramCanvasBase = ({ } setFlowViewport({ - isCommandMenuOpened, + isSidePanelOpened, workflowDiagramFlowInitialized, workflowDiagram: updatedWorkflowDiagram, - isInRightDrawer, + isInSidePanel, }); }, [ - isCommandMenuOpened, + isSidePanelOpened, setFlowViewport, workflowDiagramFlowInitialized, workflowDiagramCallbackState, workflowDiagramWaitingNodesDimensions, - isInRightDrawer, + isInSidePanel, store, ], ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizerEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizerEffect.tsx index 490a8d63f5..b7d71a0761 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizerEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizerEffect.tsx @@ -1,5 +1,5 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; @@ -63,11 +63,12 @@ export const WorkflowRunVisualizerEffect = ({ workflowRunDiagramAutomaticallyOpenedStepsComponentState, ); - const { openWorkflowRunViewStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowRunViewStepInSidePanel } = + useSidePanelWorkflowNavigation(); const { populateStepsOutputSchema } = useStepsOutputSchema(); - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); const store = useStore(); @@ -95,11 +96,11 @@ export const WorkflowRunVisualizerEffect = ({ ({ workflowRunState, workflowVersionId: versionId, - isInRightDrawer: inRightDrawer, + isInSidePanel: inSidePanel, }: { workflowRunState: WorkflowRunState | undefined; workflowVersionId: string | undefined; - isInRightDrawer: boolean; + isInSidePanel: boolean; }) => { if (!(isDefined(workflowRunState) && isDefined(versionId))) { store.set(flow, undefined); @@ -144,7 +145,7 @@ export const WorkflowRunVisualizerEffect = ({ workflowRunDiagramAutomaticallyOpenedSteps.some( (step) => step.stepId === stepToOpenByDefault.id && - step.isInRightDrawer === inRightDrawer, + step.isInSidePanel === inSidePanel, ); const currentWorkflowVisualizerWorkflowId = store.get( @@ -156,7 +157,7 @@ export const WorkflowRunVisualizerEffect = ({ ); } - if (inRightDrawer) { + if (inSidePanel) { store.set(workflowDiagram, baseWorkflowRunDiagram); } else { const workflowRunDiagram = selectWorkflowDiagramNode({ @@ -177,11 +178,11 @@ export const WorkflowRunVisualizerEffect = ({ ...workflowRunDiagramAutomaticallyOpenedSteps, { stepId: stepToOpenByDefault.id, - isInRightDrawer: inRightDrawer, + isInSidePanel: inSidePanel, }, ]); - openWorkflowRunViewStepInCommandMenu({ + openWorkflowRunViewStepInSidePanel({ workflowId: currentWorkflowVisualizerWorkflowId, workflowRunId, title: stepToOpenByDefault.data.name, @@ -193,7 +194,7 @@ export const WorkflowRunVisualizerEffect = ({ [ flow, getIcon, - openWorkflowRunViewStepInCommandMenu, + openWorkflowRunViewStepInSidePanel, workflowDiagram, workflowDiagramStatusState, workflowRunDiagramAutomaticallyOpenedStepsState, @@ -208,11 +209,11 @@ export const WorkflowRunVisualizerEffect = ({ handleWorkflowRunDiagramGeneration({ workflowRunState: workflowRun?.state ?? undefined, workflowVersionId: workflowRun?.workflowVersionId, - isInRightDrawer, + isInSidePanel, }); }, [ handleWorkflowRunDiagramGeneration, - isInRightDrawer, + isInSidePanel, workflowRun?.state, workflowRun?.workflowVersionId, ]); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts deleted file mode 100644 index a8e1470363..0000000000 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState'; -import { type CommandMenuAnimationVariant } from '@/command-menu/types/CommandMenuAnimationVariant'; -import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; -import { useIsMobile } from 'twenty-ui/utilities'; - -export const useRightDrawerState = (): { - rightDrawerState: CommandMenuAnimationVariant; -} => { - const isMobile = useIsMobile(); - const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedState); - - if (isMobile) { - return { - rightDrawerState: 'fullScreen', - }; - } - - return { - rightDrawerState: isCommandMenuOpened ? 'normal' : 'closed', - }; -}; diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSetInitialWorkflowRunRightDrawerTab.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSetInitialWorkflowRunSidePanelTab.ts similarity index 60% rename from packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSetInitialWorkflowRunRightDrawerTab.ts rename to packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSetInitialWorkflowRunSidePanelTab.ts index 7511299e32..c9c255c6d8 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSetInitialWorkflowRunRightDrawerTab.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSetInitialWorkflowRunSidePanelTab.ts @@ -1,6 +1,6 @@ -import { getIsInputTabDisabled } from '@/command-menu/pages/workflow/step/view-run/utils/getIsInputTabDisabled'; -import { getIsOutputTabDisabled } from '@/command-menu/pages/workflow/step/view-run/utils/getIsOutputTabDisabled'; -import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; +import { getIsInputTabDisabled } from '@/side-panel/pages/workflow/step/view-run/utils/getIsInputTabDisabled'; +import { getIsOutputTabDisabled } from '@/side-panel/pages/workflow/step/view-run/utils/getIsOutputTabDisabled'; +import { sidePanelPageInfoState } from '@/side-panel/states/sidePanelPageInfoState'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { WorkflowRunTabId } from '@/workflow/workflow-steps/types/WorkflowRunTabId'; import { useCallback } from 'react'; @@ -8,9 +8,9 @@ import { isDefined } from 'twenty-shared/utils'; import { type WorkflowRunStepStatus } from '@/workflow/types/Workflow'; import { useStore } from 'jotai'; -export const useSetInitialWorkflowRunRightDrawerTab = () => { +export const useSetInitialWorkflowRunSidePanelTab = () => { const store = useStore(); - const setInitialWorkflowRunRightDrawerTab = useCallback( + const setInitialWorkflowRunSidePanelTab = useCallback( ({ workflowSelectedNode, stepExecutionStatus, @@ -18,13 +18,13 @@ export const useSetInitialWorkflowRunRightDrawerTab = () => { workflowSelectedNode: string; stepExecutionStatus: WorkflowRunStepStatus; }) => { - const commandMenuPageInfo = store.get(commandMenuPageInfoState.atom); + const sidePanelPageInfo = store.get(sidePanelPageInfoState.atom); const activeTabId = activeTabIdComponentState.atomFamily({ - instanceId: commandMenuPageInfo.instanceId, + instanceId: sidePanelPageInfo.instanceId, }); - const activeWorkflowRunRightDrawerTab = store.get( + const activeWorkflowRunSidePanelTab = store.get( activeTabId, ) as WorkflowRunTabId | null; @@ -36,7 +36,7 @@ export const useSetInitialWorkflowRunRightDrawerTab = () => { stepExecutionStatus, }); - if (!isDefined(activeWorkflowRunRightDrawerTab)) { + if (!isDefined(activeWorkflowRunSidePanelTab)) { const defaultTabId = isOutputTabDisabled ? WorkflowRunTabId.NODE : WorkflowRunTabId.OUTPUT; @@ -48,9 +48,9 @@ export const useSetInitialWorkflowRunRightDrawerTab = () => { if ( (isInputTabDisabled && - activeWorkflowRunRightDrawerTab === WorkflowRunTabId.INPUT) || + activeWorkflowRunSidePanelTab === WorkflowRunTabId.INPUT) || (isOutputTabDisabled && - activeWorkflowRunRightDrawerTab === WorkflowRunTabId.OUTPUT) + activeWorkflowRunSidePanelTab === WorkflowRunTabId.OUTPUT) ) { store.set(activeTabId, WorkflowRunTabId.NODE); } @@ -59,6 +59,6 @@ export const useSetInitialWorkflowRunRightDrawerTab = () => { ); return { - setInitialWorkflowRunRightDrawerTab, + setInitialWorkflowRunSidePanelTab, }; }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSidePanelState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSidePanelState.ts new file mode 100644 index 0000000000..6617dc4d2e --- /dev/null +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useSidePanelState.ts @@ -0,0 +1,21 @@ +import { isSidePanelOpenedState } from '@/side-panel/states/isSidePanelOpenedState'; +import { type SidePanelAnimationVariant } from '@/side-panel/types/SidePanelAnimationVariant'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useIsMobile } from 'twenty-ui/utilities'; + +export const useSidePanelState = (): { + sidePanelState: SidePanelAnimationVariant; +} => { + const isMobile = useIsMobile(); + const isSidePanelOpened = useAtomStateValue(isSidePanelOpenedState); + + if (isMobile) { + return { + sidePanelState: 'fullScreen', + }; + } + + return { + sidePanelState: isSidePanelOpened ? 'normal' : 'closed', + }; +}; diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useStartNodeCreation.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useStartNodeCreation.ts index ab8969e3b5..e5475da357 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useStartNodeCreation.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useStartNodeCreation.ts @@ -1,6 +1,6 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; @@ -13,7 +13,7 @@ import { useCallback, useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const useStartNodeCreation = () => { - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); const [workflowInsertStepIds, setWorkflowInsertStepIds] = useAtomComponentState(workflowInsertStepIdsComponentState); @@ -22,14 +22,15 @@ export const useStartNodeCreation = () => { workflowSelectedNodeComponentState, ); - const { openWorkflowCreateStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowCreateStepInSidePanel } = + useSidePanelWorkflowNavigation(); const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); /** @@ -56,19 +57,19 @@ export const useStartNodeCreation = () => { return; } - if (!isInRightDrawer) { - setCommandMenuNavigationStack([]); + if (!isInSidePanel) { + setSidePanelNavigationStack([]); } - openWorkflowCreateStepInCommandMenu(workflowVisualizerWorkflowId); + openWorkflowCreateStepInSidePanel(workflowVisualizerWorkflowId); }, [ setWorkflowInsertStepIds, setWorkflowSelectedNode, workflowVisualizerWorkflowId, - isInRightDrawer, - openWorkflowCreateStepInCommandMenu, - setCommandMenuNavigationStack, + isInSidePanel, + openWorkflowCreateStepInSidePanel, + setSidePanelNavigationStack, ], ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition.ts index fe24dc98c8..a94bc453f3 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition.ts @@ -14,14 +14,14 @@ export const useWorkflowDiagramScreenToFlowPosition = () => { return; } - const visibleRightDrawerWidth = Number( - theme.rightDrawerWidth.replace('px', ''), + const visibleSidePanelWidth = Number( + theme.sidePanelWidth.replace('px', ''), ); const flowPosition = screenToFlowPosition(position); return { - x: flowPosition.x + visibleRightDrawerWidth / 2, + x: flowPosition.x + visibleSidePanelWidth / 2, y: flowPosition.y, }; }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowRunDiagramAutomaticallyOpenedStepsComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowRunDiagramAutomaticallyOpenedStepsComponentState.ts index 67d9aadec0..946823522d 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowRunDiagramAutomaticallyOpenedStepsComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowRunDiagramAutomaticallyOpenedStepsComponentState.ts @@ -2,7 +2,7 @@ import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/creat import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; export const workflowRunDiagramAutomaticallyOpenedStepsComponentState = - createAtomComponentState<{ stepId: string; isInRightDrawer: boolean }[]>({ + createAtomComponentState<{ stepId: string; isInSidePanel: boolean }[]>({ key: 'workflowRunDiagramAutomaticallyOpenedStepsComponentState', defaultValue: [], componentInstanceContext: WorkflowVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerEditable.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerEditable.tsx index cf2a7dd081..043554c3ae 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerEditable.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerEditable.tsx @@ -1,6 +1,6 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -21,7 +21,8 @@ import { isDefined } from 'twenty-shared/utils'; export const WorkflowDiagramEmptyTriggerEditable = ({ id }: { id: string }) => { const { t } = useLingui(); - const { openWorkflowTriggerTypeInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowTriggerTypeInSidePanel } = + useSidePanelWorkflowNavigation(); const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, @@ -31,10 +32,10 @@ export const WorkflowDiagramEmptyTriggerEditable = ({ id }: { id: string }) => { workflowSelectedNodeComponentState, ); - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); const selected = workflowSelectedNode === id; @@ -42,8 +43,8 @@ export const WorkflowDiagramEmptyTriggerEditable = ({ id }: { id: string }) => { const { resetWorkflowInsertStepIds } = useResetWorkflowInsertStepIds(); const handleClick = () => { - if (!isInRightDrawer) { - setCommandMenuNavigationStack([]); + if (!isInSidePanel) { + setSidePanelNavigationStack([]); } resetWorkflowInsertStepIds(); @@ -54,7 +55,7 @@ export const WorkflowDiagramEmptyTriggerEditable = ({ id }: { id: string }) => { return; } - openWorkflowTriggerTypeInCommandMenu(workflowVisualizerWorkflowId); + openWorkflowTriggerTypeInSidePanel(workflowVisualizerWorkflowId); }; return ( diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerReadonly.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerReadonly.tsx index 9939279b79..72ca2c8b38 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerReadonly.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerReadonly.tsx @@ -1,6 +1,6 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -35,12 +35,12 @@ export const WorkflowDiagramEmptyTriggerReadonly = ({ id }: { id: string }) => { workflowSelectedNodeComponentState, ); - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); - const { openWorkflowViewStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowViewStepInSidePanel } = useSidePanelWorkflowNavigation(); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); const selected = workflowSelectedNode === id; @@ -55,13 +55,13 @@ export const WorkflowDiagramEmptyTriggerReadonly = ({ id }: { id: string }) => { ); } - if (!isInRightDrawer) { - setCommandMenuNavigationStack([]); + if (!isInSidePanel) { + setSidePanelNavigationStack([]); } setWorkflowSelectedNode(TRIGGER_STEP_ID); - openWorkflowViewStepInCommandMenu({ + openWorkflowViewStepInSidePanel({ workflowId: workflowVisualizerWorkflowId, workflowVersionId: workflowVisualizerWorkflowVersionId, title: t`Add a Trigger`, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditable.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditable.tsx index b9ca3c0ca5..16a82e2b72 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditable.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditable.tsx @@ -1,6 +1,6 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -33,19 +33,19 @@ export const WorkflowDiagramStepNodeEditable = ({ const selected = workflowSelectedNode === id; - const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowEditStepInSidePanel } = useSidePanelWorkflowNavigation(); const { resetWorkflowInsertStepIds } = useResetWorkflowInsertStepIds(); - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); const handleClick = () => { - if (!isInRightDrawer) { - setCommandMenuNavigationStack([]); + if (!isInSidePanel) { + setSidePanelNavigationStack([]); } resetWorkflowInsertStepIds(); @@ -53,7 +53,7 @@ export const WorkflowDiagramStepNodeEditable = ({ setWorkflowSelectedNode(id); if (isDefined(workflowVisualizerWorkflowId)) { - openWorkflowEditStepInCommandMenu( + openWorkflowEditStepInSidePanel( workflowVisualizerWorkflowId, data.name, getIcon(getWorkflowNodeIconKey(data)), diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeReadonly.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeReadonly.tsx index 5a493d521f..95fa7580c5 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeReadonly.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeReadonly.tsx @@ -1,6 +1,6 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -48,12 +48,12 @@ export const WorkflowDiagramStepNodeReadonly = ({ const selected = workflowSelectedNode === id; - const { openWorkflowViewStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowViewStepInSidePanel } = useSidePanelWorkflowNavigation(); - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); const handleClick = () => { @@ -64,13 +64,13 @@ export const WorkflowDiagramStepNodeReadonly = ({ throw new Error('Workflow ID and Version ID must be defined'); } - if (!isInRightDrawer) { - setCommandMenuNavigationStack([]); + if (!isInSidePanel) { + setSidePanelNavigationStack([]); } setWorkflowSelectedNode(id); - openWorkflowViewStepInCommandMenu({ + openWorkflowViewStepInSidePanel({ workflowId: workflowVisualizerWorkflowId, workflowVersionId: workflowVisualizerWorkflowVersionId, title: data.name, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowRunDiagramStepNode.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowRunDiagramStepNode.tsx index 50512caed1..11b2bdd322 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowRunDiagramStepNode.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowRunDiagramStepNode.tsx @@ -1,6 +1,6 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { sidePanelNavigationStackState } from '@/side-panel/states/sidePanelNavigationStackState'; import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; @@ -92,12 +92,13 @@ export const WorkflowRunDiagramStepNode = ({ const selected = workflowSelectedNode === id; - const { openWorkflowRunViewStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowRunViewStepInSidePanel } = + useSidePanelWorkflowNavigation(); - const { isInRightDrawer } = useContext(ActionMenuContext); + const { isInSidePanel } = useContext(ActionMenuContext); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); const workflowRun = useWorkflowRun({ workflowRunId }); @@ -114,13 +115,13 @@ export const WorkflowRunDiagramStepNode = ({ throw new Error('Workflow ID must be defined'); } - if (!isInRightDrawer) { - setCommandMenuNavigationStack([]); + if (!isInSidePanel) { + setSidePanelNavigationStack([]); } setWorkflowSelectedNode(id); - openWorkflowRunViewStepInCommandMenu({ + openWorkflowRunViewStepInSidePanel({ workflowId: workflowVisualizerWorkflowId, workflowRunId, title: data.name, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepContainer.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/SidePanelWorkflowSelectStepContainer.tsx similarity index 83% rename from packages/twenty-front/src/modules/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepContainer.tsx rename to packages/twenty-front/src/modules/workflow/workflow-steps/components/SidePanelWorkflowSelectStepContainer.tsx index 52f3ff9ae2..42704a6888 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepContainer.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/SidePanelWorkflowSelectStepContainer.tsx @@ -11,4 +11,4 @@ const StyledStepListContainer = styled.div` padding-inline: ${themeCssVariables.spacing[2]}; `; -export { StyledStepListContainer as RightDrawerStepListContainer }; +export { StyledStepListContainer as SidePanelStepListContainer }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepTitle.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/SidePanelWorkflowSelectStepTitle.tsx similarity index 87% rename from packages/twenty-front/src/modules/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepTitle.tsx rename to packages/twenty-front/src/modules/workflow/workflow-steps/components/SidePanelWorkflowSelectStepTitle.tsx index 5e8079d52c..f30935614b 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/RightDrawerWorkflowSelectStepTitle.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/SidePanelWorkflowSelectStepTitle.tsx @@ -11,4 +11,4 @@ const StyledSelectStepTitle = styled.span` padding-right: ${themeCssVariables.spacing[1]}; `; -export { StyledSelectStepTitle as RightDrawerWorkflowSelectStepTitle }; +export { StyledSelectStepTitle as SidePanelWorkflowSelectStepTitle }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowRunStepInputDetail.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowRunStepInputDetail.tsx index a46f17776e..a687b87298 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowRunStepInputDetail.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowRunStepInputDetail.tsx @@ -1,4 +1,4 @@ -import { workflowRunIteratorSubStepIterationIndexComponentState } from '@/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState'; +import { workflowRunIteratorSubStepIterationIndexComponentState } from '@/side-panel/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow'; diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx index 6f3cda5754..69bb61eafa 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx @@ -1,8 +1,8 @@ -import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { useCommandMenuWorkflowIdOrThrow } from '@/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow'; +import { useSidePanelWorkflowNavigation } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowNavigation'; +import { useSidePanelWorkflowIdOrThrow } from '@/side-panel/pages/workflow/hooks/useSidePanelWorkflowIdOrThrow'; import { OptionsDropdownMenu } from '@/ui/layout/dropdown/components/OptionsDropdownMenu'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter'; +import { SidePanelFooter } from '@/ui/layout/side-panel/components/SidePanelFooter'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; @@ -37,11 +37,11 @@ export const WorkflowStepFooter = ({ const { t } = useLingui(); const { duplicateStep } = useDuplicateStep(); const { closeDropdown } = useCloseDropdown(); - const workflowId = useCommandMenuWorkflowIdOrThrow(); + const workflowId = useSidePanelWorkflowIdOrThrow(); const { - openWorkflowEditStepTypeInCommandMenu, - openWorkflowTriggerTypeInCommandMenu, - } = useWorkflowCommandMenu(); + openWorkflowEditStepTypeInSidePanel, + openWorkflowTriggerTypeInSidePanel, + } = useSidePanelWorkflowNavigation(); const { deleteStep } = useDeleteStep(); const navigateSettings = useNavigateSettings(); const workflowAiAgentActionAgent = useAtomStateValue( @@ -66,9 +66,9 @@ export const WorkflowStepFooter = ({ closeDropdown(dropdownId); if (stepId === TRIGGER_STEP_ID) { - openWorkflowTriggerTypeInCommandMenu(workflowId); + openWorkflowTriggerTypeInSidePanel(workflowId); } else { - openWorkflowEditStepTypeInCommandMenu(workflowId); + openWorkflowEditStepTypeInSidePanel(workflowId); } }; @@ -177,7 +177,7 @@ export const WorkflowStepFooter = ({ ); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterGroupColumn.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterGroupColumn.tsx index cd8cef76ae..f227d7471c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterGroupColumn.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowStepFilterGroupColumn.tsx @@ -1,4 +1,4 @@ -import { AdvancedFilterCommandMenuColumn } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuColumn'; +import { AdvancedFilterSidePanelColumn } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelColumn'; import { WorkflowStepFilterGroupChildren } from '@/workflow/workflow-steps/filters/components/WorkflowStepFilterGroupChildren'; import { WorkflowStepFilterGroupOptionsDropdown } from '@/workflow/workflow-steps/filters/components/WorkflowStepFilterGroupOptionsDropdown'; import { WorkflowStepFilterLogicalOperatorCell } from '@/workflow/workflow-steps/filters/components/WorkflowStepFilterLogicalOperatorCell'; @@ -29,7 +29,7 @@ export const WorkflowStepFilterGroupColumn = ({ const { readonly } = useContext(WorkflowStepFilterContext); return ( - + - + ); }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useDeleteStep.test.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useDeleteStep.test.tsx index ef3ab6a0f4..518623e932 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useDeleteStep.test.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useDeleteStep.test.tsx @@ -7,7 +7,7 @@ import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow- const mockDeleteWorkflowVersionStep = jest.fn(); const mockGetUpdatableWorkflowVersion = jest.fn(); const mockDeleteStepsOutputSchema = jest.fn(); -const mockCloseCommandMenu = jest.fn(); +const mockCloseSidePanel = jest.fn(); jest.mock( '@/workflow/workflow-steps/hooks/useDeleteWorkflowVersionStep', @@ -30,9 +30,9 @@ jest.mock('@/workflow/workflow-variables/hooks/useStepsOutputSchema', () => ({ }), })); -jest.mock('@/command-menu/hooks/useCommandMenu', () => ({ - useCommandMenu: () => ({ - closeCommandMenu: mockCloseCommandMenu, +jest.mock('@/side-panel/hooks/useSidePanelMenu', () => ({ + useSidePanelMenu: () => ({ + closeSidePanelMenu: mockCloseSidePanel, }), })); @@ -41,9 +41,9 @@ jest.mock('@/workflow/hooks/useWorkflowWithCurrentVersion', () => ({ })); jest.mock( - '@/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose', + '@/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnSidePanelClose', () => ({ - useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose: () => ({ + useResetWorkflowAiAgentPermissionsStateOnSidePanelClose: () => ({ resetPermissionState: jest.fn(), }), }), @@ -96,7 +96,7 @@ describe('useDeleteStep', () => { workflowVersionId: mockWorkflowVersionId, stepId: mockStepId, }); - expect(mockCloseCommandMenu).toHaveBeenCalled(); + expect(mockCloseSidePanel).toHaveBeenCalled(); expect(mockDeleteStepsOutputSchema).toHaveBeenCalledWith({ stepIds: [mockStepId], workflowVersionId: mockWorkflowVersionId, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteStep.ts index 520576a06c..72cd89779d 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteStep.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteStep.ts @@ -1,22 +1,22 @@ -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetUpdatableWorkflowVersionOrThrow } from '@/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { useDeleteWorkflowVersionStep } from '@/workflow/workflow-steps/hooks/useDeleteWorkflowVersionStep'; -import { useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose'; +import { useResetWorkflowAiAgentPermissionsStateOnSidePanelClose } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnSidePanelClose'; import { useStepsOutputSchema } from '@/workflow/workflow-variables/hooks/useStepsOutputSchema'; import { isDefined } from 'twenty-shared/utils'; export const useDeleteStep = () => { const { resetPermissionState } = - useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose(); + useResetWorkflowAiAgentPermissionsStateOnSidePanelClose(); const { deleteWorkflowVersionStep } = useDeleteWorkflowVersionStep(); const { deleteStepsOutputSchema } = useStepsOutputSchema(); const { getUpdatableWorkflowVersion } = useGetUpdatableWorkflowVersionOrThrow(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); @@ -35,7 +35,7 @@ export const useDeleteStep = () => { stepId, }); - closeCommandMenu(); + closeSidePanelMenu(); deleteStepsOutputSchema({ stepIds: [stepId], diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useWorkflowRunStepInfo.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useWorkflowRunStepInfo.ts index 8c33d4d202..48f7330786 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useWorkflowRunStepInfo.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useWorkflowRunStepInfo.ts @@ -1,4 +1,4 @@ -import { workflowRunIteratorSubStepIterationIndexComponentState } from '@/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState'; +import { workflowRunIteratorSubStepIterationIndexComponentState } from '@/side-panel/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState'; import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow'; diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab.tsx index 31e67a5d12..f700c525e9 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab.tsx @@ -15,7 +15,7 @@ import { isDefined } from 'twenty-shared/utils'; import { IconChevronLeft } from 'twenty-ui/display'; import { IconButton } from 'twenty-ui/input'; import { type Agent, useGetRolesQuery } from '~/generated-metadata/graphql'; -import { RightDrawerSkeletonLoader } from '~/loading/components/RightDrawerSkeletonLoader'; +import { SidePanelSkeletonLoader } from '~/loading/components/SidePanelSkeletonLoader'; import { filterBySearchQuery } from '~/utils/filterBySearchQuery'; import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey'; @@ -149,7 +149,7 @@ export const WorkflowAiAgentPermissionsTab = ({ }); if (isAgentLoading || rolesLoading) { - return ; + return ; } if (!isDefined(workflowAiAgentActionAgent)) { diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx index 56cfe3ff45..0590fa7c59 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx @@ -13,7 +13,7 @@ import { useUpdateWorkflowVersionStep } from '@/workflow/workflow-steps/hooks/us import { WorkflowAiAgentPermissionsTab } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab'; import { WORKFLOW_AI_AGENT_TAB_LIST_COMPONENT_ID } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/constants/WorkflowAiAgentTabListComponentId'; import { WORKFLOW_AI_AGENT_TABS } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/constants/WorkflowAiAgentTabs'; -import { useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose'; +import { useResetWorkflowAiAgentPermissionsStateOnSidePanelClose } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnSidePanelClose'; import { workflowAiAgentActionAgentState } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentState'; import { workflowAiAgentPermissionsIsAddingPermissionState } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionState'; import { styled } from '@linaria/react'; @@ -33,7 +33,7 @@ import { useUpdateOneAgentMutation, } from '~/generated-metadata/graphql'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; -import { RightDrawerSkeletonLoader } from '~/loading/components/RightDrawerSkeletonLoader'; +import { SidePanelSkeletonLoader } from '~/loading/components/SidePanelSkeletonLoader'; import { WorkflowAiAgentPromptTab } from './WorkflowAiAgentPromptTab'; import { themeCssVariables } from 'twenty-ui/theme-constants'; @@ -73,7 +73,7 @@ export const WorkflowEditActionAiAgent = ({ }, }, ); - useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose(); + useResetWorkflowAiAgentPermissionsStateOnSidePanelClose(); const [updateAgent] = useUpdateOneAgentMutation(); const aiModelOptions = useAiModelOptions(); const { updateWorkflowVersionStep } = useUpdateWorkflowVersionStep(); @@ -267,7 +267,7 @@ export const WorkflowEditActionAiAgent = ({ }; return agentLoading ? ( - + ) : ( <> { +export const useResetWorkflowAiAgentPermissionsStateOnSidePanelClose = () => { const setWorkflowAiAgentPermissionsSelectedObjectId = useSetAtomState( workflowAiAgentPermissionsSelectedObjectIdState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowActionCode.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowActionCode.tsx index aef500b362..df059d1fea 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowActionCode.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowActionCode.tsx @@ -1,6 +1,6 @@ import { type WorkflowCodeAction } from '@/workflow/types/Workflow'; import { lazy, Suspense } from 'react'; -import { RightDrawerSkeletonLoader } from '~/loading/components/RightDrawerSkeletonLoader'; +import { SidePanelSkeletonLoader } from '~/loading/components/SidePanelSkeletonLoader'; type WorkflowActionCodeProps = { action: WorkflowCodeAction; @@ -35,7 +35,7 @@ export const WorkflowActionCode = ({ actionOptions, }: WorkflowActionCodeProps) => { return ( - }> + }> {actionOptions.readonly ? ( ) : ( diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx index f9aa9c7152..5c88e4a7d7 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx @@ -2,7 +2,7 @@ import { type ConnectedAccount } from '@/accounts/types/ConnectedAccount'; import { getMissingDraftEmailScopes } from '@/accounts/utils/hasMissingDraftEmailScopes'; import { WorkflowSendEmailAttachments } from '@/advanced-text-editor/components/WorkflowSendEmailAttachments'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; +import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu'; import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; import { FormAdvancedTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormAdvancedTextFieldInput'; import { FormMultiTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormMultiTextFieldInput'; @@ -185,7 +185,7 @@ export const WorkflowEditActionEmailBase = ({ const navigate = useNavigateSettings(); - const { closeCommandMenu } = useCommandMenu(); + const { closeSidePanelMenu } = useSidePanelMenu(); useEffect(() => { return () => { @@ -206,7 +206,7 @@ export const WorkflowEditActionEmailBase = ({ options={connectedAccountOptions} callToActionButton={{ onClick: () => { - closeCommandMenu(); + closeSidePanelMenu(); navigate(SettingsPath.NewAccount); }, Icon: IconPlus, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmpty.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmpty.tsx index 9e43f9ddeb..9a03024f9f 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmpty.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmpty.tsx @@ -1,5 +1,5 @@ -import { CommandMenuWorkflowSelectAction } from '@/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction'; -import { CommandMenuWorkflowEditStepType } from '@/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepType'; +import { SidePanelWorkflowSelectAction } from '@/side-panel/pages/workflow/action/components/SidePanelWorkflowSelectAction'; +import { SidePanelWorkflowEditStepType } from '@/side-panel/pages/workflow/step/edit/components/SidePanelWorkflowEditStepType'; import { type WorkflowEmptyAction } from '@/workflow/types/Workflow'; type WorkflowEditActionEmptyProps = { @@ -17,8 +17,8 @@ export const WorkflowEditActionEmpty = ({ actionOptions, }: WorkflowEditActionEmptyProps) => { if (actionOptions.readonly === true) { - return {}} />; + return {}} />; } - return ; + return ; }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFilters.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFilters.tsx index 1f6b4f2d2b..3ff1a7f103 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFilters.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFilters.tsx @@ -1,6 +1,6 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { AdvancedFilterCommandMenuContainer } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer'; +import { AdvancedFilterSidePanelContainer } from '@/object-record/advanced-filter/side-panel/components/AdvancedFilterSidePanelContainer'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; @@ -44,7 +44,7 @@ export const WorkflowFindRecordsFilters = ({ }, [currentRecordFilterGroups, currentRecordFilters, onChange, store]); return ( - (action.settings.input); const workflowRunId = useWorkflowRunIdOrThrow(); - const { goBackFromCommandMenu } = useCommandMenuHistory(); + const { goBackFromSidePanel } = useSidePanelHistory(); const { updateWorkflowRunStep } = useUpdateWorkflowRunStep(); const [error, setError] = useState(undefined); @@ -89,7 +89,7 @@ export const WorkflowEditActionFormFiller = ({ response, }); - goBackFromCommandMenu(); + goBackFromSidePanel(); }; useEffect(() => { @@ -181,7 +181,7 @@ export const WorkflowEditActionFormFiller = ({ })} {!actionOptions.readonly && ( - ([]); const [searchInputValue, setSearchInputValue] = useState(''); - const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); + const { openWorkflowEditStepInSidePanel } = useSidePanelWorkflowNavigation(); const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, @@ -62,8 +62,8 @@ export const useVariableDropdown = ({ const setWorkflowDiagram = useSetAtomComponentState( workflowDiagramComponentState, ); - const setCommandMenuNavigationStack = useSetAtomState( - commandMenuNavigationStackState, + const setSidePanelNavigationStack = useSetAtomState( + sidePanelNavigationStackState, ); const getDisplayedSubStepFields = () => { @@ -122,9 +122,9 @@ export const useVariableDropdown = ({ }; }); - setCommandMenuNavigationStack([]); + setSidePanelNavigationStack([]); - openWorkflowEditStepInCommandMenu( + openWorkflowEditStepInSidePanel( workflowVisualizerWorkflowId, step.name, getIcon(step.icon), diff --git a/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx b/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx index 3c363e134b..9348475b00 100644 --- a/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx +++ b/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx @@ -5,13 +5,13 @@ import { ActionMenuComponentInstanceContext } from '@/action-menu/states/context import { TimelineActivityContext } from '@/activities/timeline-activities/contexts/TimelineActivityContext'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { MainContainerLayoutWithCommandMenu } from '@/object-record/components/MainContainerLayoutWithCommandMenu'; +import { MainContainerLayoutWithSidePanel } from '@/object-record/components/MainContainerLayoutWithSidePanel'; import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; import { PageLayoutRecordPageRenderer } from '@/object-record/record-show/components/PageLayoutRecordPageRenderer'; import { RecordShowPageSSESubscribeEffect } from '@/object-record/record-show/components/RecordShowPageSSESubscribeEffect'; import { useRecordShowPage } from '@/object-record/record-show/hooks/useRecordShowPage'; import { computeRecordShowComponentInstanceId } from '@/object-record/record-show/utils/computeRecordShowComponentInstanceId'; -import { PageHeaderToggleCommandMenuButton } from '@/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton'; +import { PageHeaderToggleSidePanelButton } from '@/ui/layout/page-header/components/PageHeaderToggleSidePanelButton'; import { PageContainer } from '@/ui/layout/page/components/PageContainer'; import { RecordShowPageHeader } from '~/pages/object-record/RecordShowPageHeader'; import { RecordShowPageTitle } from '~/pages/object-record/RecordShowPageTitle'; @@ -50,9 +50,9 @@ export const RecordShowPage = () => { objectRecordId={objectRecordId} > - + - + { id: objectRecordId, targetObjectNameSingular: objectNameSingular, }} - isInRightDrawer={false} + isInSidePanel={false} /> - + diff --git a/packages/twenty-front/src/testing/decorators/RightDrawerDecorator.tsx b/packages/twenty-front/src/testing/decorators/RightDrawerDecorator.tsx deleted file mode 100644 index c6ad7a80bc..0000000000 --- a/packages/twenty-front/src/testing/decorators/RightDrawerDecorator.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; -import { type Decorator } from '@storybook/react-vite'; - -export const RightDrawerDecorator: Decorator = (Story) => ( - - - -); diff --git a/packages/twenty-front/src/testing/decorators/SidePanelDecorator.tsx b/packages/twenty-front/src/testing/decorators/SidePanelDecorator.tsx new file mode 100644 index 0000000000..ee45788bf8 --- /dev/null +++ b/packages/twenty-front/src/testing/decorators/SidePanelDecorator.tsx @@ -0,0 +1,8 @@ +import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext'; +import { type Decorator } from '@storybook/react-vite'; + +export const SidePanelDecorator: Decorator = (Story) => ( + + + +); diff --git a/packages/twenty-front/src/testing/decorators/WorkflowStepDecorator.tsx b/packages/twenty-front/src/testing/decorators/WorkflowStepDecorator.tsx index 7eecf81433..7dde976fb4 100644 --- a/packages/twenty-front/src/testing/decorators/WorkflowStepDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/WorkflowStepDecorator.tsx @@ -1,5 +1,5 @@ -import { commandMenuWorkflowIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState'; -import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; +import { sidePanelWorkflowIdComponentState } from '@/side-panel/pages/workflow/states/sidePanelWorkflowIdComponentState'; +import { SidePanelPageComponentInstanceContext } from '@/side-panel/states/contexts/SidePanelPageComponentInstanceContext'; import { useLoadMockedObjectMetadataItems } from '@/object-metadata/hooks/useLoadMockedObjectMetadataItems'; import { flowComponentState } from '@/workflow/states/flowComponentState'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -69,7 +69,7 @@ export const WorkflowStepDecorator: Decorator = (Story) => { }, ); store.set( - commandMenuWorkflowIdComponentState.atomFamily({ + sidePanelWorkflowIdComponentState.atomFamily({ instanceId: workflowVisualizerComponentInstanceId, }), mockedWorkflow.id, @@ -93,7 +93,7 @@ export const WorkflowStepDecorator: Decorator = (Story) => { ); return ( - { > {ready && isDefined(workflowVersionId) && } - + ); }; diff --git a/packages/twenty-front/src/testing/mock-data/widget-configurations.ts b/packages/twenty-front/src/testing/mock-data/widget-configurations.ts index 533aae601b..30b828c4a9 100644 --- a/packages/twenty-front/src/testing/mock-data/widget-configurations.ts +++ b/packages/twenty-front/src/testing/mock-data/widget-configurations.ts @@ -1,8 +1,8 @@ -import { type TypedAggregateChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedAggregateChartConfiguration'; -import { type TypedBarChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedBarChartConfiguration'; -import { type TypedGaugeChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedGaugeChartConfiguration'; -import { type TypedLineChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedLineChartConfiguration'; -import { type TypedPieChartConfiguration } from '@/command-menu/pages/page-layout/types/TypedPieChartConfiguration'; +import { type TypedAggregateChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedAggregateChartConfiguration'; +import { type TypedBarChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedBarChartConfiguration'; +import { type TypedGaugeChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedGaugeChartConfiguration'; +import { type TypedLineChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedLineChartConfiguration'; +import { type TypedPieChartConfiguration } from '@/side-panel/pages/page-layout/types/TypedPieChartConfiguration'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types'; import { diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/__mocks__/permissions-check-front-component.ts b/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/__mocks__/permissions-check-front-component.ts index 6a1ce21c6d..c1c2eb5eb7 100644 --- a/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/__mocks__/permissions-check-front-component.ts +++ b/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/__mocks__/permissions-check-front-component.ts @@ -1,8 +1,4 @@ -import { - defineFrontComponent, - isInRightDrawer, - objectPermissions, -} from '@/sdk'; +import { defineFrontComponent, isInSidePanel, objectPermissions } from '@/sdk'; const MyComponent = () => null; @@ -13,6 +9,6 @@ export default defineFrontComponent({ universalIdentifier: 'permissions-check-cmd', label: 'Permissions Check', conditionalAvailabilityExpression: - objectPermissions.canUpdateObjectRecords && !isInRightDrawer, + objectPermissions.canUpdateObjectRecords && !isInSidePanel, }, }); diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/transform-conditional-availability-expressions.test.ts b/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/transform-conditional-availability-expressions.test.ts index 755a06e566..567971bfc9 100644 --- a/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/transform-conditional-availability-expressions.test.ts +++ b/packages/twenty-sdk/src/cli/utilities/build/common/conditional-availability/__tests__/transform-conditional-availability-expressions.test.ts @@ -14,7 +14,7 @@ const buildMockCommandMenuContextApi = ( overrides: Partial = {}, ): CommandMenuContextApi => ({ isShowPage: false, - isInRightDrawer: false, + isInSidePanel: false, isFavorite: false, isRemote: false, isNoteOrTask: false, @@ -210,9 +210,9 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => { }); describe('permissions-check-front-component', () => { - it('should allow when has permission and not in right drawer', () => { + it('should allow when has permission and not in side panel', () => { const context = buildMockCommandMenuContextApi({ - isInRightDrawer: false, + isInSidePanel: false, }); expect( @@ -223,9 +223,9 @@ describe('transformConditionalAvailabilityExpressionsForEsBuildPlugin', () => { ).toBe(true); }); - it('should deny when in right drawer', () => { + it('should deny when in side panel', () => { const context = buildMockCommandMenuContextApi({ - isInRightDrawer: true, + isInSidePanel: true, }); expect( diff --git a/packages/twenty-sdk/src/sdk/action/ActionOpenSidePanelPage.tsx b/packages/twenty-sdk/src/sdk/action/ActionOpenSidePanelPage.tsx index 3a8c8078a6..0e47c15363 100644 --- a/packages/twenty-sdk/src/sdk/action/ActionOpenSidePanelPage.tsx +++ b/packages/twenty-sdk/src/sdk/action/ActionOpenSidePanelPage.tsx @@ -7,10 +7,10 @@ import { } from '@/sdk/front-component-api'; import { useEffect, useState } from 'react'; -import { type CommandMenuPages } from 'twenty-shared/types'; +import { type SidePanelPages } from 'twenty-shared/types'; export type ActionOpenSidePanelPageProps = { - page: CommandMenuPages; + page: SidePanelPages; pageTitle: string; pageIcon: string; onClick?: () => void; diff --git a/packages/twenty-sdk/src/sdk/front-component-api/conditional-availability/conditional-availability-variables.ts b/packages/twenty-sdk/src/sdk/front-component-api/conditional-availability/conditional-availability-variables.ts index cf20ac74bd..a4a1444b8a 100644 --- a/packages/twenty-sdk/src/sdk/front-component-api/conditional-availability/conditional-availability-variables.ts +++ b/packages/twenty-sdk/src/sdk/front-component-api/conditional-availability/conditional-availability-variables.ts @@ -2,8 +2,8 @@ import { type CommandMenuContextApi } from 'twenty-shared/types'; export const isShowPage = null as unknown as CommandMenuContextApi['isShowPage']; -export const isInRightDrawer = - null as unknown as CommandMenuContextApi['isInRightDrawer']; +export const isInSidePanel = + null as unknown as CommandMenuContextApi['isInSidePanel']; export const isFavorite = null as unknown as CommandMenuContextApi['isFavorite']; export const isRemote = null as unknown as CommandMenuContextApi['isRemote']; diff --git a/packages/twenty-sdk/src/sdk/front-component-api/globals/frontComponentHostCommunicationApi.ts b/packages/twenty-sdk/src/sdk/front-component-api/globals/frontComponentHostCommunicationApi.ts index 478ef35063..72bada6bf2 100644 --- a/packages/twenty-sdk/src/sdk/front-component-api/globals/frontComponentHostCommunicationApi.ts +++ b/packages/twenty-sdk/src/sdk/front-component-api/globals/frontComponentHostCommunicationApi.ts @@ -1,6 +1,6 @@ import { type AppPath, - type CommandMenuPages, + type SidePanelPages, type EnqueueSnackbarParams, type NavigateOptions, } from 'twenty-shared/types'; @@ -14,7 +14,7 @@ export type NavigateFunction = ( ) => Promise; export type OpenSidePanelPageFunction = (params: { - page: CommandMenuPages; + page: SidePanelPages; pageTitle: string; pageIcon?: string; shouldResetSearchState?: boolean; diff --git a/packages/twenty-sdk/src/sdk/front-component-api/index.ts b/packages/twenty-sdk/src/sdk/front-component-api/index.ts index 465997f832..1ba878e427 100644 --- a/packages/twenty-sdk/src/sdk/front-component-api/index.ts +++ b/packages/twenty-sdk/src/sdk/front-component-api/index.ts @@ -1,6 +1,6 @@ export { isShowPage, - isInRightDrawer, + isInSidePanel, isFavorite, isRemote, isNoteOrTask, diff --git a/packages/twenty-sdk/src/sdk/index.ts b/packages/twenty-sdk/src/sdk/index.ts index 1191164651..209f62bb48 100644 --- a/packages/twenty-sdk/src/sdk/index.ts +++ b/packages/twenty-sdk/src/sdk/index.ts @@ -89,7 +89,7 @@ export type { // Conditional availability typed variables for command menu items export { isShowPage, - isInRightDrawer, + isInSidePanel, isFavorite, isRemote, isNoteOrTask, @@ -125,7 +125,7 @@ export type { FrontComponentExecutionContext, } from './front-component-api'; -export { AppPath, CommandMenuPages } from 'twenty-shared/types'; +export { AppPath, SidePanelPages } from 'twenty-shared/types'; export type { EnqueueSnackbarParams, SnackBarVariant, diff --git a/packages/twenty-shared/src/types/CommandMenuContextApi.ts b/packages/twenty-shared/src/types/CommandMenuContextApi.ts index e0de034f4b..8e2d2c6c61 100644 --- a/packages/twenty-shared/src/types/CommandMenuContextApi.ts +++ b/packages/twenty-shared/src/types/CommandMenuContextApi.ts @@ -3,7 +3,7 @@ import { type ObjectRecord } from './ObjectRecord'; export type CommandMenuContextApi = { isShowPage: boolean; - isInRightDrawer: boolean; + isInSidePanel: boolean; isFavorite: boolean; isRemote: boolean; isNoteOrTask: boolean; diff --git a/packages/twenty-shared/src/types/CommandMenuPages.ts b/packages/twenty-shared/src/types/SidePanelPages.ts similarity index 97% rename from packages/twenty-shared/src/types/CommandMenuPages.ts rename to packages/twenty-shared/src/types/SidePanelPages.ts index f48559eece..51aacc3af4 100644 --- a/packages/twenty-shared/src/types/CommandMenuPages.ts +++ b/packages/twenty-shared/src/types/SidePanelPages.ts @@ -1,4 +1,4 @@ -export enum CommandMenuPages { +export enum SidePanelPages { Root = 'root', ViewRecord = 'view-record', MergeRecords = 'merge-records', diff --git a/packages/twenty-shared/src/types/index.ts b/packages/twenty-shared/src/types/index.ts index 2e4d3aeb6f..df3febee90 100644 --- a/packages/twenty-shared/src/types/index.ts +++ b/packages/twenty-shared/src/types/index.ts @@ -16,7 +16,6 @@ export { AppPath } from './AppPath'; export type { Arrayable } from './Arrayable'; export type { ArraySortDirection } from './ArraySortDirection'; export type { CommandMenuContextApi } from './CommandMenuContextApi'; -export { CommandMenuPages } from './CommandMenuPages'; export type { ActorMetadata } from './composite-types/actor.composite-type'; export { FieldActorSource, @@ -250,6 +249,7 @@ export type { export type { SerializedRelation } from './SerializedRelation.type'; export { SERIALIZED_RELATION_BRAND } from './SerializedRelation.type'; export { SettingsPath } from './SettingsPath'; +export { SidePanelPages } from './SidePanelPages'; export type { Sources } from './SourcesType'; export type { StepFilterGroup, diff --git a/packages/twenty-ui/dist/theme-dark.css b/packages/twenty-ui/dist/theme-dark.css index f4074eeb8f..2aa8a026ca 100644 --- a/packages/twenty-ui/dist/theme-dark.css +++ b/packages/twenty-ui/dist/theme-dark.css @@ -67,7 +67,7 @@ --t-table-horizontal-cell-margin: 8px; --t-table-checkbox-column-width: 32px; --t-table-horizontal-cell-padding: 8px; - --t-right-drawer-width: 500px; + --t-side-panel-width: 500px; --t-clickable-element-background-transition: background 0.1s ease; --t-last-layer-z-index: 2147483647; --t-buttons-secondary-text-color: color(display-p3 0.63 0.69 1); diff --git a/packages/twenty-ui/dist/theme-light.css b/packages/twenty-ui/dist/theme-light.css index 9e18a5cd20..471f5e326b 100644 --- a/packages/twenty-ui/dist/theme-light.css +++ b/packages/twenty-ui/dist/theme-light.css @@ -67,7 +67,7 @@ --t-table-horizontal-cell-margin: 8px; --t-table-checkbox-column-width: 32px; --t-table-horizontal-cell-padding: 8px; - --t-right-drawer-width: 500px; + --t-side-panel-width: 500px; --t-clickable-element-background-transition: background 0.1s ease; --t-last-layer-z-index: 2147483647; --t-buttons-secondary-text-color: color(display-p3 0.63 0.69 1); diff --git a/packages/twenty-ui/src/theme-constants/theme-dark.css b/packages/twenty-ui/src/theme-constants/theme-dark.css index f4074eeb8f..2aa8a026ca 100644 --- a/packages/twenty-ui/src/theme-constants/theme-dark.css +++ b/packages/twenty-ui/src/theme-constants/theme-dark.css @@ -67,7 +67,7 @@ --t-table-horizontal-cell-margin: 8px; --t-table-checkbox-column-width: 32px; --t-table-horizontal-cell-padding: 8px; - --t-right-drawer-width: 500px; + --t-side-panel-width: 500px; --t-clickable-element-background-transition: background 0.1s ease; --t-last-layer-z-index: 2147483647; --t-buttons-secondary-text-color: color(display-p3 0.63 0.69 1); diff --git a/packages/twenty-ui/src/theme-constants/theme-light.css b/packages/twenty-ui/src/theme-constants/theme-light.css index 9e18a5cd20..471f5e326b 100644 --- a/packages/twenty-ui/src/theme-constants/theme-light.css +++ b/packages/twenty-ui/src/theme-constants/theme-light.css @@ -67,7 +67,7 @@ --t-table-horizontal-cell-margin: 8px; --t-table-checkbox-column-width: 32px; --t-table-horizontal-cell-padding: 8px; - --t-right-drawer-width: 500px; + --t-side-panel-width: 500px; --t-clickable-element-background-transition: background 0.1s ease; --t-last-layer-z-index: 2147483647; --t-buttons-secondary-text-color: color(display-p3 0.63 0.69 1); diff --git a/packages/twenty-ui/src/theme-constants/themeCssVariables.ts b/packages/twenty-ui/src/theme-constants/themeCssVariables.ts index ec867969e4..40b3a0432c 100644 --- a/packages/twenty-ui/src/theme-constants/themeCssVariables.ts +++ b/packages/twenty-ui/src/theme-constants/themeCssVariables.ts @@ -98,7 +98,7 @@ export const themeCssVariables = { checkboxColumnWidth: 'var(--t-table-checkbox-column-width)', horizontalCellPadding: 'var(--t-table-horizontal-cell-padding)', }, - rightDrawerWidth: 'var(--t-right-drawer-width)', + sidePanelWidth: 'var(--t-side-panel-width)', clickableElementBackgroundTransition: 'var(--t-clickable-element-background-transition)', lastLayerZIndex: 'var(--t-last-layer-z-index)', diff --git a/packages/twenty-ui/src/theme/constants/ThemeCommon.ts b/packages/twenty-ui/src/theme/constants/ThemeCommon.ts index 53f0ed0229..d1b1a4bf14 100644 --- a/packages/twenty-ui/src/theme/constants/ThemeCommon.ts +++ b/packages/twenty-ui/src/theme/constants/ThemeCommon.ts @@ -18,7 +18,7 @@ export const THEME_COMMON = { checkboxColumnWidth: '32px', horizontalCellPadding: '8px', }, - rightDrawerWidth: '500px', + sidePanelWidth: '500px', clickableElementBackgroundTransition: 'background 0.1s ease', lastLayerZIndex: 2147483647, buttons: {