Skip to content

The open alternative to Salesforce, designed for AI.

271 remove is command menu v2 enabled (#10809)

Raphaël Bosidaa501549e67
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/components/RecordActionMenuEntriesSetter.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/components/RecordActionMenuEntriesSetter.tsx
index 06217adc741..3e83e18e90b 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/components/RecordActionMenuEntriesSetter.tsx
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/components/RecordActionMenuEntriesSetter.tsx
@@ -27,10 +27,6 @@ export const RecordActionMenuEntriesSetter = () => {
FeatureFlagKey.IsWorkflowEnabled,
);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
if (!isDefined(contextStoreCurrentObjectMetadataItem)) {
return null;
}
@@ -40,10 +36,7 @@ export const RecordActionMenuEntriesSetter = () => {
contextStoreTargetedRecordsRule,
);
- const actionConfig = getActionConfig(
- contextStoreCurrentObjectMetadataItem,
- isCommandMenuV2Enabled,
- );
+ const actionConfig = getActionConfig(contextStoreCurrentObjectMetadataItem);
const actionsToRegister = isDefined(viewType)
? Object.values(actionConfig ?? {}).filter((action) =>
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDeleteSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDeleteSingleRecordAction.tsx
index acc44cc2892..88fd6a02d06 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDeleteSingleRecordAction.tsx
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDeleteSingleRecordAction.tsx
@@ -1,6 +1,5 @@
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
-import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
import { useDeleteFavorite } from '@/favorites/hooks/useDeleteFavorite';
import { useFavorites } from '@/favorites/hooks/useFavorites';
import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord';
@@ -8,10 +7,9 @@ import { recordStoreFamilyState } from '@/object-record/record-store/states/reco
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
import { t } from '@lingui/core/macro';
import { isNull } from '@sniptt/guards';
-import { useCallback, useContext, useState } from 'react';
+import { useCallback, useState } from 'react';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
import { getOsControlSymbol } from 'twenty-ui';
@@ -39,8 +37,6 @@ export const useDeleteSingleRecordAction: ActionHookWithObjectMetadataItem = ({
const { sortedFavorites: favorites } = useFavorites();
const { deleteFavorite } = useDeleteFavorite();
- const { closeRightDrawer } = useRightDrawer();
-
const handleDeleteClick = useCallback(async () => {
resetTableRowSelection();
@@ -63,8 +59,6 @@ export const useDeleteSingleRecordAction: ActionHookWithObjectMetadataItem = ({
const isRemoteObject = objectMetadataItem.isRemote;
- const { isInRightDrawer } = useContext(ActionMenuContext);
-
const shouldBeRegistered =
!isRemoteObject &&
isNull(selectedRecord?.deletedAt) &&
@@ -91,9 +85,6 @@ export const useDeleteSingleRecordAction: ActionHookWithObjectMetadataItem = ({
subtitle={t`Are you sure you want to delete this record? It can be recovered from the Command menu (${osControlSymbol} + K).`}
onConfirmClick={() => {
handleDeleteClick();
- if (isInRightDrawer) {
- closeRightDrawer({ emitCloseEvent: false });
- }
}}
confirmButtonText={'Delete Record'}
/>
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDestroySingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDestroySingleRecordAction.tsx
index ca017aef136..2962e44d014 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDestroySingleRecordAction.tsx
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDestroySingleRecordAction.tsx
@@ -1,14 +1,12 @@
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
-import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
import { useDestroyOneRecord } from '@/object-record/hooks/useDestroyOneRecord';
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
import { AppPath } from '@/types/AppPath';
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { useCallback, useContext, useState } from 'react';
+import { useCallback, useState } from 'react';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
import { useNavigateApp } from '~/hooks/useNavigateApp';
@@ -35,8 +33,6 @@ export const useDestroySingleRecordAction: ActionHookWithObjectMetadataItem = ({
const selectedRecord = useRecoilValue(recordStoreFamilyState(recordId));
- const { closeRightDrawer } = useRightDrawer();
-
const handleDeleteClick = useCallback(async () => {
resetTableRowSelection();
@@ -54,8 +50,6 @@ export const useDestroySingleRecordAction: ActionHookWithObjectMetadataItem = ({
const isRemoteObject = objectMetadataItem.isRemote;
- const { isInRightDrawer } = useContext(ActionMenuContext);
-
const shouldBeRegistered =
!hasObjectReadOnlyPermission &&
!isRemoteObject &&
@@ -82,9 +76,6 @@ export const useDestroySingleRecordAction: ActionHookWithObjectMetadataItem = ({
}
onConfirmClick={async () => {
await handleDeleteClick();
- if (isInRightDrawer) {
- closeRightDrawer();
- }
}}
confirmButtonText={'Permanently Destroy Record'}
/>
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useRestoreSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useRestoreSingleRecordAction.tsx
index 1462ba37db1..80abc8c229e 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useRestoreSingleRecordAction.tsx
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useRestoreSingleRecordAction.tsx
@@ -1,6 +1,5 @@
import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow';
import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook';
-import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
import { contextStoreCurrentViewTypeComponentState } from '@/context-store/states/contextStoreCurrentViewTypeComponentState';
import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType';
import { useRestoreManyRecords } from '@/object-record/hooks/useRestoreManyRecords';
@@ -9,9 +8,8 @@ import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTabl
import { isSoftDeleteFilterActiveComponentState } from '@/object-record/record-table/states/isSoftDeleteFilterActiveComponentState';
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-import { useCallback, useContext, useState } from 'react';
+import { useCallback, useState } from 'react';
import { useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
@@ -35,8 +33,6 @@ export const useRestoreSingleRecordAction: ActionHookWithObjectMetadataItem = ({
const selectedRecord = useRecoilValue(recordStoreFamilyState(recordId));
- const { closeRightDrawer } = useRightDrawer();
-
const handleRestoreClick = useCallback(async () => {
resetTableRowSelection();
@@ -55,8 +51,6 @@ export const useRestoreSingleRecordAction: ActionHookWithObjectMetadataItem = ({
useRecoilComponentValueV2(contextStoreCurrentViewTypeComponentState) ===
ContextStoreViewType.ShowPage;
- const { isInRightDrawer } = useContext(ActionMenuContext);
-
const shouldBeRegistered =
!isRemoteObject &&
isDefined(selectedRecord?.deletedAt) &&
@@ -73,9 +67,6 @@ export const useRestoreSingleRecordAction: ActionHookWithObjectMetadataItem = ({
const handleConfirmClick = () => {
handleRestoreClick();
- if (isInRightDrawer) {
- closeRightDrawer({ emitCloseEvent: false });
- }
};
return {
diff --git a/packages/twenty-front/src/modules/action-menu/actions/utils/getActionConfig.ts b/packages/twenty-front/src/modules/action-menu/actions/utils/getActionConfig.ts
index c63566edaa6..a7df5d492c1 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/utils/getActionConfig.ts
+++ b/packages/twenty-front/src/modules/action-menu/actions/utils/getActionConfig.ts
@@ -1,4 +1,3 @@
-import { DEFAULT_ACTIONS_CONFIG_V1 } from '@/action-menu/actions/record-actions/constants/DefaultActionsConfigV1';
import { DEFAULT_ACTIONS_CONFIG_V2 } from '@/action-menu/actions/record-actions/constants/DefaultActionsConfigV2';
import { WORKFLOW_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/constants/WorkflowActionsConfig';
import { WORKFLOW_RUNS_ACTIONS_CONFIG } from '@/action-menu/actions/record-actions/constants/WorkflowRunsActionsConfig';
@@ -6,10 +5,7 @@ import { WORKFLOW_VERSIONS_ACTIONS_CONFIG } from '@/action-menu/actions/record-a
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
-export const getActionConfig = (
- objectMetadataItem: ObjectMetadataItem,
- isCommandMenuV2Enabled: boolean,
-) => {
+export const getActionConfig = (objectMetadataItem: ObjectMetadataItem) => {
switch (objectMetadataItem.nameSingular) {
case CoreObjectNameSingular.Workflow:
return WORKFLOW_ACTIONS_CONFIG;
@@ -18,8 +14,6 @@ export const getActionConfig = (
case CoreObjectNameSingular.WorkflowRun:
return WORKFLOW_RUNS_ACTIONS_CONFIG;
default:
- return isCommandMenuV2Enabled
- ? DEFAULT_ACTIONS_CONFIG_V2
- : DEFAULT_ACTIONS_CONFIG_V1;
+ return DEFAULT_ACTIONS_CONFIG_V2;
}
};
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 bbc492cb8db..1d113e0000d 100644
--- a/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/CmdEnterActionButton.tsx
@@ -1,10 +1,7 @@
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
+import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { Key } from 'ts-key-enum';
import { Button, getOsControlSymbol } from 'twenty-ui';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { FeatureFlagKey } from '~/generated/graphql';
export const CmdEnterActionButton = ({
title,
@@ -15,15 +12,10 @@ export const CmdEnterActionButton = ({
onClick: () => void;
disabled?: boolean;
}) => {
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
useScopedHotkeys(
[`${Key.Control}+${Key.Enter}`, `${Key.Meta}+${Key.Enter}`],
() => onClick(),
- isCommandMenuV2Enabled
- ? AppHotkeyScope.CommandMenuOpen
- : RightDrawerHotkeyScope.RightDrawer,
+ AppHotkeyScope.CommandMenuOpen,
[onClick],
);
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 6bad7e63a2c..ee57a95c9d5 100644
--- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx
@@ -3,10 +3,8 @@ import { MultipleRecordsActionKeys } from '@/action-menu/actions/record-actions/
import { RecordAgnosticActionMenuEntriesSetter } from '@/action-menu/actions/record-agnostic-actions/components/RecordAgnosticActionMenuEntriesSetter';
import { RunWorkflowRecordAgnosticActionMenuEntriesSetter } from '@/action-menu/actions/record-agnostic-actions/components/RunWorkflowRecordAgnosticActionMenuEntriesSetter';
import { ActionMenuConfirmationModals } from '@/action-menu/components/ActionMenuConfirmationModals';
-import { RecordIndexActionMenuBar } from '@/action-menu/components/RecordIndexActionMenuBar';
import { RecordIndexActionMenuButtons } from '@/action-menu/components/RecordIndexActionMenuButtons';
import { RecordIndexActionMenuDropdown } from '@/action-menu/components/RecordIndexActionMenuDropdown';
-import { RecordIndexActionMenuEffect } from '@/action-menu/components/RecordIndexActionMenuEffect';
import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
import { contextStoreCurrentObjectMetadataItemComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemComponentState';
import { isRecordIndexLoadMoreLockedComponentState } from '@/object-record/record-index/states/isRecordIndexLoadMoreLockedComponentState';
@@ -21,10 +19,6 @@ export const RecordIndexActionMenu = ({ indexId }: { indexId: string }) => {
contextStoreCurrentObjectMetadataItemComponentState,
);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const isWorkflowEnabled = useIsFeatureEnabled(
FeatureFlagKey.IsWorkflowEnabled,
);
@@ -54,14 +48,9 @@ export const RecordIndexActionMenu = ({ indexId }: { indexId: string }) => {
},
}}
>
- {isCommandMenuV2Enabled ? (
- <>{!isMobile && <RecordIndexActionMenuButtons />}</>
- ) : (
- <RecordIndexActionMenuBar />
- )}
+ {!isMobile && <RecordIndexActionMenuButtons />}
<RecordIndexActionMenuDropdown />
<ActionMenuConfirmationModals />
- <RecordIndexActionMenuEffect />
<RecordActionMenuEntriesSetter />
<RecordAgnosticActionMenuEntriesSetter />
{isWorkflowEnabled && (
diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuBar.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuBar.tsx
deleted file mode 100644
index bdecf9e79d2..00000000000
--- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuBar.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { RecordIndexActionMenuBarAllActionsButton } from '@/action-menu/components/RecordIndexActionMenuBarAllActionsButton';
-import { RecordIndexActionMenuBarEntry } from '@/action-menu/components/RecordIndexActionMenuBarEntry';
-import { actionMenuEntriesComponentSelector } from '@/action-menu/states/actionMenuEntriesComponentSelector';
-import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';
-import { ActionBarHotkeyScope } from '@/action-menu/types/ActionBarHotKeyScope';
-import { getActionBarIdFromActionMenuId } from '@/action-menu/utils/getActionBarIdFromActionMenuId';
-import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState';
-import { BottomBar } from '@/ui/layout/bottom-bar/components/BottomBar';
-import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
-import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-import styled from '@emotion/styled';
-
-const StyledLabel = styled.div`
- color: ${({ theme }) => theme.font.color.tertiary};
- font-size: ${({ theme }) => theme.font.size.md};
- font-weight: ${({ theme }) => theme.font.weight.medium};
- padding-left: ${({ theme }) => theme.spacing(2)};
- padding-right: ${({ theme }) => theme.spacing(2)};
-`;
-
-export const RecordIndexActionMenuBar = () => {
- const contextStoreNumberOfSelectedRecords = useRecoilComponentValueV2(
- contextStoreNumberOfSelectedRecordsComponentState,
- );
-
- const actionMenuId = useAvailableComponentInstanceIdOrThrow(
- ActionMenuComponentInstanceContext,
- );
-
- const actionMenuEntries = useRecoilComponentValueV2(
- actionMenuEntriesComponentSelector,
- );
-
- const pinnedEntries = actionMenuEntries.filter((entry) => entry.isPinned);
- if (contextStoreNumberOfSelectedRecords === 0) {
- return null;
- }
-
- return (
- <BottomBar
- bottomBarId={getActionBarIdFromActionMenuId(actionMenuId)}
- bottomBarHotkeyScopeFromParent={{ scope: ActionBarHotkeyScope.ActionBar }}
- >
- <StyledLabel>{contextStoreNumberOfSelectedRecords} selected:</StyledLabel>
- {pinnedEntries.map((entry, index) => (
- <RecordIndexActionMenuBarEntry key={index} entry={entry} />
- ))}
- <RecordIndexActionMenuBarAllActionsButton />
- </BottomBar>
- );
-};
diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuEffect.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuEffect.tsx
deleted file mode 100644
index 66d49da9af6..00000000000
--- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuEffect.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-import { useActionMenu } from '@/action-menu/hooks/useActionMenu';
-import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';
-import { getActionBarIdFromActionMenuId } from '@/action-menu/utils/getActionBarIdFromActionMenuId';
-import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getActionMenuDropdownIdFromActionMenuId';
-import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
-import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState';
-import { isBottomBarOpenedComponentState } from '@/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState';
-import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
-import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
-import { extractComponentState } from '@/ui/utilities/state/component-state/utils/extractComponentState';
-import { useEffect } from 'react';
-import { useRecoilValue } from 'recoil';
-
-export const RecordIndexActionMenuEffect = () => {
- const contextStoreNumberOfSelectedRecords = useRecoilComponentValueV2(
- contextStoreNumberOfSelectedRecordsComponentState,
- );
-
- const actionMenuId = useAvailableComponentInstanceIdOrThrow(
- ActionMenuComponentInstanceContext,
- );
-
- const { openActionBar, closeActionBar } = useActionMenu(actionMenuId);
-
- // Using closeActionBar here was causing a bug because it goes back to the
- // previous hotkey scope, and we don't want that here.
- const setIsBottomBarOpened = useSetRecoilComponentStateV2(
- isBottomBarOpenedComponentState,
- getActionBarIdFromActionMenuId(actionMenuId),
- );
-
- const isDropdownOpen = useRecoilValue(
- extractComponentState(
- isDropdownOpenComponentState,
- getActionMenuDropdownIdFromActionMenuId(actionMenuId),
- ),
- );
- const { isRightDrawerOpen } = useRightDrawer();
-
- const isCommandMenuOpened = useRecoilValue(isCommandMenuOpenedState);
-
- useEffect(() => {
- if (
- contextStoreNumberOfSelectedRecords > 0 &&
- !isDropdownOpen &&
- !isRightDrawerOpen &&
- !isCommandMenuOpened
- ) {
- // We only handle opening the ActionMenuBar here, not the Dropdown.
- // The Dropdown is already managed by sync handlers for events like
- // right-click to open and click outside to close.
- openActionBar();
- }
- if (contextStoreNumberOfSelectedRecords === 0 && isDropdownOpen) {
- closeActionBar();
- }
- }, [
- contextStoreNumberOfSelectedRecords,
- openActionBar,
- closeActionBar,
- isDropdownOpen,
- isRightDrawerOpen,
- isCommandMenuOpened,
- ]);
-
- useEffect(() => {
- if (isRightDrawerOpen || isCommandMenuOpened) {
- setIsBottomBarOpened(false);
- }
- }, [isRightDrawerOpen, isCommandMenuOpened, setIsBottomBarOpened]);
-
- return null;
-};
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 cdc64886520..bc6c74b765d 100644
--- a/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx
@@ -5,40 +5,19 @@ import { ActionMenuConfirmationModals } from '@/action-menu/components/ActionMen
import { RecordShowActionMenuButtons } from '@/action-menu/components/RecordShowActionMenuButtons';
import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
import { contextStoreCurrentObjectMetadataItemComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemComponentState';
-import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
-import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { FeatureFlagKey } from '~/generated/graphql';
-import { RecordShowPageBaseHeader } from '~/pages/object-record/RecordShowPageBaseHeader';
-export const RecordShowActionMenu = ({
- isFavorite,
- record,
- objectMetadataItem,
- objectNameSingular,
- handleFavoriteButtonClick,
-}: {
- isFavorite: boolean;
- record: ObjectRecord | undefined;
- objectMetadataItem: ObjectMetadataItem;
- objectNameSingular: string;
- handleFavoriteButtonClick: () => void;
-}) => {
+export const RecordShowActionMenu = () => {
const contextStoreCurrentObjectMetadataItem = useRecoilComponentValueV2(
contextStoreCurrentObjectMetadataItemComponentState,
);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const isWorkflowEnabled = useIsFeatureEnabled(
FeatureFlagKey.IsWorkflowEnabled,
);
- // TODO: refactor RecordShowPageBaseHeader to use the context store
-
return (
<>
{contextStoreCurrentObjectMetadataItem && (
@@ -48,19 +27,7 @@ export const RecordShowActionMenu = ({
onActionExecutedCallback: () => {},
}}
>
- {isCommandMenuV2Enabled ? (
- <RecordShowActionMenuButtons />
- ) : (
- <RecordShowPageBaseHeader
- {...{
- isFavorite,
- record,
- objectMetadataItem,
- objectNameSingular,
- handleFavoriteButtonClick,
- }}
- />
- )}
+ <RecordShowActionMenuButtons />
<ActionMenuConfirmationModals />
<RecordActionMenuEntriesSetter />
<RecordAgnosticActionMenuEntriesSetter />
diff --git a/packages/twenty-front/src/modules/action-menu/components/RightDrawerActionMenuDropdown.tsx b/packages/twenty-front/src/modules/action-menu/components/RightDrawerActionMenuDropdown.tsx
index b7e7f219e80..cedd1f7325e 100644
--- a/packages/twenty-front/src/modules/action-menu/components/RightDrawerActionMenuDropdown.tsx
+++ b/packages/twenty-front/src/modules/action-menu/components/RightDrawerActionMenuDropdown.tsx
@@ -6,17 +6,14 @@ import { getRightDrawerActionMenuDropdownIdFromActionMenuId } from '@/action-men
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { useDropdownV2 } from '@/ui/layout/dropdown/hooks/useDropdownV2';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useTheme } from '@emotion/react';
import { i18n } from '@lingui/core';
import { Key } from 'ts-key-enum';
-import { Button, MenuItem, getOsControlSymbol } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated/graphql';
+import { Button, getOsControlSymbol, MenuItem } from 'twenty-ui';
export const RightDrawerActionMenuDropdown = () => {
const actionMenuEntries = useRecoilComponentValueV2(
@@ -31,10 +28,6 @@ export const RightDrawerActionMenuDropdown = () => {
const theme = useTheme();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
useScopedHotkeys(
[Key.Escape, 'ctrl+o,meta+o'],
() => {
@@ -53,9 +46,7 @@ export const RightDrawerActionMenuDropdown = () => {
getRightDrawerActionMenuDropdownIdFromActionMenuId(actionMenuId),
);
},
- isCommandMenuV2Enabled
- ? AppHotkeyScope.CommandMenuOpen
- : RightDrawerHotkeyScope.RightDrawer,
+ AppHotkeyScope.CommandMenuOpen,
[openDropdown],
);
diff --git a/packages/twenty-front/src/modules/action-menu/components/__stories__/RecordIndexActionMenuBar.stories.tsx b/packages/twenty-front/src/modules/action-menu/components/__stories__/RecordIndexActionMenuBar.stories.tsx
deleted file mode 100644
index 539f4577607..00000000000
--- a/packages/twenty-front/src/modules/action-menu/components/__stories__/RecordIndexActionMenuBar.stories.tsx
+++ /dev/null
@@ -1,141 +0,0 @@
-import { RecordIndexActionMenuBar } from '@/action-menu/components/RecordIndexActionMenuBar';
-import { actionMenuEntriesComponentState } from '@/action-menu/states/actionMenuEntriesComponentState';
-import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';
-import {
- ActionMenuEntry,
- ActionMenuEntryScope,
- ActionMenuEntryType,
-} from '@/action-menu/types/ActionMenuEntry';
-import { getActionBarIdFromActionMenuId } from '@/action-menu/utils/getActionBarIdFromActionMenuId';
-import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState';
-import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';
-import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext';
-import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext';
-import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext';
-import { RecordSortsComponentInstanceContext } from '@/object-record/record-sort/states/context/RecordSortsComponentInstanceContext';
-import { isBottomBarOpenedComponentState } from '@/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState';
-import { msg } from '@lingui/core/macro';
-import { expect, jest } from '@storybook/jest';
-import { Meta, StoryObj } from '@storybook/react';
-import { userEvent, waitFor, within } from '@storybook/test';
-import { RecoilRoot } from 'recoil';
-import { IconTrash, RouterDecorator } from 'twenty-ui';
-import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
-
-const deleteMock = jest.fn();
-
-const meta: Meta<typeof RecordIndexActionMenuBar> = {
- title: 'Modules/ActionMenu/RecordIndexActionMenuBar',
- component: RecordIndexActionMenuBar,
- decorators: [
- RouterDecorator,
- I18nFrontDecorator,
- (Story) => (
- <RecordFilterGroupsComponentInstanceContext.Provider
- value={{ instanceId: 'story-action-menu' }}
- >
- <RecordFiltersComponentInstanceContext.Provider
- value={{ instanceId: 'story-action-menu' }}
- >
- <RecordSortsComponentInstanceContext.Provider
- value={{ instanceId: 'story-action-menu' }}
- >
- <ContextStoreComponentInstanceContext.Provider
- value={{ instanceId: 'story-action-menu' }}
- >
- <RecoilRoot
- initializeState={({ set }) => {
- set(
- contextStoreTargetedRecordsRuleComponentState.atomFamily({
- instanceId: 'story-action-menu',
- }),
- {
- mode: 'selection',
- selectedRecordIds: ['1', '2', '3'],
- },
- );
- set(
- contextStoreNumberOfSelectedRecordsComponentState.atomFamily(
- {
- instanceId: 'story-action-menu',
- },
- ),
- 3,
- );
- const map = new Map<string, ActionMenuEntry>();
- map.set('delete', {
- isPinned: true,
- scope: ActionMenuEntryScope.RecordSelection,
- type: ActionMenuEntryType.Standard,
- key: 'delete',
- label: msg`Delete`,
- position: 0,
- Icon: IconTrash,
- onClick: deleteMock,
- });
- set(
- actionMenuEntriesComponentState.atomFamily({
- instanceId: 'story-action-menu',
- }),
- map,
- );
- set(
- isBottomBarOpenedComponentState.atomFamily({
- instanceId:
- getActionBarIdFromActionMenuId('story-action-menu'),
- }),
- true,
- );
- }}
- >
- <ActionMenuComponentInstanceContext.Provider
- value={{ instanceId: 'story-action-menu' }}
- >
- <Story />
- </ActionMenuComponentInstanceContext.Provider>
- </RecoilRoot>
- </ContextStoreComponentInstanceContext.Provider>
- </RecordSortsComponentInstanceContext.Provider>
- </RecordFiltersComponentInstanceContext.Provider>
- </RecordFilterGroupsComponentInstanceContext.Provider>
- ),
- ],
- args: {
- actionMenuId: 'story-action-menu',
- },
-};
-
-export default meta;
-
-type Story = StoryObj<typeof RecordIndexActionMenuBar>;
-
-export const Default: Story = {
- args: {
- actionMenuId: 'story-action-menu',
- },
-};
-
-export const WithCustomSelection: Story = {
- args: {
- actionMenuId: 'story-action-menu',
- },
- play: async ({ canvasElement }) => {
- const canvas = within(canvasElement);
- const selectionText = await canvas.findByText('3 selected:');
- expect(selectionText).toBeInTheDocument();
- },
-};
-
-export const WithButtonClicks: Story = {
- args: {
- actionMenuId: 'story-action-menu',
- },
- play: async ({ canvasElement }) => {
- const canvas = within(canvasElement);
- const deleteButton = await canvas.findByText('Delete');
- await userEvent.click(deleteButton);
- await waitFor(() => {
- expect(deleteMock).toHaveBeenCalled();
- });
- },
-};
diff --git a/packages/twenty-front/src/modules/action-menu/hooks/__tests__/useActionMenu.test.ts b/packages/twenty-front/src/modules/action-menu/hooks/__tests__/useActionMenu.test.ts
deleted file mode 100644
index aa00785961c..00000000000
--- a/packages/twenty-front/src/modules/action-menu/hooks/__tests__/useActionMenu.test.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import { getActionBarIdFromActionMenuId } from '@/action-menu/utils/getActionBarIdFromActionMenuId';
-import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getActionMenuDropdownIdFromActionMenuId';
-import { renderHook } from '@testing-library/react';
-import { act } from 'react';
-import { useActionMenu } from '../useActionMenu';
-
-const openBottomBar = jest.fn();
-const closeBottomBar = jest.fn();
-const openDropdown = jest.fn();
-const closeDropdown = jest.fn();
-
-jest.mock('@/ui/layout/bottom-bar/hooks/useBottomBar', () => ({
- useBottomBar: jest.fn(() => ({
- openBottomBar: openBottomBar,
- closeBottomBar: closeBottomBar,
- })),
-}));
-
-jest.mock('@/ui/layout/dropdown/hooks/useDropdownV2', () => ({
- useDropdownV2: jest.fn(() => ({
- openDropdown: openDropdown,
- closeDropdown: closeDropdown,
- })),
-}));
-
-describe('useActionMenu', () => {
- const actionMenuId = 'test-action-menu';
- const actionBarId = getActionBarIdFromActionMenuId(actionMenuId);
- const actionMenuDropdownId =
- getActionMenuDropdownIdFromActionMenuId(actionMenuId);
-
- it('should return the correct functions', () => {
- const { result } = renderHook(() => useActionMenu(actionMenuId));
-
- expect(result.current).toHaveProperty('openActionMenuDropdown');
- expect(result.current).toHaveProperty('openActionBar');
- expect(result.current).toHaveProperty('closeActionBar');
- expect(result.current).toHaveProperty('closeActionMenuDropdown');
- });
-
- it('should call the correct functions when opening action menu dropdown', () => {
- const { result } = renderHook(() => useActionMenu(actionMenuId));
-
- act(() => {
- result.current.openActionMenuDropdown();
- });
-
- expect(closeBottomBar).toHaveBeenCalledWith(actionBarId);
- expect(openDropdown).toHaveBeenCalledWith(actionMenuDropdownId);
- });
-
- it('should call the correct functions when opening action bar', () => {
- const { result } = renderHook(() => useActionMenu(actionMenuId));
-
- act(() => {
- result.current.openActionBar();
- });
-
- expect(closeDropdown).toHaveBeenCalledWith(actionMenuDropdownId);
- expect(openBottomBar).toHaveBeenCalledWith(actionBarId);
- });
-
- it('should call the correct function when closing action menu dropdown', () => {
- const { result } = renderHook(() => useActionMenu(actionMenuId));
-
- act(() => {
- result.current.closeActionMenuDropdown();
- });
-
- expect(closeDropdown).toHaveBeenCalledWith(actionMenuDropdownId);
- });
-
- it('should call the correct function when closing action bar', () => {
- const { result } = renderHook(() => useActionMenu(actionMenuId));
-
- act(() => {
- result.current.closeActionBar();
- });
-
- expect(closeBottomBar).toHaveBeenCalledWith(actionBarId);
- });
-});
diff --git a/packages/twenty-front/src/modules/action-menu/hooks/useActionMenu.ts b/packages/twenty-front/src/modules/action-menu/hooks/useActionMenu.ts
deleted file mode 100644
index 109bd1ee593..00000000000
--- a/packages/twenty-front/src/modules/action-menu/hooks/useActionMenu.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { getActionBarIdFromActionMenuId } from '@/action-menu/utils/getActionBarIdFromActionMenuId';
-import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getActionMenuDropdownIdFromActionMenuId';
-import { useBottomBar } from '@/ui/layout/bottom-bar/hooks/useBottomBar';
-import { useDropdownV2 } from '@/ui/layout/dropdown/hooks/useDropdownV2';
-
-export const useActionMenu = (actionMenuId: string) => {
- const { openDropdown, closeDropdown } = useDropdownV2();
- const { openBottomBar, closeBottomBar } = useBottomBar();
-
- const actionBarId = getActionBarIdFromActionMenuId(actionMenuId);
- const actionMenuDropdownId =
- getActionMenuDropdownIdFromActionMenuId(actionMenuId);
-
- const openActionMenuDropdown = () => {
- closeBottomBar(actionBarId);
- openDropdown(actionMenuDropdownId);
- };
-
- const openActionBar = () => {
- closeDropdown(actionMenuDropdownId);
- openBottomBar(actionBarId);
- };
-
- const closeActionMenuDropdown = () => {
- closeDropdown(actionMenuDropdownId);
- };
-
- const closeActionBar = () => {
- closeBottomBar(actionBarId);
- };
-
- return {
- openActionMenuDropdown,
- openActionBar,
- closeActionBar,
- closeActionMenuDropdown,
- };
-};
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx
index 2f29177c532..1e9e1a761d4 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsResponseStatusField.tsx
@@ -1,7 +1,6 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { useRef } from 'react';
-import { useRecoilValue } from 'recoil';
import { IconCheck, IconQuestionMark, IconX } from 'twenty-ui';
import { CalendarEventParticipant } from '@/activities/calendar/types/CalendarEventParticipant';
@@ -9,7 +8,6 @@ import { ParticipantChip } from '@/activities/components/ParticipantChip';
import { PropertyBox } from '@/object-record/record-inline-cell/property-box/components/PropertyBox';
import { EllipsisDisplay } from '@/ui/field/display/components/EllipsisDisplay';
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
-import { isRightDrawerAnimationCompletedState } from '@/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState';
const StyledInlineCellBaseContainer = styled.div`
align-items: center;
@@ -68,9 +66,6 @@ export const CalendarEventParticipantsResponseStatusField = ({
participants: CalendarEventParticipant[];
}) => {
const theme = useTheme();
- const isRightDrawerAnimationCompleted = useRecoilValue(
- isRightDrawerAnimationCompletedState,
- );
const Icon = {
Yes: <IconCheck stroke={theme.icon.stroke.sm} />,
@@ -103,9 +98,7 @@ export const CalendarEventParticipantsResponseStatusField = ({
</StyledLabelContainer>
</StyledLabelAndIconContainer>
<StyledDiv ref={participantsContainerRef}>
- {isRightDrawerAnimationCompleted && (
- <ExpandableList isChipCountDisplayed>{styledChips}</ExpandableList>
- )}
+ <ExpandableList isChipCountDisplayed>{styledChips}</ExpandableList>
</StyledDiv>
</StyledInlineCellBaseContainer>
</StyledPropertyBox>
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 9d986988c51..60deb9f74e7 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx
@@ -6,13 +6,11 @@ import { useRecoilValue } from 'recoil';
import { CalendarCurrentEventCursor } from '@/activities/calendar/components/CalendarCurrentEventCursor';
import { CalendarContext } from '@/activities/calendar/contexts/CalendarContext';
-import { useOpenCalendarEventRightDrawer } from '@/activities/calendar/right-drawer/hooks/useOpenCalendarEventRightDrawer';
import { getCalendarEventEndDate } from '@/activities/calendar/utils/getCalendarEventEndDate';
import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalendarEventStartDate';
import { hasCalendarEventEnded } from '@/activities/calendar/utils/hasCalendarEventEnded';
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { isDefined } from 'twenty-shared';
import {
Avatar,
@@ -24,7 +22,6 @@ import {
} from 'twenty-ui';
import {
CalendarChannelVisibility,
- FeatureFlagKey,
TimelineCalendarEvent,
} from '~/generated-metadata/graphql';
@@ -117,11 +114,7 @@ export const CalendarEventRow = ({
const theme = useTheme();
const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
const { displayCurrentEventCursor = false } = useContext(CalendarContext);
- const { openCalendarEventRightDrawer } = useOpenCalendarEventRightDrawer();
const { openCalendarEventInCommandMenu } = useCommandMenu();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
const startsAt = getCalendarEventStartDate(calendarEvent);
const endsAt = getCalendarEventEndDate(calendarEvent);
@@ -145,11 +138,7 @@ export const CalendarEventRow = ({
onClick={
showTitle
? () => {
- if (isCommandMenuV2Enabled) {
- openCalendarEventInCommandMenu(calendarEvent.id);
- } else {
- openCalendarEventRightDrawer(calendarEvent.id);
- }
+ openCalendarEventInCommandMenu(calendarEvent.id);
}
: undefined
}
diff --git a/packages/twenty-front/src/modules/activities/calendar/right-drawer/components/RightDrawerCalendarEvent.tsx b/packages/twenty-front/src/modules/activities/calendar/right-drawer/components/RightDrawerCalendarEvent.tsx
deleted file mode 100644
index 4e3ee38ae75..00000000000
--- a/packages/twenty-front/src/modules/activities/calendar/right-drawer/components/RightDrawerCalendarEvent.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { useRecoilValue } from 'recoil';
-
-import { CalendarEventDetails } from '@/activities/calendar/components/CalendarEventDetails';
-import { CalendarEventDetailsEffect } from '@/activities/calendar/components/CalendarEventDetailsEffect';
-import { FIND_ONE_CALENDAR_EVENT_OPERATION_SIGNATURE } from '@/activities/calendar/graphql/operation-signatures/FindOneCalendarEventOperationSignature';
-import { CalendarEvent } from '@/activities/calendar/types/CalendarEvent';
-import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { RecordValueSetterEffect } from '@/object-record/record-store/components/RecordValueSetterEffect';
-import { RecordFieldValueSelectorContextProvider } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext';
-import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
-
-export const RightDrawerCalendarEvent = () => {
- const { upsertRecords } = useUpsertRecordsInStore();
- const viewableRecordId = useRecoilValue(viewableRecordIdState);
-
- const { record: calendarEvent } = useFindOneRecord<CalendarEvent>({
- objectNameSingular:
- FIND_ONE_CALENDAR_EVENT_OPERATION_SIGNATURE.objectNameSingular,
- objectRecordId: viewableRecordId ?? '',
- recordGqlFields: FIND_ONE_CALENDAR_EVENT_OPERATION_SIGNATURE.fields,
- onCompleted: (record) => upsertRecords([record]),
- });
-
- if (!calendarEvent) {
- return null;
- }
-
- return (
- <RecordFieldValueSelectorContextProvider>
- <CalendarEventDetailsEffect record={calendarEvent} />
- <RecordValueSetterEffect recordId={calendarEvent.id} />
- <CalendarEventDetails calendarEvent={calendarEvent} />
- </RecordFieldValueSelectorContextProvider>
- );
-};
diff --git a/packages/twenty-front/src/modules/activities/calendar/right-drawer/hooks/__tests__/useOpenCalendarEventRightDrawer.test.tsx b/packages/twenty-front/src/modules/activities/calendar/right-drawer/hooks/__tests__/useOpenCalendarEventRightDrawer.test.tsx
deleted file mode 100644
index 9801608508e..00000000000
--- a/packages/twenty-front/src/modules/activities/calendar/right-drawer/hooks/__tests__/useOpenCalendarEventRightDrawer.test.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { act, renderHook } from '@testing-library/react';
-import { RecoilRoot, useRecoilValue } from 'recoil';
-
-import { useOpenCalendarEventRightDrawer } from '@/activities/calendar/right-drawer/hooks/useOpenCalendarEventRightDrawer';
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
-
-describe('useOpenCalendarEventRightDrawer', () => {
- it('opens the right drawer with the calendar event', () => {
- const { result } = renderHook(
- () => {
- const isRightDrawerOpen = useRecoilValue(isRightDrawerOpenState);
- const viewableRecordId = useRecoilValue(viewableRecordIdState);
- return {
- ...useOpenCalendarEventRightDrawer(),
- isRightDrawerOpen,
- viewableRecordId,
- };
- },
- { wrapper: RecoilRoot },
- );
-
- expect(result.current.isRightDrawerOpen).toBe(false);
- expect(result.current.viewableRecordId).toBeNull();
-
- act(() => {
- result.current.openCalendarEventRightDrawer('1234');
- });
-
- expect(result.current.isRightDrawerOpen).toBe(true);
- expect(result.current.viewableRecordId).toBe('1234');
- });
-});
diff --git a/packages/twenty-front/src/modules/activities/calendar/right-drawer/hooks/useOpenCalendarEventRightDrawer.ts b/packages/twenty-front/src/modules/activities/calendar/right-drawer/hooks/useOpenCalendarEventRightDrawer.ts
deleted file mode 100644
index 4575eb87511..00000000000
--- a/packages/twenty-front/src/modules/activities/calendar/right-drawer/hooks/useOpenCalendarEventRightDrawer.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { useSetRecoilState } from 'recoil';
-
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
-import { IconCalendarEvent } from 'twenty-ui';
-
-export const useOpenCalendarEventRightDrawer = () => {
- const { openRightDrawer } = useRightDrawer();
- const setHotkeyScope = useSetHotkeyScope();
- const setViewableRecordId = useSetRecoilState(viewableRecordIdState);
-
- const openCalendarEventRightDrawer = (calendarEventId: string) => {
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
- openRightDrawer(RightDrawerPages.ViewCalendarEvent, {
- title: 'Calendar Event',
- Icon: IconCalendarEvent,
- });
- setViewableRecordId(calendarEventId);
- };
-
- return { openCalendarEventRightDrawer };
-};
diff --git a/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx b/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx
index 036f2510e17..112a9694ff0 100644
--- a/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx
+++ b/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx
@@ -1,38 +1,35 @@
import { useApolloClient } from '@apollo/client';
-import { PartialBlock } from '@blocknote/core';
-import { useCreateBlockNote } from '@blocknote/react';
-import { isArray, isNonEmptyString } from '@sniptt/guards';
import { useCallback, useMemo } from 'react';
import { useRecoilCallback, useRecoilState } from 'recoil';
-import { Key } from 'ts-key-enum';
-import { useDebouncedCallback } from 'use-debounce';
import { v4 } from 'uuid';
+import { BLOCK_SCHEMA } from '@/activities/blocks/constants/Schema';
+import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile';
import { useUpsertActivity } from '@/activities/hooks/useUpsertActivity';
import { canCreateActivityState } from '@/activities/states/canCreateActivityState';
import { ActivityEditorHotkeyScope } from '@/activities/types/ActivityEditorHotkeyScope';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
+import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { modifyRecordFromCache } from '@/object-record/cache/utils/modifyRecordFromCache';
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
+import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey';
+import { Key } from 'ts-key-enum';
import { isDefined } from 'twenty-shared';
+import { useDebouncedCallback } from 'use-debounce';
-import { BLOCK_SCHEMA } from '@/activities/blocks/constants/Schema';
import { ActivityRichTextEditorChangeOnActivityIdEffect } from '@/activities/components/ActivityRichTextEditorChangeOnActivityIdEffect';
-import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile';
import { Note } from '@/activities/types/Note';
import { Task } from '@/activities/types/Task';
-import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { BlockEditor } from '@/ui/input/editor/components/BlockEditor';
-import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
+import { PartialBlock } from '@blocknote/core';
import '@blocknote/core/fonts/inter.css';
import '@blocknote/mantine/style.css';
+import { useCreateBlockNote } from '@blocknote/react';
import '@blocknote/react/style.css';
-import { FeatureFlagKey } from '~/generated/graphql';
+import { isArray, isNonEmptyString } from '@sniptt/guards';
type ActivityRichTextEditorProps = {
activityId: string;
@@ -50,10 +47,6 @@ export const ActivityRichTextEditor = ({
const cache = useApolloClient().cache;
const activity = activityInStore as Task | Note | null;
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const { objectMetadataItem: objectMetadataItemActivity } =
useObjectMetadataItem({
objectNameSingular: activityObjectNameSingular,
@@ -280,9 +273,7 @@ export const ActivityRichTextEditor = ({
editor.setTextCursorPosition(newBlockId, 'end');
editor.focus();
},
- isCommandMenuV2Enabled
- ? AppHotkeyScope.CommandMenuOpen
- : RightDrawerHotkeyScope.RightDrawer,
+ AppHotkeyScope.CommandMenuOpen,
[],
{
preventDefault: false,
diff --git a/packages/twenty-front/src/modules/activities/copilot/right-drawer/components/RightDrawerAIChat.tsx b/packages/twenty-front/src/modules/activities/copilot/right-drawer/components/RightDrawerAIChat.tsx
deleted file mode 100644
index 4ad2c423c77..00000000000
--- a/packages/twenty-front/src/modules/activities/copilot/right-drawer/components/RightDrawerAIChat.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import styled from '@emotion/styled';
-import { useSetRecoilState } from 'recoil';
-
-import { copilotQueryState } from '@/activities/copilot/right-drawer/states/copilotQueryState';
-import {
- AutosizeTextInput,
- AutosizeTextInputVariant,
-} from '@/ui/input/components/AutosizeTextInput';
-
-const StyledContainer = styled.div`
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- height: 100%;
- justify-content: flex-start;
- overflow-y: auto;
- position: relative;
-`;
-
-const StyledChatArea = styled.div`
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow-y: scroll;
- padding: ${({ theme }) => theme.spacing(6)};
- padding-bottom: 0px;
-`;
-
-const StyledNewMessageArea = styled.div`
- display: flex;
- flex-direction: column;
- padding: ${({ theme }) => theme.spacing(6)};
- padding-top: 0px;
-`;
-
-export const RightDrawerAIChat = () => {
- const setCopilotQuery = useSetRecoilState(copilotQueryState);
-
- return (
- <StyledContainer>
- <StyledChatArea>{/* TODO */}</StyledChatArea>
- <StyledNewMessageArea>
- <AutosizeTextInput
- autoFocus
- placeholder="Ask anything"
- variant={AutosizeTextInputVariant.Icon}
- onValidate={(text) => {
- setCopilotQuery(text);
- }}
- />
- </StyledNewMessageArea>
- </StyledContainer>
- );
-};
diff --git a/packages/twenty-front/src/modules/activities/copilot/right-drawer/hooks/useOpenCopilotRightDrawer.ts b/packages/twenty-front/src/modules/activities/copilot/right-drawer/hooks/useOpenCopilotRightDrawer.ts
deleted file mode 100644
index 8b3e8b4cb36..00000000000
--- a/packages/twenty-front/src/modules/activities/copilot/right-drawer/hooks/useOpenCopilotRightDrawer.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
-import { IconSparkles } from 'twenty-ui';
-
-export const useOpenCopilotRightDrawer = () => {
- const { openRightDrawer } = useRightDrawer();
- const setHotkeyScope = useSetHotkeyScope();
-
- return () => {
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
- openRightDrawer(RightDrawerPages.Copilot, {
- title: 'Copilot',
- Icon: IconSparkles,
- });
- };
-};
diff --git a/packages/twenty-front/src/modules/activities/copilot/right-drawer/states/copilotQueryState.ts b/packages/twenty-front/src/modules/activities/copilot/right-drawer/states/copilotQueryState.ts
deleted file mode 100644
index b2782ace42b..00000000000
--- a/packages/twenty-front/src/modules/activities/copilot/right-drawer/states/copilotQueryState.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createState } from '@ui/utilities/state/utils/createState';
-
-export const copilotQueryState = createState({
- key: 'activities/copilot-query',
- defaultValue: '',
-});
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 aa7184f2200..5becd75387a 100644
--- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx
@@ -1,19 +1,10 @@
import styled from '@emotion/styled';
-import { useRecoilCallback } from 'recoil';
import { Avatar, GRAY_SCALE } from 'twenty-ui';
import { ActivityRow } from '@/activities/components/ActivityRow';
import { EmailThreadNotShared } from '@/activities/emails/components/EmailThreadNotShared';
-import { useEmailThread } from '@/activities/emails/hooks/useEmailThread';
-import { emailThreadIdWhenEmailThreadWasClosedState } from '@/activities/emails/states/lastViewableEmailThreadIdState';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import {
- FeatureFlagKey,
- MessageChannelVisibility,
- TimelineThread,
-} from '~/generated/graphql';
+import { MessageChannelVisibility, TimelineThread } from '~/generated/graphql';
import { formatToHumanReadableDate } from '~/utils/date-utils';
const StyledHeading = styled.div<{ unread: boolean }>`
@@ -77,11 +68,7 @@ type EmailThreadPreviewProps = {
};
export const EmailThreadPreview = ({ thread }: EmailThreadPreviewProps) => {
- const { openEmailThread } = useEmailThread();
const { openEmailThreadInCommandMenu } = useCommandMenu();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
const visibility = thread.visibility;
@@ -103,48 +90,19 @@ export const EmailThreadPreview = ({ thread }: EmailThreadPreviewProps) => {
false,
];
- const { isSameEventThanRightDrawerClose } = useRightDrawer();
-
- const handleThreadClick = useRecoilCallback(
- ({ snapshot }) =>
- (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
- const clickJustTriggeredEmailDrawerClose =
- isSameEventThanRightDrawerClose(event.nativeEvent);
-
- const emailThreadIdWhenEmailThreadWasClosed = snapshot
- .getLoadable(emailThreadIdWhenEmailThreadWasClosedState)
- .getValue();
-
- const canOpen =
- thread.visibility === MessageChannelVisibility.SHARE_EVERYTHING &&
- (!clickJustTriggeredEmailDrawerClose ||
- emailThreadIdWhenEmailThreadWasClosed !== thread.id);
-
- if (canOpen) {
- if (isCommandMenuV2Enabled) {
- openEmailThreadInCommandMenu(thread.id);
- } else {
- openEmailThread(thread.id);
- }
- }
- },
- [
- isCommandMenuV2Enabled,
- isSameEventThanRightDrawerClose,
- openEmailThread,
- openEmailThreadInCommandMenu,
- thread.id,
- thread.visibility,
- ],
- );
+ const handleThreadClick = () => {
+ const canOpen =
+ thread.visibility === MessageChannelVisibility.SHARE_EVERYTHING;
+
+ if (canOpen) {
+ openEmailThreadInCommandMenu(thread.id);
+ }
+ };
const isDisabled = visibility !== MessageChannelVisibility.SHARE_EVERYTHING;
return (
- <ActivityRow
- onClick={(event) => handleThreadClick(event)}
- disabled={isDisabled}
- >
+ <ActivityRow onClick={handleThreadClick} disabled={isDisabled}>
<StyledHeading unread={!thread.read}>
<StyledParticipantsContainer>
<Avatar
diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/useEmailThread.test.tsx b/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/useEmailThread.test.tsx
deleted file mode 100644
index d7d3efe0335..00000000000
--- a/packages/twenty-front/src/modules/activities/emails/hooks/__tests__/useEmailThread.test.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { act, renderHook } from '@testing-library/react';
-import { RecoilRoot, useRecoilState, useRecoilValue } from 'recoil';
-
-import { useEmailThread } from '@/activities/emails/hooks/useEmailThread';
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
-
-const viewableEmailThreadId = '1234';
-
-describe('useEmailThread', () => {
- it('should open email thread', () => {
- const { result } = renderHook(
- () => {
- const emailThread = useEmailThread();
- const isRightDrawerOpen = useRecoilValue(isRightDrawerOpenState);
- const viewableRecordId = useRecoilValue(viewableRecordIdState);
-
- return { ...emailThread, isRightDrawerOpen, viewableRecordId };
- },
- { wrapper: RecoilRoot },
- );
-
- expect(result.current.isRightDrawerOpen).toBe(false);
- expect(result.current.viewableRecordId).toBeNull();
-
- act(() => {
- result.current.openEmailThread(viewableEmailThreadId);
- });
-
- expect(result.current.isRightDrawerOpen).toBe(true);
- expect(result.current.viewableRecordId).toBe(viewableEmailThreadId);
- });
-
- it('should close email thread if trying to open the same thread id', () => {
- const { result } = renderHook(
- () => {
- const emailThread = useEmailThread();
- const [isRightDrawerOpen, setIsRightDrawerOpen] = useRecoilState(
- isRightDrawerOpenState,
- );
- const [viewableRecordId, setViewableRecordId] = useRecoilState(
- viewableRecordIdState,
- );
-
- return {
- ...emailThread,
- isRightDrawerOpen,
- viewableRecordId,
- setIsRightDrawerOpen,
- setViewableRecordId,
- };
- },
- { wrapper: RecoilRoot },
- );
-
- act(() => {
- result.current.setIsRightDrawerOpen(true);
- result.current.setViewableRecordId(viewableEmailThreadId);
- });
-
- act(() => {
- result.current.openEmailThread(viewableEmailThreadId);
- });
-
- expect(result.current.isRightDrawerOpen).toBe(false);
- expect(result.current.viewableRecordId).toBeNull();
- });
-});
diff --git a/packages/twenty-front/src/modules/activities/emails/hooks/useEmailThread.ts b/packages/twenty-front/src/modules/activities/emails/hooks/useEmailThread.ts
deleted file mode 100644
index c2fa722ed63..00000000000
--- a/packages/twenty-front/src/modules/activities/emails/hooks/useEmailThread.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { useRecoilCallback } from 'recoil';
-
-import { useOpenEmailThreadRightDrawer } from '@/activities/emails/right-drawer/hooks/useOpenEmailThreadRightDrawer';
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
-
-export const useEmailThread = () => {
- const { closeRightDrawer } = useRightDrawer();
- const openEmailThreadRightDrawer = useOpenEmailThreadRightDrawer();
-
- const openEmailThread = useRecoilCallback(
- ({ snapshot, set }) =>
- (threadId: string) => {
- const isRightDrawerOpen = snapshot
- .getLoadable(isRightDrawerOpenState)
- .getValue();
-
- const viewableEmailThreadId = snapshot
- .getLoadable(viewableRecordIdState)
- .getValue();
-
- if (isRightDrawerOpen && viewableEmailThreadId === threadId) {
- set(viewableRecordIdState, null);
- closeRightDrawer();
- return;
- }
-
- openEmailThreadRightDrawer();
- set(viewableRecordIdState, threadId);
- },
- [closeRightDrawer, openEmailThreadRightDrawer],
- );
-
- return { openEmailThread };
-};
diff --git a/packages/twenty-front/src/modules/activities/emails/right-drawer/components/IntermediaryMessages.tsx b/packages/twenty-front/src/modules/activities/emails/right-drawer/components/IntermediaryMessages.tsx
deleted file mode 100644
index aee31f1e1b4..00000000000
--- a/packages/twenty-front/src/modules/activities/emails/right-drawer/components/IntermediaryMessages.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-import styled from '@emotion/styled';
-import { useState } from 'react';
-import { Button, IconArrowsVertical } from 'twenty-ui';
-
-import { EmailThreadMessage } from '@/activities/emails/components/EmailThreadMessage';
-import { EmailThreadMessageWithSender } from '@/activities/emails/types/EmailThreadMessageWithSender';
-
-const StyledButtonContainer = styled.div`
- border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
- padding: 16px 24px;
-`;
-
-export const IntermediaryMessages = ({
- messages,
-}: {
- messages: EmailThreadMessageWithSender[];
-}) => {
- const [areMessagesOpen, setAreMessagesOpen] = useState(false);
-
- if (messages.length === 0) {
- return null;
- }
-
- return areMessagesOpen ? (
- messages.map((message) => (
- <EmailThreadMessage
- key={message.id}
- sender={message.sender}
- participants={message.messageParticipants}
- body={message.text}
- sentAt={message.receivedAt}
- />
- ))
- ) : (
- <StyledButtonContainer>
- <Button
- Icon={IconArrowsVertical}
- title={`${messages.length} email${messages.length > 1 ? 's' : ''}`}
- size="small"
- onClick={() => setAreMessagesOpen(true)}
- />
- </StyledButtonContainer>
- );
-};
diff --git a/packages/twenty-front/src/modules/activities/emails/right-drawer/components/RightDrawerEmailThread.tsx b/packages/twenty-front/src/modules/activities/emails/right-drawer/components/RightDrawerEmailThread.tsx
deleted file mode 100644
index dcba48a72fc..00000000000
--- a/packages/twenty-front/src/modules/activities/emails/right-drawer/components/RightDrawerEmailThread.tsx
+++ /dev/null
@@ -1,185 +0,0 @@
-import styled from '@emotion/styled';
-import { useEffect, useMemo } from 'react';
-import { useRecoilCallback, useSetRecoilState } from 'recoil';
-
-import { CustomResolverFetchMoreLoader } from '@/activities/components/CustomResolverFetchMoreLoader';
-import { EmailLoader } from '@/activities/emails/components/EmailLoader';
-import { EmailThreadHeader } from '@/activities/emails/components/EmailThreadHeader';
-import { EmailThreadMessage } from '@/activities/emails/components/EmailThreadMessage';
-import { IntermediaryMessages } from '@/activities/emails/right-drawer/components/IntermediaryMessages';
-import { useRightDrawerEmailThread } from '@/activities/emails/right-drawer/hooks/useRightDrawerEmailThread';
-import { emailThreadIdWhenEmailThreadWasClosedState } from '@/activities/emails/states/lastViewableEmailThreadIdState';
-import { RIGHT_DRAWER_CLICK_OUTSIDE_LISTENER_ID } from '@/ui/layout/right-drawer/constants/RightDrawerClickOutsideListener';
-import { messageThreadState } from '@/ui/layout/right-drawer/states/messageThreadState';
-import { useClickOutsideListener } from '@/ui/utilities/pointer-event/hooks/useClickOutsideListener';
-import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
-import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
-import { ConnectedAccountProvider } from 'twenty-shared';
-import { Button, IconArrowBackUp } from 'twenty-ui';
-
-const StyledWrapper = styled.div`
- display: flex;
- flex-direction: column;
- height: 100%;
-`;
-
-const StyledContainer = styled.div`
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- flex: 1;
- height: 85%;
- overflow-y: auto;
-`;
-
-const StyledButtonContainer = styled.div<{ isMobile: boolean }>`
- background: ${({ theme }) => theme.background.secondary};
- border-top: 1px solid ${({ theme }) => theme.border.color.light};
- display: flex;
- justify-content: flex-end;
- height: ${({ isMobile }) => (isMobile ? '100px' : '50px')};
- padding: ${({ theme }) => theme.spacing(2)};
- width: 100%;
- box-sizing: border-box;
-`;
-
-export const RightDrawerEmailThread = () => {
- const setMessageThread = useSetRecoilState(messageThreadState);
- const isMobile = useIsMobile();
- const {
- thread,
- messages,
- fetchMoreMessages,
- threadLoading,
- messageThreadExternalId,
- connectedAccountHandle,
- messageChannelLoading,
- connectedAccountProvider,
- lastMessageExternalId,
- } = useRightDrawerEmailThread();
-
- useEffect(() => {
- if (!messages[0]?.messageThread) {
- return;
- }
- setMessageThread(messages[0]?.messageThread);
- });
-
- const { useRegisterClickOutsideListenerCallback } = useClickOutsideListener(
- RIGHT_DRAWER_CLICK_OUTSIDE_LISTENER_ID,
- );
-
- useRegisterClickOutsideListenerCallback({
- callbackId:
- 'EmailThreadClickOutsideCallBack-' + (thread?.id ?? 'no-thread-id'),
- callbackFunction: useRecoilCallback(
- ({ set }) =>
- () => {
- set(
- emailThreadIdWhenEmailThreadWasClosedState,
- thread?.id ?? 'no-thread-id',
- );
- },
- [thread],
- ),
- });
-
- const messagesCount = messages.length;
- const is5OrMoreMessages = messagesCount >= 5;
- const firstMessages = messages.slice(
- 0,
- is5OrMoreMessages ? 2 : messagesCount - 1,
- );
- const intermediaryMessages = is5OrMoreMessages
- ? messages.slice(2, messagesCount - 1)
- : [];
- const lastMessage = messages[messagesCount - 1];
- const subject = messages[0]?.subject;
-
- const canReply = useMemo(() => {
- return (
- connectedAccountHandle &&
- connectedAccountProvider &&
- lastMessage &&
- messageThreadExternalId != null
- );
- }, [
- connectedAccountHandle,
- connectedAccountProvider,
- lastMessage,
- messageThreadExternalId,
- ]);
-
- const handleReplyClick = () => {
- if (!canReply) {
- return;
- }
-
- let url: string;
- switch (connectedAccountProvider) {
- case ConnectedAccountProvider.MICROSOFT:
- url = `https://outlook.office.com/mail/deeplink?ItemID=${lastMessageExternalId}`;
- window.open(url, '_blank');
- break;
- case ConnectedAccountProvider.GOOGLE:
- url = `https://mail.google.com/mail/?authuser=${connectedAccountHandle}#all/${messageThreadExternalId}`;
- window.open(url, '_blank');
- break;
- case null:
- throw new Error('Account provider not provided');
- default:
- assertUnreachable(connectedAccountProvider);
- }
- };
- if (!thread || !messages.length) {
- return null;
- }
- return (
- <StyledWrapper>
- <StyledContainer>
- {threadLoading ? (
- <EmailLoader loadingText="Loading thread" />
- ) : (
- <>
- <EmailThreadHeader
- subject={subject}
- lastMessageSentAt={lastMessage.receivedAt}
- />
- {firstMessages.map((message) => (
- <EmailThreadMessage
- key={message.id}
- sender={message.sender}
- participants={message.messageParticipants}
- body={message.text}
- sentAt={message.receivedAt}
- />
- ))}
- <IntermediaryMessages messages={intermediaryMessages} />
- <EmailThreadMessage
- key={lastMessage.id}
- sender={lastMessage.sender}
- participants={lastMessage.messageParticipants}
- body={lastMessage.text}
- sentAt={lastMessage.receivedAt}
- isExpanded
- />
- <CustomResolverFetchMoreLoader
- loading={threadLoading}
- onLastRowVisible={fetchMoreMessages}
- />
- </>
- )}
- </StyledContainer>
- {canReply && !messageChannelLoading && (
- <StyledButtonContainer isMobile={isMobile}>
- <Button
- onClick={handleReplyClick}
- title="Reply"
- Icon={IconArrowBackUp}
- disabled={!canReply}
- />
- </StyledButtonContainer>
- )}
- </StyledWrapper>
- );
-};
diff --git a/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/__tests__/useOpenEmailThreadRightDrawer.test.ts b/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/__tests__/useOpenEmailThreadRightDrawer.test.ts
deleted file mode 100644
index 25c21ee10fe..00000000000
--- a/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/__tests__/useOpenEmailThreadRightDrawer.test.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { renderHook } from '@testing-library/react';
-import { act } from 'react-dom/test-utils';
-
-import { useOpenEmailThreadRightDrawer } from '@/activities/emails/right-drawer/hooks/useOpenEmailThreadRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { IconMail } from 'twenty-ui';
-
-const mockOpenRightDrawer = jest.fn();
-const mockSetHotkeyScope = jest.fn();
-
-jest.mock('@/ui/layout/right-drawer/hooks/useRightDrawer', () => ({
- useRightDrawer: () => ({
- openRightDrawer: mockOpenRightDrawer,
- }),
-}));
-
-jest.mock('@/ui/utilities/hotkey/hooks/useSetHotkeyScope', () => ({
- useSetHotkeyScope: () => mockSetHotkeyScope,
-}));
-
-test('useOpenEmailThreadRightDrawer opens the email thread right drawer', () => {
- const { result } = renderHook(() => useOpenEmailThreadRightDrawer());
-
- act(() => {
- result.current();
- });
-
- expect(mockSetHotkeyScope).toHaveBeenCalledWith(
- RightDrawerHotkeyScope.RightDrawer,
- { goto: false },
- );
- expect(mockOpenRightDrawer).toHaveBeenCalledWith(
- RightDrawerPages.ViewEmailThread,
- {
- title: 'Email Thread',
- Icon: IconMail,
- },
- );
-});
diff --git a/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/__tests__/useRightDrawerEmailThread.test.tsx b/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/__tests__/useRightDrawerEmailThread.test.tsx
deleted file mode 100644
index 3dda143cd54..00000000000
--- a/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/__tests__/useRightDrawerEmailThread.test.tsx
+++ /dev/null
@@ -1,416 +0,0 @@
-import { renderHook, waitFor } from '@testing-library/react';
-
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import gql from 'graphql-tag';
-import { generateEmptyJestRecordNode } from '~/testing/jest/generateEmptyJestRecordNode';
-import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
-import { useRightDrawerEmailThread } from '../useRightDrawerEmailThread';
-
-const mocks = [
- {
- request: {
- query: gql`
- query FindOneMessageThread($objectRecordId: ID!) {
- messageThread(filter: { id: { eq: $objectRecordId } }) {
- __typename
- id
- }
- }
- `,
- variables: { objectRecordId: '1' },
- },
- result: jest.fn(() => ({
- data: {
- messageThread: {
- id: '1',
- __typename: 'MessageThread',
- },
- },
- })),
- },
- {
- request: {
- query: gql`
- query FindManyMessages(
- $filter: MessageFilterInput
- $orderBy: [MessageOrderByInput]
- $lastCursor: String
- $limit: Int
- ) {
- messages(
- filter: $filter
- orderBy: $orderBy
- first: $limit
- after: $lastCursor
- ) {
- edges {
- node {
- __typename
- createdAt
- headerMessageId
- id
- messageParticipants {
- edges {
- node {
- __typename
- displayName
- handle
- id
- person {
- __typename
- avatarUrl
- city
- companyId
- createdAt
- createdBy {
- source
- workspaceMemberId
- name
- context
- }
- deletedAt
- emails {
- primaryEmail
- additionalEmails
- }
- id
- intro
- jobTitle
- linkedinLink {
- primaryLinkUrl
- primaryLinkLabel
- secondaryLinks
- }
- name {
- firstName
- lastName
- }
- performanceRating
- phones {
- primaryPhoneNumber
- primaryPhoneCountryCode
- primaryPhoneCallingCode
- additionalPhones
- }
- position
- updatedAt
- whatsapp {
- primaryPhoneNumber
- primaryPhoneCountryCode
- primaryPhoneCallingCode
- additionalPhones
- }
- workPreference
- xLink {
- primaryLinkUrl
- primaryLinkLabel
- secondaryLinks
- }
- }
- role
- workspaceMember {
- __typename
- avatarUrl
- colorScheme
- createdAt
- dateFormat
- deletedAt
- id
- locale
- name {
- firstName
- lastName
- }
- timeFormat
- timeZone
- updatedAt
- userEmail
- userId
- }
- }
- }
- }
- messageThread {
- __typename
- id
- }
- receivedAt
- subject
- text
- }
- cursor
- }
- pageInfo {
- hasNextPage
- hasPreviousPage
- startCursor
- endCursor
- }
- totalCount
- }
- }
- `,
- variables: {
- filter: { messageThreadId: { eq: '1' } },
- orderBy: [{ receivedAt: 'AscNullsLast' }],
- lastCursor: undefined,
- limit: 10,
- },
- },
- result: jest.fn(() => ({
- data: {
- messages: {
- edges: [
- {
- node: generateEmptyJestRecordNode({
- objectNameSingular: 'message',
- input: {
- id: '1',
- text: 'Message 1',
- createdAt: '2024-10-03T10:20:10.145Z',
- },
- }),
- cursor: '1',
- },
- {
- node: generateEmptyJestRecordNode({
- objectNameSingular: 'message',
- input: {
- id: '2',
- text: 'Message 2',
- createdAt: '2024-10-03T10:20:10.145Z',
- },
- }),
- cursor: '2',
- },
- ],
- totalCount: 2,
- pageInfo: {
- hasNextPage: false,
- hasPreviousPage: false,
- startCursor: '1',
- endCursor: '2',
- },
- },
- },
- })),
- },
- {
- request: {
- query: gql`
- query FindManyMessageParticipants(
- $filter: MessageParticipantFilterInput
- $orderBy: [MessageParticipantOrderByInput]
- $lastCursor: String
- $limit: Int
- ) {
- messageParticipants(
- filter: $filter
- orderBy: $orderBy
- first: $limit
- after: $lastCursor
- ) {
- edges {
- node {
- __typename
- displayName
- handle
- id
- messageId
- person {
- __typename
- avatarUrl
- city
- companyId
- createdAt
- createdBy {
- source
- workspaceMemberId
- name
- context
- }
- deletedAt
- emails {
- primaryEmail
- additionalEmails
- }
- id
- intro
- jobTitle
- linkedinLink {
- primaryLinkUrl
- primaryLinkLabel
- secondaryLinks
- }
- name {
- firstName
- lastName
- }
- performanceRating
- phones {
- primaryPhoneNumber
- primaryPhoneCountryCode
- primaryPhoneCallingCode
- additionalPhones
- }
- position
- updatedAt
- whatsapp {
- primaryPhoneNumber
- primaryPhoneCountryCode
- primaryPhoneCallingCode
- additionalPhones
- }
- workPreference
- xLink {
- primaryLinkUrl
- primaryLinkLabel
- secondaryLinks
- }
- }
- role
- workspaceMember {
- __typename
- avatarUrl
- colorScheme
- createdAt
- dateFormat
- deletedAt
- id
- locale
- name {
- firstName
- lastName
- }
- timeFormat
- timeZone
- updatedAt
- userEmail
- userId
- }
- }
- cursor
- }
- pageInfo {
- hasNextPage
- hasPreviousPage
- startCursor
- endCursor
- }
- totalCount
- }
- }
- `,
- variables: {
- filter: { messageId: { in: ['1', '2'] }, role: { eq: 'from' } },
- orderBy: undefined,
- lastCursor: undefined,
- limit: undefined,
- },
- },
- result: jest.fn(() => ({
- data: {
- messageParticipants: {
- edges: [
- {
- node: generateEmptyJestRecordNode({
- objectNameSingular: 'messageParticipant',
- input: {
- id: 'messageParticipant-1',
- role: 'from',
- messageId: '1',
- },
- }),
- cursor: '1',
- },
- {
- node: generateEmptyJestRecordNode({
- objectNameSingular: 'messageParticipant',
- input: {
- id: 'messageParticipant-2',
- role: 'from',
- messageId: '2',
- },
- }),
- cursor: '2',
- },
- ],
- totalCount: 2,
- pageInfo: {
- hasNextPage: false,
- hasPreviousPage: false,
- startCursor: '1',
- endCursor: '2',
- },
- },
- },
- })),
- },
-];
-
-const Wrapper = getJestMetadataAndApolloMocksWrapper({
- apolloMocks: mocks,
- onInitializeRecoilSnapshot: ({ set }) => {
- set(viewableRecordIdState, '1');
- },
-});
-
-describe('useRightDrawerEmailThread', () => {
- it('should return correct values', async () => {
- const mockMessages = [
- {
- __typename: 'Message',
- createdAt: '2024-10-03T10:20:10.145Z',
- headerMessageId: '',
- id: '1',
- messageParticipants: [],
- messageThread: null,
- receivedAt: null,
- sender: {
- __typename: 'MessageParticipant',
- displayName: '',
- handle: '',
- id: 'messageParticipant-1',
- messageId: '1',
- person: null,
- role: 'from',
- workspaceMember: null,
- },
- subject: '',
- text: 'Message 1',
- },
- {
- __typename: 'Message',
- createdAt: '2024-10-03T10:20:10.145Z',
- headerMessageId: '',
- id: '2',
- messageParticipants: [],
- messageThread: null,
- receivedAt: null,
- sender: {
- __typename: 'MessageParticipant',
- displayName: '',
- handle: '',
- id: 'messageParticipant-2',
- messageId: '2',
- person: null,
- role: 'from',
- workspaceMember: null,
- },
- subject: '',
- text: 'Message 2',
- },
- ];
-
- const { result } = renderHook(() => useRightDrawerEmailThread(), {
- wrapper: Wrapper,
- });
-
- await waitFor(() => {
- expect(result.current.thread).toBeDefined();
- expect(result.current.messages).toEqual(mockMessages);
- expect(result.current.threadLoading).toBeFalsy();
- expect(result.current.fetchMoreMessages).toBeInstanceOf(Function);
- });
- });
-});
diff --git a/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/useOpenEmailThreadRightDrawer.ts b/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/useOpenEmailThreadRightDrawer.ts
deleted file mode 100644
index 1e18a20d4fb..00000000000
--- a/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/useOpenEmailThreadRightDrawer.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
-import { IconMail } from 'twenty-ui';
-
-export const useOpenEmailThreadRightDrawer = () => {
- const { openRightDrawer } = useRightDrawer();
- const setHotkeyScope = useSetHotkeyScope();
-
- return () => {
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
- openRightDrawer(RightDrawerPages.ViewEmailThread, {
- title: 'Email Thread',
- Icon: IconMail,
- });
- };
-};
diff --git a/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/useRightDrawerEmailThread.ts b/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/useRightDrawerEmailThread.ts
deleted file mode 100644
index d41c54cb346..00000000000
--- a/packages/twenty-front/src/modules/activities/emails/right-drawer/hooks/useRightDrawerEmailThread.ts
+++ /dev/null
@@ -1,186 +0,0 @@
-import { useCallback, useEffect, useState } from 'react';
-import { useRecoilValue } from 'recoil';
-
-import { fetchAllThreadMessagesOperationSignatureFactory } from '@/activities/emails/graphql/operation-signatures/factories/fetchAllThreadMessagesOperationSignatureFactory';
-import { EmailThread } from '@/activities/emails/types/EmailThread';
-import { EmailThreadMessage } from '@/activities/emails/types/EmailThreadMessage';
-
-import { MessageChannel } from '@/accounts/types/MessageChannel';
-import { EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant';
-import { EmailThreadMessageWithSender } from '@/activities/emails/types/EmailThreadMessageWithSender';
-import { MessageChannelMessageAssociation } from '@/activities/emails/types/MessageChannelMessageAssociation';
-import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
-import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
-import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
-import { isDefined } from 'twenty-shared';
-
-export const useRightDrawerEmailThread = () => {
- const viewableRecordId = useRecoilValue(viewableRecordIdState);
- const { upsertRecords } = useUpsertRecordsInStore();
- const [lastMessageId, setLastMessageId] = useState<string | null>(null);
- const [lastMessageChannelId, setLastMessageChannelId] = useState<
- string | null
- >(null);
- const [isMessagesFetchComplete, setIsMessagesFetchComplete] = useState(false);
-
- const { record: thread } = useFindOneRecord<EmailThread>({
- objectNameSingular: CoreObjectNameSingular.MessageThread,
- objectRecordId: viewableRecordId ?? '',
- recordGqlFields: {
- id: true,
- },
- onCompleted: (record) => {
- upsertRecords([record]);
- },
- });
-
- const FETCH_ALL_MESSAGES_OPERATION_SIGNATURE =
- fetchAllThreadMessagesOperationSignatureFactory({
- messageThreadId: viewableRecordId,
- });
-
- const {
- records: messages,
- loading: messagesLoading,
- fetchMoreRecords,
- hasNextPage,
- } = useFindManyRecords<EmailThreadMessage>({
- limit: FETCH_ALL_MESSAGES_OPERATION_SIGNATURE.variables.limit,
- filter: FETCH_ALL_MESSAGES_OPERATION_SIGNATURE.variables.filter,
- objectNameSingular:
- FETCH_ALL_MESSAGES_OPERATION_SIGNATURE.objectNameSingular,
- orderBy: FETCH_ALL_MESSAGES_OPERATION_SIGNATURE.variables.orderBy,
- recordGqlFields: FETCH_ALL_MESSAGES_OPERATION_SIGNATURE.fields,
- skip: !viewableRecordId,
- });
-
- const fetchMoreMessages = useCallback(() => {
- if (!messagesLoading && hasNextPage) {
- fetchMoreRecords();
- } else if (!hasNextPage) {
- setIsMessagesFetchComplete(true);
- }
- }, [fetchMoreRecords, messagesLoading, hasNextPage]);
-
- useEffect(() => {
- if (messages.length > 0 && isMessagesFetchComplete) {
- const lastMessage = messages[messages.length - 1];
- setLastMessageId(lastMessage.id);
- }
- }, [messages, isMessagesFetchComplete]);
-
- // TODO: introduce nested filters so we can retrieve the message sender directly from the message query
- const { records: messageSenders } =
- useFindManyRecords<EmailThreadMessageParticipant>({
- filter: {
- messageId: {
- in: messages.map(({ id }) => id),
- },
- role: {
- eq: 'from',
- },
- },
- objectNameSingular: CoreObjectNameSingular.MessageParticipant,
- recordGqlFields: {
- id: true,
- role: true,
- displayName: true,
- messageId: true,
- handle: true,
- person: true,
- workspaceMember: true,
- },
- skip: messages.length === 0,
- });
-
- const { records: messageChannelMessageAssociationData } =
- useFindManyRecords<MessageChannelMessageAssociation>({
- filter: {
- messageId: {
- eq: lastMessageId ?? '',
- },
- },
- objectNameSingular:
- CoreObjectNameSingular.MessageChannelMessageAssociation,
- recordGqlFields: {
- id: true,
- messageId: true,
- messageChannelId: true,
- messageThreadExternalId: true,
- messageExternalId: true,
- },
- skip: !lastMessageId || !isMessagesFetchComplete,
- });
-
- useEffect(() => {
- if (messageChannelMessageAssociationData.length > 0) {
- setLastMessageChannelId(
- messageChannelMessageAssociationData[0].messageChannelId,
- );
- }
- }, [messageChannelMessageAssociationData]);
-
- const { records: messageChannelData, loading: messageChannelLoading } =
- useFindManyRecords<MessageChannel>({
- filter: {
- id: {
- eq: lastMessageChannelId ?? '',
- },
- },
- objectNameSingular: CoreObjectNameSingular.MessageChannel,
- recordGqlFields: {
- id: true,
- handle: true,
- connectedAccount: {
- id: true,
- provider: true,
- },
- },
- skip: !lastMessageChannelId,
- });
-
- const messageThreadExternalId =
- messageChannelMessageAssociationData.length > 0
- ? messageChannelMessageAssociationData[0].messageThreadExternalId
- : null;
- const lastMessageExternalId =
- messageChannelMessageAssociationData.length > 0
- ? messageChannelMessageAssociationData[0].messageExternalId
- : null;
- const connectedAccountHandle =
- messageChannelData.length > 0 ? messageChannelData[0].handle : null;
-
- const messagesWithSender: EmailThreadMessageWithSender[] = messages
- .map((message) => {
- const sender = messageSenders.find(
- (messageSender) => messageSender.messageId === message.id,
- );
- if (!sender) {
- return null;
- }
- return {
- ...message,
- sender,
- };
- })
- .filter(isDefined);
-
- const connectedAccount =
- messageChannelData.length > 0
- ? messageChannelData[0]?.connectedAccount
- : null;
- const connectedAccountProvider = connectedAccount?.provider ?? null;
- return {
- thread,
- messages: messagesWithSender,
- messageThreadExternalId,
- connectedAccountHandle,
- connectedAccountProvider,
- threadLoading: messagesLoading,
- messageChannelLoading,
- lastMessageExternalId,
- fetchMoreMessages,
- };
-};
diff --git a/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenActivityRightDrawer.test.tsx b/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenActivityRightDrawer.test.tsx
deleted file mode 100644
index 81a6b61dad5..00000000000
--- a/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenActivityRightDrawer.test.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { MockedProvider } from '@apollo/client/testing';
-import { act, renderHook } from '@testing-library/react';
-import { ReactNode } from 'react';
-import { RecoilRoot, useRecoilValue } from 'recoil';
-
-import { useOpenActivityRightDrawer } from '@/activities/hooks/useOpenActivityRightDrawer';
-import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-
-const Wrapper = ({ children }: { children: ReactNode }) => (
- <RecoilRoot>
- <MockedProvider addTypename={false}>{children}</MockedProvider>
- </RecoilRoot>
-);
-
-describe('useOpenActivityRightDrawer', () => {
- it('works as expected', () => {
- const { result } = renderHook(
- () => {
- const openActivityRightDrawer = useOpenActivityRightDrawer({
- objectNameSingular: CoreObjectNameSingular.Task,
- });
- const viewableRecordId = useRecoilValue(viewableRecordIdState);
- return {
- openActivityRightDrawer,
- viewableRecordId,
- };
- },
- {
- wrapper: Wrapper,
- },
- );
-
- expect(result.current.viewableRecordId).toBeNull();
- act(() => {
- result.current.openActivityRightDrawer('123');
- });
- expect(result.current.viewableRecordId).toBe('123');
- });
-});
diff --git a/packages/twenty-front/src/modules/activities/hooks/useOpenActivityRightDrawer.ts b/packages/twenty-front/src/modules/activities/hooks/useOpenActivityRightDrawer.ts
deleted file mode 100644
index d172e7aebde..00000000000
--- a/packages/twenty-front/src/modules/activities/hooks/useOpenActivityRightDrawer.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { useRecoilState, useSetRecoilState } from 'recoil';
-
-import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { IconList } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated/graphql';
-
-export const useOpenActivityRightDrawer = ({
- objectNameSingular,
-}: {
- objectNameSingular: CoreObjectNameSingular;
-}) => {
- const { openRightDrawer, isRightDrawerOpen, rightDrawerPage } =
- useRightDrawer();
- const [viewableRecordId, setViewableRecordId] = useRecoilState(
- viewableRecordIdState,
- );
-
- const setViewableRecordNameSingular = useSetRecoilState(
- viewableRecordNameSingularState,
- );
-
- const setHotkeyScope = useSetHotkeyScope();
-
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
- const { openRecordInCommandMenu } = useCommandMenu();
-
- return (activityId: string) => {
- if (
- isRightDrawerOpen &&
- rightDrawerPage === RightDrawerPages.ViewRecord &&
- viewableRecordId === activityId
- ) {
- return;
- }
-
- if (isCommandMenuV2Enabled) {
- openRecordInCommandMenu({
- recordId: activityId,
- objectNameSingular,
- isNewRecord: false,
- });
- } else {
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
- setViewableRecordId(activityId);
- setViewableRecordNameSingular(objectNameSingular);
- openRightDrawer(RightDrawerPages.ViewRecord, {
- title: objectNameSingular,
- Icon: IconList,
- });
- }
- };
-};
diff --git a/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts b/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts
index 9ab66f423d3..b4ea1537afb 100644
--- a/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts
+++ b/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts
@@ -1,27 +1,20 @@
import { useSetRecoilState } from 'recoil';
import { activityTargetableEntityArrayState } from '@/activities/states/activityTargetableEntityArrayState';
-import { isUpsertingActivityInDBState } from '@/activities/states/isCreatingActivityInDBState';
+import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
+import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
+import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState';
import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
+import { isUpsertingActivityInDBState } from '@/activities/states/isCreatingActivityInDBState';
+import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
import { Note } from '@/activities/types/Note';
import { NoteTarget } from '@/activities/types/NoteTarget';
import { Task } from '@/activities/types/Task';
import { TaskTarget } from '@/activities/types/TaskTarget';
-import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
import { isNewViewableRecordLoadingState } from '@/object-record/record-right-drawer/states/isNewViewableRecordLoading';
-import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { IconList } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated/graphql';
-import { ActivityTargetableObject } from '../types/ActivityTargetableEntity';
export const useOpenCreateActivityDrawer = ({
activityObjectNameSingular,
@@ -30,10 +23,6 @@ export const useOpenCreateActivityDrawer = ({
| CoreObjectNameSingular.Note
| CoreObjectNameSingular.Task;
}) => {
- const { openRightDrawer } = useRightDrawer();
-
- const setHotkeyScope = useSetHotkeyScope();
-
const { createOneRecord: createOneActivity } = useCreateOneRecord<
(Task | Note) & { position: 'first' | 'last' }
>({
@@ -64,10 +53,6 @@ export const useOpenCreateActivityDrawer = ({
isUpsertingActivityInDBState,
);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const { openRecordInCommandMenu } = useCommandMenu();
const openCreateActivityDrawer = async ({
@@ -78,12 +63,6 @@ export const useOpenCreateActivityDrawer = ({
customAssignee?: WorkspaceMember;
}) => {
setIsNewViewableRecordLoading(true);
- if (!isCommandMenuV2Enabled) {
- openRightDrawer(RightDrawerPages.ViewRecord, {
- title: activityObjectNameSingular,
- Icon: IconList,
- });
- }
setViewableRecordId(null);
setViewableRecordNameSingular(activityObjectNameSingular);
@@ -125,15 +104,11 @@ export const useOpenCreateActivityDrawer = ({
setActivityTargetableEntityArray([]);
}
- if (isCommandMenuV2Enabled) {
- openRecordInCommandMenu({
- recordId: activity.id,
- objectNameSingular: activityObjectNameSingular,
- isNewRecord: true,
- });
- } else {
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
- }
+ openRecordInCommandMenu({
+ recordId: activity.id,
+ objectNameSingular: activityObjectNameSingular,
+ isNewRecord: true,
+ });
setViewableRecordId(activity.id);
diff --git a/packages/twenty-front/src/modules/activities/inline-cell/hooks/useOpenActivityTargetInlineCellEditMode.ts b/packages/twenty-front/src/modules/activities/inline-cell/hooks/useOpenActivityTargetInlineCellEditMode.ts
index a65a1751d74..252d03d9a9e 100644
--- a/packages/twenty-front/src/modules/activities/inline-cell/hooks/useOpenActivityTargetInlineCellEditMode.ts
+++ b/packages/twenty-front/src/modules/activities/inline-cell/hooks/useOpenActivityTargetInlineCellEditMode.ts
@@ -5,8 +5,6 @@ import { useMultipleRecordPickerPerformSearch } from '@/object-record/record-pic
import { multipleRecordPickerPickableMorphItemsComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState';
import { multipleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchFilterComponentState';
import { multipleRecordPickerSearchableObjectMetadataItemsComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchableObjectMetadataItemsComponentState';
-import { RIGHT_DRAWER_CLICK_OUTSIDE_LISTENER_ID } from '@/ui/layout/right-drawer/constants/RightDrawerClickOutsideListener';
-import { useClickOutsideListener } from '@/ui/utilities/pointer-event/hooks/useClickOutsideListener';
import { useRecoilCallback } from 'recoil';
type OpenActivityTargetInlineCellEditModeProps = {
@@ -15,9 +13,6 @@ type OpenActivityTargetInlineCellEditModeProps = {
};
export const useOpenActivityTargetInlineCellEditMode = () => {
- const { toggleClickOutsideListener: toggleRightDrawerClickOustideListener } =
- useClickOutsideListener(RIGHT_DRAWER_CLICK_OUTSIDE_LISTENER_ID);
-
const { performSearch: multipleRecordPickerPerformSearch } =
useMultipleRecordPickerPerformSearch();
@@ -66,8 +61,6 @@ export const useOpenActivityTargetInlineCellEditMode = () => {
'',
);
- toggleRightDrawerClickOustideListener(false);
-
multipleRecordPickerPerformSearch({
multipleRecordPickerInstanceId: recordPickerInstanceId,
forceSearchFilter: '',
@@ -83,7 +76,7 @@ export const useOpenActivityTargetInlineCellEditMode = () => {
),
});
},
- [multipleRecordPickerPerformSearch, toggleRightDrawerClickOustideListener],
+ [multipleRecordPickerPerformSearch],
);
return { openActivityTargetInlineCellEditMode };
diff --git a/packages/twenty-front/src/modules/activities/notes/components/NoteCard.tsx b/packages/twenty-front/src/modules/activities/notes/components/NoteCard.tsx
index 4d70dbc838b..62cfcda79da 100644
--- a/packages/twenty-front/src/modules/activities/notes/components/NoteCard.tsx
+++ b/packages/twenty-front/src/modules/activities/notes/components/NoteCard.tsx
@@ -1,9 +1,9 @@
import styled from '@emotion/styled';
-import { useOpenActivityRightDrawer } from '@/activities/hooks/useOpenActivityRightDrawer';
import { ActivityTargetsInlineCell } from '@/activities/inline-cell/components/ActivityTargetsInlineCell';
import { Note } from '@/activities/types/Note';
import { getActivityPreview } from '@/activities/utils/getActivityPreview';
+import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useFieldContext } from '@/object-record/hooks/useFieldContext';
@@ -68,9 +68,7 @@ export const NoteCard = ({
note: Note;
isSingleNote: boolean;
}) => {
- const openActivityRightDrawer = useOpenActivityRightDrawer({
- objectNameSingular: CoreObjectNameSingular.Note,
- });
+ const { openRecordInCommandMenu } = useCommandMenu();
const body = getActivityPreview(note?.bodyV2?.blocknote ?? null);
@@ -84,7 +82,12 @@ export const NoteCard = ({
return (
<StyledCard isSingleNote={isSingleNote}>
<StyledCardDetailsContainer
- onClick={() => openActivityRightDrawer(note.id)}
+ onClick={() =>
+ openRecordInCommandMenu({
+ recordId: note.id,
+ objectNameSingular: CoreObjectNameSingular.Note,
+ })
+ }
>
<StyledNoteTitle>{note.title ?? 'Task Title'}</StyledNoteTitle>
<StyledCardContent>{body}</StyledCardContent>
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 588af20d987..037ed8ec8d2 100644
--- a/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx
+++ b/packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx
@@ -7,13 +7,13 @@ import {
OverflowingTextWithTooltip,
} from 'twenty-ui';
-import { useOpenActivityRightDrawer } from '@/activities/hooks/useOpenActivityRightDrawer';
import { ActivityTargetsInlineCell } from '@/activities/inline-cell/components/ActivityTargetsInlineCell';
import { getActivitySummary } from '@/activities/utils/getActivitySummary';
import { beautifyExactDate, hasDatePassed } from '~/utils/date-utils';
import { ActivityRow } from '@/activities/components/ActivityRow';
import { Task } from '@/activities/types/Task';
+import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useFieldContext } from '@/object-record/hooks/useFieldContext';
import { useCompleteTask } from '../hooks/useCompleteTask';
@@ -78,9 +78,7 @@ const StyledCheckboxContainer = styled.div`
export const TaskRow = ({ task }: { task: Task }) => {
const theme = useTheme();
- const openActivityRightDrawer = useOpenActivityRightDrawer({
- objectNameSingular: CoreObjectNameSingular.Task,
- });
+ const { openRecordInCommandMenu } = useCommandMenu();
const body = getActivitySummary(task?.bodyV2?.blocknote ?? null);
@@ -96,7 +94,10 @@ export const TaskRow = ({ task }: { task: Task }) => {
return (
<ActivityRow
onClick={() => {
- openActivityRightDrawer(task.id);
+ openRecordInCommandMenu({
+ recordId: task.id,
+ objectNameSingular: CoreObjectNameSingular.Task,
+ });
}}
>
<StyledLeftSideContainer>
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 47f95270d6a..836cdf4a4b8 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
@@ -1,11 +1,11 @@
import styled from '@emotion/styled';
-import { useOpenActivityRightDrawer } from '@/activities/hooks/useOpenActivityRightDrawer';
import {
EventRowDynamicComponentProps,
StyledEventRowItemAction,
StyledEventRowItemColumn,
} from '@/activities/timeline-activities/rows/components/EventRowDynamicComponent';
+import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useGetRecordFromCache } from '@/object-record/cache/hooks/useGetRecordFromCache';
import { isNonEmptyString } from '@sniptt/guards';
@@ -55,9 +55,7 @@ export const EventRowActivity = ({
? event.linkedRecordCachedName
: 'Untitled';
- const openActivityRightDrawer = useOpenActivityRightDrawer({
- objectNameSingular,
- });
+ const { openRecordInCommandMenu } = useCommandMenu();
return (
<>
@@ -66,7 +64,12 @@ export const EventRowActivity = ({
{`${eventAction} a related ${eventObject}`}
</StyledEventRowItemAction>
<StyledLinkedActivity
- onClick={() => openActivityRightDrawer(event.linkedRecordId)}
+ onClick={() =>
+ openRecordInCommandMenu({
+ recordId: event.linkedRecordId,
+ objectNameSingular,
+ })
+ }
>
{activityTitle}
</StyledLinkedActivity>
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx
index 2e03852c5db..022345f608f 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx
@@ -24,7 +24,6 @@ export const CommandMenu = () => {
const {
noResults,
- copilotCommands,
matchingStandardActionRecordSelectionCommands,
matchingStandardActionObjectCommands,
matchingWorkflowRunRecordSelectionCommands,
@@ -47,10 +46,6 @@ export const CommandMenu = () => {
);
const commandGroups: CommandGroupConfig[] = [
- {
- heading: t`Copilot`,
- items: copilotCommands,
- },
{
heading: t`Record Selection`,
items: matchingStandardActionRecordSelectionCommands.concat(
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
index b7fe4883c84..5b839697519 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx
@@ -11,7 +11,6 @@ import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchS
import { CommandMenuPages } from '@/command-menu/types/CommandMenuPages';
import { contextStoreCurrentObjectMetadataItemComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemComponentState';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { useLingui } from '@lingui/react/macro';
@@ -24,11 +23,9 @@ import {
Button,
IconChevronLeft,
IconX,
- LightIconButton,
getOsControlSymbol,
useIsMobile,
} from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
const StyledInputContainer = styled.div`
align-items: center;
@@ -75,13 +72,6 @@ const StyledContentContainer = styled.div`
gap: ${({ theme }) => theme.spacing(1)};
`;
-const StyledCloseButtonContainer = styled.div`
- align-items: center;
- display: flex;
- height: 32px;
- justify-content: center;
-`;
-
const StyledCloseButtonWrapper = styled.div<{ isVisible: boolean }>`
visibility: ${({ isVisible }) => (isVisible ? 'visible' : 'hidden')};
`;
@@ -110,10 +100,6 @@ export const CommandMenuTopBar = () => {
const theme = useTheme();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const { contextChips } = useCommandMenuContextChips();
const location = useLocation();
@@ -127,34 +113,30 @@ export const CommandMenuTopBar = () => {
return (
<StyledInputContainer>
<StyledContentContainer>
- {isCommandMenuV2Enabled && (
- <>
- <AnimatePresence>
- {commandMenuPage !== CommandMenuPages.Root && (
- <motion.div
- exit={{ opacity: 0, width: 0 }}
- transition={{
- duration: backButtonAnimationDuration,
- }}
- >
- <CommandMenuContextChip
- Icons={[<IconChevronLeft size={theme.icon.size.sm} />]}
- onClick={goBackFromCommandMenu}
- testId="command-menu-go-back-button"
- />
- </motion.div>
- )}
- </AnimatePresence>
- {isDefined(contextStoreCurrentObjectMetadataItem) &&
- commandMenuPage !== CommandMenuPages.SearchRecords ? (
- <CommandMenuContextChipGroupsWithRecordSelection
- contextChips={contextChips}
- objectMetadataItemId={contextStoreCurrentObjectMetadataItem.id}
+ <AnimatePresence>
+ {commandMenuPage !== CommandMenuPages.Root && (
+ <motion.div
+ exit={{ opacity: 0, width: 0 }}
+ transition={{
+ duration: backButtonAnimationDuration,
+ }}
+ >
+ <CommandMenuContextChip
+ Icons={[<IconChevronLeft size={theme.icon.size.sm} />]}
+ onClick={goBackFromCommandMenu}
+ testId="command-menu-go-back-button"
/>
- ) : (
- <CommandMenuContextChipGroups contextChips={contextChips} />
- )}
- </>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ {isDefined(contextStoreCurrentObjectMetadataItem) &&
+ commandMenuPage !== CommandMenuPages.SearchRecords ? (
+ <CommandMenuContextChipGroupsWithRecordSelection
+ contextChips={contextChips}
+ objectMetadataItemId={contextStoreCurrentObjectMetadataItem.id}
+ />
+ ) : (
+ <CommandMenuContextChipGroups contextChips={contextChips} />
)}
{(commandMenuPage === CommandMenuPages.Root ||
commandMenuPage === CommandMenuPages.SearchRecords) && (
@@ -171,27 +153,16 @@ export const CommandMenuTopBar = () => {
</StyledContentContainer>
{!isMobile && (
<StyledCloseButtonWrapper isVisible={isButtonVisible}>
- {isCommandMenuV2Enabled ? (
- <Button
- Icon={IconX}
- dataTestId="page-header-close-command-menu-button"
- size={'small'}
- variant="secondary"
- accent="default"
- hotkeys={[getOsControlSymbol(), 'K']}
- ariaLabel="Close command menu"
- onClick={closeCommandMenu}
- />
- ) : (
- <StyledCloseButtonContainer>
- <LightIconButton
- accent={'tertiary'}
- size={'medium'}
- Icon={IconX}
- onClick={closeCommandMenu}
- />
- </StyledCloseButtonContainer>
- )}
+ <Button
+ Icon={IconX}
+ dataTestId="page-header-close-command-menu-button"
+ size={'small'}
+ variant="secondary"
+ accent="default"
+ hotkeys={[getOsControlSymbol(), 'K']}
+ ariaLabel="Close command menu"
+ onClick={closeCommandMenu}
+ />
</StyledCloseButtonWrapper>
)}
</StyledInputContainer>
diff --git a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPagesConfig.tsx b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPagesConfig.tsx
index 706ebc3f36f..2ecbad5aedf 100644
--- a/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPagesConfig.tsx
+++ b/packages/twenty-front/src/modules/command-menu/constants/CommandMenuPagesConfig.tsx
@@ -1,4 +1,3 @@
-import { RightDrawerAIChat } from '@/activities/copilot/right-drawer/components/RightDrawerAIChat';
import { CommandMenu } from '@/command-menu/components/CommandMenu';
import { CommandMenuCalendarEventPage } from '@/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage';
import { CommandMenuMessageThreadPage } from '@/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage';
@@ -19,7 +18,6 @@ export const COMMAND_MENU_PAGES_CONFIG = new Map<
[CommandMenuPages.ViewRecord, <CommandMenuRecordPage />],
[CommandMenuPages.ViewEmailThread, <CommandMenuMessageThreadPage />],
[CommandMenuPages.ViewCalendarEvent, <CommandMenuCalendarEventPage />],
- [CommandMenuPages.Copilot, <RightDrawerAIChat />],
[
CommandMenuPages.WorkflowStepSelectTriggerType,
<CommandMenuWorkflowSelectTriggerType />,
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCommands.tsx b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCommands.tsx
index f201044a4e5..0d568c02ec4 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCommands.tsx
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuCommands.tsx
@@ -3,49 +3,20 @@ import {
ActionMenuEntryScope,
ActionMenuEntryType,
} from '@/action-menu/types/ActionMenuEntry';
-import { useOpenCopilotRightDrawer } from '@/activities/copilot/right-drawer/hooks/useOpenCopilotRightDrawer';
-import { copilotQueryState } from '@/activities/copilot/right-drawer/states/copilotQueryState';
import { COMMAND_MENU_NAVIGATE_COMMANDS } from '@/command-menu/constants/CommandMenuNavigateCommands';
-import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState';
import {
Command,
CommandScope,
CommandType,
} from '@/command-menu/types/Command';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { i18n } from '@lingui/core';
-import { useRecoilValue, useSetRecoilState } from 'recoil';
-import { IconSparkles } from 'twenty-ui';
-import { useDebounce } from 'use-debounce';
-import { FeatureFlagKey } from '~/generated/graphql';
export const useCommandMenuCommands = () => {
const actionMenuEntries = useRecoilComponentValueV2(
actionMenuEntriesComponentSelector,
);
- const commandMenuSearch = useRecoilValue(commandMenuSearchState);
- const [deferredCommandMenuSearch] = useDebounce(commandMenuSearch, 300); // 200ms - 500ms
-
- const isCopilotEnabled = useIsFeatureEnabled(FeatureFlagKey.IsCopilotEnabled);
- const setCopilotQuery = useSetRecoilState(copilotQueryState);
- const openCopilotRightDrawer = useOpenCopilotRightDrawer();
-
- const copilotCommand: Command = {
- id: 'copilot',
- to: '', // TODO
- Icon: IconSparkles,
- label: 'Open Copilot',
- type: CommandType.Navigate,
- onCommandClick: () => {
- setCopilotQuery(deferredCommandMenuSearch);
- openCopilotRightDrawer();
- },
- };
-
- const copilotCommands: Command[] = isCopilotEnabled ? [copilotCommand] : [];
-
const navigateCommands = Object.values(COMMAND_MENU_NAVIGATE_COMMANDS);
const actionRecordSelectionCommands: Command[] = actionMenuEntries
@@ -144,7 +115,6 @@ export const useCommandMenuCommands = () => {
}));
return {
- copilotCommands,
navigateCommands,
actionRecordSelectionCommands,
actionGlobalCommands,
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 3b3ade6f150..012b804a765 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts
@@ -8,11 +8,9 @@ import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeybo
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { isNonEmptyString } from '@sniptt/guards';
import { useRecoilValue } from 'recoil';
import { Key } from 'ts-key-enum';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const useCommandMenuHotKeys = () => {
const {
@@ -33,10 +31,6 @@ export const useCommandMenuHotKeys = () => {
COMMAND_MENU_COMPONENT_INSTANCE_ID,
);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
useScopedHotkeys(
'ctrl+k,meta+k',
() => {
@@ -71,7 +65,7 @@ export const useCommandMenuHotKeys = () => {
useScopedHotkeys(
[Key.Backspace, Key.Delete],
() => {
- if (isNonEmptyString(commandMenuSearch) || !isCommandMenuV2Enabled) {
+ if (isNonEmptyString(commandMenuSearch)) {
return;
}
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useMatchingCommandMenuCommands.ts b/packages/twenty-front/src/modules/command-menu/hooks/useMatchingCommandMenuCommands.ts
index 72f66580b38..8014743971e 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useMatchingCommandMenuCommands.ts
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useMatchingCommandMenuCommands.ts
@@ -9,7 +9,6 @@ export const useMatchingCommandMenuCommands = ({
const { matchCommands } = useMatchCommands({ commandMenuSearch });
const {
- copilotCommands,
navigateCommands,
actionRecordSelectionCommands,
actionObjectCommands,
@@ -49,7 +48,6 @@ export const useMatchingCommandMenuCommands = ({
return {
noResults,
- copilotCommands,
matchingStandardActionRecordSelectionCommands,
matchingStandardActionObjectCommands,
matchingWorkflowRunRecordSelectionCommands,
diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useSearchRecords.tsx b/packages/twenty-front/src/modules/command-menu/hooks/useSearchRecords.tsx
index f9f403e552d..fcd67894195 100644
--- a/packages/twenty-front/src/modules/command-menu/hooks/useSearchRecords.tsx
+++ b/packages/twenty-front/src/modules/command-menu/hooks/useSearchRecords.tsx
@@ -1,4 +1,4 @@
-import { useOpenActivityRightDrawer } from '@/activities/hooks/useOpenActivityRightDrawer';
+import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { t } from '@lingui/core/macro';
@@ -24,13 +24,7 @@ export const useSearchRecords = () => {
},
});
- const openNoteRightDrawer = useOpenActivityRightDrawer({
- objectNameSingular: CoreObjectNameSingular.Note,
- });
-
- const openTaskRightDrawer = useOpenActivityRightDrawer({
- objectNameSingular: CoreObjectNameSingular.Task,
- });
+ const { openRecordInCommandMenu } = useCommandMenu();
const commands = useMemo(() => {
return (globalSearchData?.globalSearch ?? []).map((searchRecord) => {
@@ -63,14 +57,20 @@ export const useSearchRecords = () => {
to: '',
onCommandClick: () => {
searchRecord.objectSingularName === 'task'
- ? openTaskRightDrawer(searchRecord.recordId)
- : openNoteRightDrawer(searchRecord.recordId);
+ ? openRecordInCommandMenu({
+ recordId: searchRecord.recordId,
+ objectNameSingular: CoreObjectNameSingular.Task,
+ })
+ : openRecordInCommandMenu({
+ recordId: searchRecord.recordId,
+ objectNameSingular: CoreObjectNameSingular.Note,
+ });
},
};
}
return command;
});
- }, [globalSearchData, openTaskRightDrawer, openNoteRightDrawer]);
+ }, [globalSearchData, openRecordInCommandMenu]);
return {
loading,
diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx
index c94fe92dae8..fa270cd5435 100644
--- a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx
+++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx
@@ -1,7 +1,5 @@
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import {
WorkflowTriggerType,
WorkflowWithCurrentVersion,
@@ -14,10 +12,8 @@ import { OTHER_TRIGGER_TYPES } from '@/workflow/workflow-trigger/constants/Other
import { TRIGGER_STEP_ID } from '@/workflow/workflow-trigger/constants/TriggerStepId';
import { useUpdateWorkflowVersionTrigger } from '@/workflow/workflow-trigger/hooks/useUpdateWorkflowVersionTrigger';
import { getTriggerDefaultDefinition } from '@/workflow/workflow-trigger/utils/getTriggerDefaultDefinition';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useSetRecoilState } from 'recoil';
import { MenuItemCommand, useIcons } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const CommandMenuWorkflowSelectTriggerTypeContent = ({
workflow,
@@ -29,12 +25,8 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = ({
const { activeObjectMetadataItems } = useFilteredObjectMetadataItems();
- const { openRightDrawer } = useRightDrawer();
const setWorkflowSelectedNode = useSetRecoilState(workflowSelectedNodeState);
const { openWorkflowEditStepInCommandMenu } = useCommandMenu();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
const handleTriggerTypeClick = ({
type,
@@ -56,18 +48,11 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = ({
setWorkflowSelectedNode(TRIGGER_STEP_ID);
- if (isCommandMenuV2Enabled) {
- openWorkflowEditStepInCommandMenu(
- workflow.id,
- defaultLabel,
- getIcon(icon),
- );
- } else {
- openRightDrawer(RightDrawerPages.WorkflowStepEdit, {
- title: defaultLabel,
- Icon: getIcon(icon),
- });
- }
+ openWorkflowEditStepInCommandMenu(
+ workflow.id,
+ defaultLabel,
+ getIcon(icon),
+ );
};
};
diff --git a/packages/twenty-front/src/modules/favorites/components/PageFavoriteButton.tsx b/packages/twenty-front/src/modules/favorites/components/PageFavoriteButton.tsx
index 100abe308da..e8c32438212 100644
--- a/packages/twenty-front/src/modules/favorites/components/PageFavoriteButton.tsx
+++ b/packages/twenty-front/src/modules/favorites/components/PageFavoriteButton.tsx
@@ -1,6 +1,4 @@
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { Button, IconButton, IconHeart, IconHeartOff } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated/graphql';
+import { Button, IconHeart, IconHeartOff } from 'twenty-ui';
type PageFavoriteButtonProps = {
isFavorite: boolean;
@@ -13,33 +11,16 @@ export const PageFavoriteButton = ({
}: PageFavoriteButtonProps) => {
const title = isFavorite ? 'Remove from favorites' : 'Add to favorites';
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
return (
- <>
- {isCommandMenuV2Enabled ? (
- <Button
- Icon={isFavorite ? IconHeartOff : IconHeart}
- dataTestId="favorite-button"
- size="small"
- variant="secondary"
- accent="default"
- title={title}
- onClick={onClick}
- ariaLabel={title}
- />
- ) : (
- <IconButton
- Icon={IconHeart}
- size="medium"
- variant="secondary"
- data-testid="add-button"
- accent={isFavorite ? 'danger' : 'default'}
- onClick={onClick}
- />
- )}
- </>
+ <Button
+ Icon={isFavorite ? IconHeartOff : IconHeart}
+ dataTestId="favorite-button"
+ size="small"
+ variant="secondary"
+ accent="default"
+ title={title}
+ onClick={onClick}
+ ariaLabel={title}
+ />
);
};
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 bbc54d04f2d..f49cd7bcc2d 100644
--- a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx
+++ b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx
@@ -9,7 +9,7 @@ import {
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { getLinkToShowPage } from '@/object-metadata/utils/getLinkToShowPage';
import { useRecordChipData } from '@/object-record/hooks/useRecordChipData';
-import { recordIndexOpenRecordInSelector } from '@/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector';
+import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState';
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { useRecoilValue } from 'recoil';
@@ -41,9 +41,7 @@ export const RecordChip = ({
const { openRecordInCommandMenu } = useCommandMenu();
- const recordIndexOpenRecordIn = useRecoilValue(
- recordIndexOpenRecordInSelector,
- );
+ const recordIndexOpenRecordIn = useRecoilValue(recordIndexOpenRecordInState);
// TODO temporary until we create a record show page for Workspaces members
if (forceDisableClick) {
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
index ebbfaf985ef..e41e3e847bf 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
@@ -24,24 +24,16 @@ import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
-import { ViewType } from '@/views/types/ViewType';
import { useDeleteViewFromCurrentState } from '@/views/view-picker/hooks/useDeleteViewFromCurrentState';
import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/states/viewPickerReferenceViewIdComponentState';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useTheme } from '@emotion/react';
import { useLingui } from '@lingui/react/macro';
import { isDefined } from 'twenty-shared';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const ObjectOptionsDropdownMenuContent = () => {
const { t } = useLingui();
- const {
- recordIndexId,
- objectMetadataItem,
- viewType,
- onContentChange,
- closeDropdown,
- } = useOptionsDropdown();
+ const { recordIndexId, objectMetadataItem, onContentChange, closeDropdown } =
+ useOptionsDropdown();
const { getIcon } = useIcons();
const { currentView } = useGetCurrentViewOnly();
@@ -70,10 +62,6 @@ export const ObjectOptionsDropdownMenuContent = () => {
viewBarId: recordIndexId,
});
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const { deleteViewFromCurrentState } = useDeleteViewFromCurrentState();
const setViewPickerReferenceViewId = useSetRecoilComponentStateV2(
viewPickerReferenceViewIdComponentState,
@@ -95,19 +83,15 @@ export const ObjectOptionsDropdownMenuContent = () => {
{currentView?.name}
</DropdownMenuHeader>
- {(isCommandMenuV2Enabled || viewType === ViewType.Kanban) && (
- <>
- <DropdownMenuItemsContainer scrollable={false}>
- <MenuItem
- onClick={() => onContentChange('viewSettings')}
- LeftIcon={IconLayout}
- text={t`View settings`}
- hasSubMenu
- />
- </DropdownMenuItemsContainer>
- <DropdownMenuSeparator />
- </>
- )}
+ <DropdownMenuItemsContainer scrollable={false}>
+ <MenuItem
+ onClick={() => onContentChange('viewSettings')}
+ LeftIcon={IconLayout}
+ text={t`View settings`}
+ hasSubMenu
+ />
+ </DropdownMenuItemsContainer>
+ <DropdownMenuSeparator />
<DropdownMenuItemsContainer scrollable={false}>
<MenuItem
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownViewSettingsContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownViewSettingsContent.tsx
index e18488ca2b3..41e4d411239 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownViewSettingsContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownViewSettingsContent.tsx
@@ -15,10 +15,8 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop
import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { ViewType } from '@/views/types/ViewType';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useLingui } from '@lingui/react/macro';
import { useRecoilValue } from 'recoil';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const ObjectOptionsDropdownViewSettingsContent = () => {
const { t } = useLingui();
@@ -41,33 +39,27 @@ export const ObjectOptionsDropdownViewSettingsContent = () => {
const recordIndexOpenRecordIn = useRecoilValue(recordIndexOpenRecordInState);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
return (
<>
<DropdownMenuHeader StartIcon={IconChevronLeft} onClick={resetContent}>
{t`View settings`}
</DropdownMenuHeader>
<DropdownMenuItemsContainer>
- {isCommandMenuV2Enabled && (
- <MenuItem
- onClick={() => onContentChange('viewSettingsOpenIn')}
- LeftIcon={
- recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL
- ? IconLayoutSidebarRight
- : IconLayoutNavbar
- }
- text={t`Open in`}
- contextualText={
- recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL
- ? t`Side Panel`
- : t`Record Page`
- }
- hasSubMenu
- />
- )}
+ <MenuItem
+ onClick={() => onContentChange('viewSettingsOpenIn')}
+ LeftIcon={
+ recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL
+ ? IconLayoutSidebarRight
+ : IconLayoutNavbar
+ }
+ text={t`Open in`}
+ contextualText={
+ recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL
+ ? t`Side Panel`
+ : t`Record Page`
+ }
+ hasSubMenu
+ />
{viewType === ViewType.Kanban && (
<MenuItemToggle
LeftIcon={IconBaselineDensitySmall}
diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoard.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoard.tsx
index 93f8a68b825..0b13d619bf2 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoard.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoard.tsx
@@ -4,7 +4,6 @@ import { useContext, useRef } from 'react';
import { useRecoilCallback, useSetRecoilState } from 'recoil';
import { Key } from 'ts-key-enum';
-import { useActionMenu } from '@/action-menu/hooks/useActionMenu';
import { ActionBarHotkeyScope } from '@/action-menu/types/ActionBarHotKeyScope';
import { getActionMenuIdFromRecordIndexId } from '@/action-menu/utils/getActionMenuIdFromRecordIndexId';
import { RecordBoardHeader } from '@/object-record/record-board/components/RecordBoardHeader';
@@ -24,6 +23,7 @@ import { currentRecordSortsComponentState } from '@/object-record/record-sort/st
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
import { isRemoveSortingModalOpenState } from '@/object-record/record-table/states/isRemoveSortingModalOpenState';
import { TableHotkeyScope } from '@/object-record/record-table/types/TableHotkeyScope';
+import { useDropdownV2 } from '@/ui/layout/dropdown/hooks/useDropdownV2';
import { DragSelect } from '@/ui/utilities/drag-select/components/DragSelect';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useClickOutsideListener } from '@/ui/utilities/pointer-event/hooks/useClickOutsideListener';
@@ -76,10 +76,11 @@ export const RecordBoard = () => {
);
const actionMenuId = getActionMenuIdFromRecordIndexId(recordBoardId);
- const { closeActionMenuDropdown } = useActionMenu(actionMenuId);
+
+ const { closeDropdown } = useDropdownV2();
const handleDragSelectionStart = () => {
- closeActionMenuDropdown();
+ closeDropdown(actionMenuId);
toggleClickOutsideListener(false);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx
index bbb83581a34..88203a1c5f2 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx
@@ -1,4 +1,3 @@
-import { useActionMenu } from '@/action-menu/hooks/useActionMenu';
import { recordIndexActionMenuDropdownPositionComponentState } from '@/action-menu/states/recordIndexActionMenuDropdownPositionComponentState';
import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getActionMenuDropdownIdFromActionMenuId';
import { getActionMenuIdFromRecordIndexId } from '@/action-menu/utils/getActionMenuIdFromRecordIndexId';
@@ -8,13 +7,14 @@ import { RecordBoardScopeInternalContext } from '@/object-record/record-board/sc
import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState';
import { isRecordBoardCompactModeActiveComponentState } from '@/object-record/record-board/states/isRecordBoardCompactModeActiveComponentState';
import { recordBoardVisibleFieldDefinitionsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardVisibleFieldDefinitionsComponentSelector';
-import { recordIndexOpenRecordInSelector } from '@/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector';
import { RecordBoardCardBody } from '@/object-record/record-board/record-board-card/components/RecordBoardCardBody';
import { RecordBoardCardHeader } from '@/object-record/record-board/record-board-card/components/RecordBoardCardHeader';
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
+import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState';
import { RecordValueSetterEffect } from '@/object-record/record-store/components/RecordValueSetterEffect';
import { AppPath } from '@/types/AppPath';
+import { useDropdownV2 } from '@/ui/layout/dropdown/hooks/useDropdownV2';
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
import { RecordBoardScrollWrapperContext } from '@/ui/utilities/scroll/contexts/ScrollWrapperContexts';
import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentFamilyStateV2';
@@ -119,11 +119,9 @@ export const RecordBoardCard = ({
),
);
- const { openActionMenuDropdown } = useActionMenu(actionMenuId);
+ const { openDropdown } = useDropdownV2();
- const recordIndexOpenRecordIn = useRecoilValue(
- recordIndexOpenRecordInSelector,
- );
+ const recordIndexOpenRecordIn = useRecoilValue(recordIndexOpenRecordInState);
const handleActionMenuDropdown = (event: React.MouseEvent) => {
event.preventDefault();
@@ -132,7 +130,7 @@ export const RecordBoardCard = ({
x: event.clientX,
y: event.clientY,
});
- openActionMenuDropdown();
+ openDropdown(actionMenuDropdownId);
};
const handleCardClick = () => {
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx
index 098ceb4121e..2ff847d1ef7 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx
@@ -19,7 +19,7 @@ import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata'
import { getFieldButtonIcon } from '@/object-record/record-field/utils/getFieldButtonIcon';
import { isFieldValueEmpty } from '@/object-record/record-field/utils/isFieldValueEmpty';
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
-import { recordIndexOpenRecordInSelector } from '@/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector';
+import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState';
import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell';
import { RecordInlineCellEditMode } from '@/object-record/record-inline-cell/components/RecordInlineCellEditMode';
import { InlineCellHotkeyScope } from '@/object-record/record-inline-cell/types/InlineCellHotkeyScope';
@@ -125,9 +125,7 @@ export const RecordBoardCardHeader = ({
return [updateEntity, { loading: false }];
};
- const recordIndexOpenRecordIn = useRecoilValue(
- recordIndexOpenRecordInSelector,
- );
+ const recordIndexOpenRecordIn = useRecoilValue(recordIndexOpenRecordInState);
return (
<RecordBoardCardHeaderContainer showCompactView={showCompactView}>
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunity.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunity.tsx
index 4e3d4f8e495..6f9243f94b2 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunity.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewOpportunity.tsx
@@ -1,3 +1,4 @@
+import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
import { useAddNewCard } from '@/object-record/record-board/record-board-column/hooks/useAddNewCard';
@@ -6,11 +7,8 @@ import { SingleRecordPicker } from '@/object-record/record-picker/single-record-
import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState';
import { OverlayContainer } from '@/ui/layout/overlay/components/OverlayContainer';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { isDefined } from 'twenty-shared';
-import { IconList } from 'twenty-ui';
import { v4 } from 'uuid';
export const RecordBoardColumnNewOpportunity = ({
@@ -34,14 +32,15 @@ export const RecordBoardColumnNewOpportunity = ({
const { createOneRecord: createCompany } = useCreateOneRecord({
objectNameSingular: CoreObjectNameSingular.Company,
});
- const { openRightDrawer } = useRightDrawer();
const setViewableRecordId = useSetRecoilState(viewableRecordIdState);
const setViewableRecordNameSingular = useSetRecoilState(
viewableRecordNameSingularState,
);
- const createCompanyOpportunityAndOpenRightDrawer = async (
+ const { openRecordInCommandMenu } = useCommandMenu();
+
+ const createCompanyOpportunityAndOpenCommandMenu = async (
searchInput?: string,
) => {
const newRecordId = v4();
@@ -53,9 +52,9 @@ export const RecordBoardColumnNewOpportunity = ({
setViewableRecordId(newRecordId);
setViewableRecordNameSingular(CoreObjectNameSingular.Company);
- openRightDrawer(RightDrawerPages.ViewRecord, {
- title: 'Company',
- Icon: IconList,
+ openRecordInCommandMenu({
+ recordId: newRecordId,
+ objectNameSingular: CoreObjectNameSingular.Company,
});
if (isDefined(createdCompany)) {
@@ -74,7 +73,7 @@ export const RecordBoardColumnNewOpportunity = ({
company ? handleEntitySelect(position, company) : null
}
objectNameSingular={CoreObjectNameSingular.Company}
- onCreate={createCompanyOpportunityAndOpenRightDrawer}
+ onCreate={createCompanyOpportunityAndOpenCommandMenu}
/>
</OverlayContainer>
)}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts
index effcfecf49f..687f1baa34d 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts
@@ -9,13 +9,8 @@ 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 { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { isDefined } from 'twenty-shared';
-import { IconEye } from 'twenty-ui';
import {
- FeatureFlagKey,
FieldMetadataType,
RelationDefinitionType,
} from '~/generated-metadata/graphql';
@@ -47,11 +42,7 @@ export const useAddNewRecordAndOpenRightDrawer = ({
.nameSingular ?? 'workspaceMember',
});
- const { openRightDrawer } = useRightDrawer();
const { openRecordInCommandMenu } = useCommandMenu();
- const isCommandMenuEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
if (
relationObjectMetadataNameSingular === 'workspaceMember' ||
@@ -118,17 +109,10 @@ export const useAddNewRecordAndOpenRightDrawer = ({
setViewableRecordId(newRecordId);
setViewableRecordNameSingular(relationObjectMetadataNameSingular);
- if (isCommandMenuEnabled) {
- openRecordInCommandMenu({
- recordId: newRecordId,
- objectNameSingular: relationObjectMetadataNameSingular,
- });
- } else {
- openRightDrawer(RightDrawerPages.ViewRecord, {
- title: 'View Record',
- Icon: IconEye,
- });
- }
+ openRecordInCommandMenu({
+ recordId: newRecordId,
+ objectNameSingular: relationObjectMetadataNameSingular,
+ });
},
};
};
diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx
index ad131b51cd0..05aad68c6da 100644
--- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx
@@ -14,13 +14,10 @@ import { useRecordIndexContextOrThrow } from '@/object-record/record-index/conte
import { RecordFieldValueSelectorContextProvider } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext';
import { SpreadsheetImportProvider } from '@/spreadsheet-import/provider/components/SpreadsheetImportProvider';
-import { RecordIndexActionMenu } from '@/action-menu/components/RecordIndexActionMenu';
import { RecordIndexFiltersToContextStoreEffect } from '@/object-record/record-index/components/RecordIndexFiltersToContextStoreEffect';
import { RecordIndexTableContainerEffect } from '@/object-record/record-index/components/RecordIndexTableContainerEffect';
import { ViewBar } from '@/views/components/ViewBar';
import { ViewType } from '@/views/types/ViewType';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { FeatureFlagKey } from '~/generated/graphql';
const StyledContainer = styled.div`
display: flex;
@@ -47,10 +44,6 @@ export const RecordIndexContainer = () => {
objectNameSingular,
} = useRecordIndexContextOrThrow();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
return (
<>
<StyledContainer>
@@ -96,9 +89,6 @@ export const RecordIndexContainer = () => {
<RecordIndexBoardDataLoaderEffect recordBoardId={recordIndexId} />
</StyledContainerWithPadding>
)}
- {!isCommandMenuV2Enabled && (
- <RecordIndexActionMenu indexId={recordIndexId} />
- )}
</RecordFieldValueSelectorContextProvider>
</StyledContainer>
</>
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 7cd7e4be9b2..7a0fcc1f9e8 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
@@ -1,20 +1,10 @@
import { RecordIndexActionMenu } from '@/action-menu/components/RecordIndexActionMenu';
-import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState';
import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems';
-import { isObjectMetadataReadOnly } from '@/object-metadata/utils/isObjectMetadataReadOnly';
-import { RecordIndexPageKanbanAddButton } from '@/object-record/record-index/components/RecordIndexPageKanbanAddButton';
-import { RecordIndexPageTableAddButton } from '@/object-record/record-index/components/RecordIndexPageTableAddButton';
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
-import { recordIndexViewTypeState } from '@/object-record/record-index/states/recordIndexViewTypeState';
import { PageHeaderOpenCommandMenuButton } from '@/ui/layout/page-header/components/PageHeaderOpenCommandMenuButton';
import { PageHeader } from '@/ui/layout/page/components/PageHeader';
-import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-import { ViewType } from '@/views/types/ViewType';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { useRecoilValue } from 'recoil';
-import { capitalize, isDefined } from 'twenty-shared';
+import { capitalize } from 'twenty-shared';
import { useIcons } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated/graphql';
export const RecordIndexPageHeader = () => {
const { findObjectMetadataItemByNamePlural } =
@@ -28,48 +18,14 @@ export const RecordIndexPageHeader = () => {
const { getIcon } = useIcons();
const Icon = getIcon(objectMetadataItem?.icon);
- const recordIndexViewType = useRecoilValue(recordIndexViewTypeState);
-
const { recordIndexId } = useRecordIndexContextOrThrow();
- const numberOfSelectedRecords = useRecoilComponentValueV2(
- contextStoreNumberOfSelectedRecordsComponentState,
- );
-
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
- const isObjectMetadataItemReadOnly =
- isDefined(objectMetadataItem) &&
- isObjectMetadataReadOnly(objectMetadataItem);
-
- const shouldDisplayAddButton =
- (numberOfSelectedRecords === 0 || !isCommandMenuV2Enabled) &&
- !isObjectMetadataItemReadOnly &&
- !isCommandMenuV2Enabled;
-
- const isTable = recordIndexViewType === ViewType.Table;
-
const pageHeaderTitle =
objectMetadataItem?.labelPlural ?? capitalize(objectNamePlural);
return (
<PageHeader title={pageHeaderTitle} Icon={Icon}>
- {shouldDisplayAddButton &&
- /**
- * TODO: Logic between Table and Kanban should be merged here when we move some states to record-index
- */
- (isTable ? (
- <RecordIndexPageTableAddButton />
- ) : (
- <RecordIndexPageKanbanAddButton />
- ))}
-
- {isCommandMenuV2Enabled && (
- <RecordIndexActionMenu indexId={recordIndexId} />
- )}
-
+ <RecordIndexActionMenu indexId={recordIndexId} />
<PageHeaderOpenCommandMenuButton />
</PageHeader>
);
diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageTableAddButton.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageTableAddButton.tsx
deleted file mode 100644
index aef0ef97ae5..00000000000
--- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageTableAddButton.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import { hasRecordGroupsComponentSelector } from '@/object-record/record-group/states/selectors/hasRecordGroupsComponentSelector';
-import { RecordIndexAddRecordInGroupDropdown } from '@/object-record/record-index/components/RecordIndexAddRecordInGroupDropdown';
-import { RecordIndexPageTableAddButtonNoGroup } from '@/object-record/record-index/components/RecordIndexPageTableAddButtonNoGroup';
-import { PageAddButton } from '@/ui/layout/page/components/PageAddButton';
-import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-
-export const RecordIndexPageTableAddButton = () => {
- const hasRecordGroups = useRecoilComponentValueV2(
- hasRecordGroupsComponentSelector,
- );
-
- if (!hasRecordGroups) {
- return <RecordIndexPageTableAddButtonNoGroup />;
- }
-
- return (
- <RecordIndexAddRecordInGroupDropdown
- dropdownId="record-index-page-table-add-button-dropdown"
- clickableComponent={<PageAddButton />}
- />
- );
-};
diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageTableAddButtonNoGroup.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageTableAddButtonNoGroup.tsx
deleted file mode 100644
index 66b8c3a5830..00000000000
--- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageTableAddButtonNoGroup.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
-import { useCreateNewTableRecord } from '@/object-record/record-table/hooks/useCreateNewTableRecords';
-import { PageAddButton } from '@/ui/layout/page/components/PageAddButton';
-import { PageHotkeysEffect } from '@/ui/layout/page/components/PageHotkeysEffect';
-
-export const RecordIndexPageTableAddButtonNoGroup = () => {
- const { recordIndexId, objectMetadataItem } = useRecordIndexContextOrThrow();
-
- const { createNewTableRecord } = useCreateNewTableRecord({
- objectMetadataItem,
- recordTableId: recordIndexId,
- });
-
- const handleCreateNewTableRecord = () => {
- createNewTableRecord();
- };
-
- return (
- <>
- <PageHotkeysEffect onAddButtonClick={handleCreateNewTableRecord} />
- <PageAddButton onClick={handleCreateNewTableRecord} />
- </>
- );
-};
diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector.ts b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector.ts
deleted file mode 100644
index ba756a83a09..00000000000
--- a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState';
-import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
-import { checkIfFeatureFlagIsEnabledOnWorkspace } from '@/workspace/utils/checkIfFeatureFlagIsEnabledOnWorkspace';
-import { selector } from 'recoil';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
-
-export const recordIndexOpenRecordInSelector = selector<ViewOpenRecordInType>({
- key: 'recordIndexOpenRecordInSelector',
- get: ({ get }) => {
- const currentWorkspace = get(currentWorkspaceState);
- const isCommandMenuV2Enabled = checkIfFeatureFlagIsEnabledOnWorkspace(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- currentWorkspace,
- );
-
- return isCommandMenuV2Enabled
- ? get(recordIndexOpenRecordInState)
- : ViewOpenRecordInType.RECORD_PAGE;
- },
-});
diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/SummaryCard.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/SummaryCard.tsx
index bf580fc61e2..f855c81114c 100644
--- a/packages/twenty-front/src/modules/object-record/record-show/components/SummaryCard.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-show/components/SummaryCard.tsx
@@ -1,20 +1,15 @@
-import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType';
import { useGetStandardObjectIcon } from '@/object-metadata/hooks/useGetStandardObjectIcon';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
-import { isFieldValueReadOnly } from '@/object-record/record-field/utils/isFieldValueReadOnly';
-import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell';
import { InlineCellHotkeyScope } from '@/object-record/record-inline-cell/types/InlineCellHotkeyScope';
-import { RightDrawerTitleRecordInlineCell } from '@/object-record/record-right-drawer/components/RightDrawerTitleRecordInlineCell';
import { useRecordShowContainerActions } from '@/object-record/record-show/hooks/useRecordShowContainerActions';
import { useRecordShowContainerData } from '@/object-record/record-show/hooks/useRecordShowContainerData';
import { RecordTitleCell } from '@/object-record/record-title-cell/components/RecordTitleCell';
import { ShowPageSummaryCard } from '@/ui/layout/show-page/components/ShowPageSummaryCard';
import { ShowPageSummaryCardSkeletonLoader } from '@/ui/layout/show-page/components/ShowPageSummaryCardSkeletonLoader';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { isDefined } from 'twenty-shared';
-import { FeatureFlagKey, FieldMetadataType } from '~/generated/graphql';
+import { FieldMetadataType } from '~/generated/graphql';
type SummaryCardProps = {
objectNameSingular: string;
@@ -51,16 +46,6 @@ export const SummaryCard = ({
const { Icon, IconColor } = useGetStandardObjectIcon(objectNameSingular);
const isMobile = useIsMobile() || isInRightDrawer;
- const isReadOnly = isFieldValueReadOnly({
- objectNameSingular,
- isRecordDeleted: recordFromStore?.isDeleted,
- contextStoreCurrentViewType: ContextStoreViewType.ShowPage,
- });
-
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
if (isNewRightDrawerItemLoading || !isDefined(recordFromStore)) {
return <ShowPageSummaryCardSkeletonLoader />;
}
@@ -101,13 +86,7 @@ export const SummaryCard = ({
isDisplayModeFixHeight: true,
}}
>
- {isCommandMenuV2Enabled ? (
- <RecordTitleCell sizeVariant="md" />
- ) : isInRightDrawer ? (
- <RightDrawerTitleRecordInlineCell />
- ) : (
- <RecordInlineCell readonly={isReadOnly} />
- )}
+ <RecordTitleCell sizeVariant="md" />
</FieldContext.Provider>
}
avatarType={recordIdentifier?.avatarType ?? 'rounded'}
diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewTableRecords.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewTableRecords.ts
index 7df51351b8d..7de49f05896 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewTableRecords.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewTableRecords.ts
@@ -5,20 +5,16 @@ import { recordIndexOpenRecordInState } from '@/object-record/record-index/state
import { DEFAULT_CELL_SCOPE } from '@/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2';
import { useSelectedTableCellEditMode } from '@/object-record/record-table/record-table-cell/hooks/useSelectedTableCellEditMode';
import { recordTablePendingRecordIdByGroupComponentFamilyState } from '@/object-record/record-table/states/recordTablePendingRecordIdByGroupComponentFamilyState';
-import { recordTablePendingRecordIdComponentState } from '@/object-record/record-table/states/recordTablePendingRecordIdComponentState';
import { useRecordTitleCell } from '@/object-record/record-title-cell/hooks/useRecordTitleCell';
import { getDropdownFocusIdForRecordField } from '@/object-record/utils/getDropdownFocusIdForRecordField';
import { AppPath } from '@/types/AppPath';
import { useSetActiveDropdownFocusIdAndMemorizePrevious } from '@/ui/layout/dropdown/hooks/useSetFocusedDropdownIdAndMemorizePrevious';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
-import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useRecoilCallback } from 'recoil';
import { isDefined } from 'twenty-shared';
import { v4 } from 'uuid';
-import { FeatureFlagKey } from '~/generated/graphql';
import { useNavigateApp } from '~/hooks/useNavigateApp';
export const useCreateNewTableRecord = ({
@@ -34,11 +30,6 @@ export const useCreateNewTableRecord = ({
const setHotkeyScope = useSetHotkeyScope();
- const setPendingRecordId = useSetRecoilComponentStateV2(
- recordTablePendingRecordIdComponentState,
- recordTableId,
- );
-
const recordTablePendingRecordIdByGroupFamilyState =
useRecoilComponentCallbackStateV2(
recordTablePendingRecordIdByGroupComponentFamilyState,
@@ -50,10 +41,6 @@ export const useCreateNewTableRecord = ({
const { openRecordInCommandMenu } = useCommandMenu();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const { createOneRecord } = useCreateOneRecord({
objectNameSingular: objectMetadataItem.nameSingular,
shouldMatchRootQueryFilter: true,
@@ -68,64 +55,37 @@ export const useCreateNewTableRecord = ({
async () => {
const recordId = v4();
- if (isCommandMenuV2Enabled) {
- const recordIndexOpenRecordIn = snapshot
- .getLoadable(recordIndexOpenRecordInState)
- .getValue();
-
- await createOneRecord({ id: recordId });
-
- if (recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL) {
- openRecordInCommandMenu({
- recordId,
- objectNameSingular: objectMetadataItem.nameSingular,
- isNewRecord: true,
- });
-
- openRecordTitleCell({
- recordId,
- fieldMetadataId:
- objectMetadataItem.labelIdentifierFieldMetadataId,
- });
- } else {
- navigate(AppPath.RecordShowPage, {
- objectNameSingular: objectMetadataItem.nameSingular,
- objectRecordId: recordId,
- });
- }
-
- return;
- }
-
- setPendingRecordId(recordId);
- setSelectedTableCellEditMode(-1, 0);
- setHotkeyScope(
- DEFAULT_CELL_SCOPE.scope,
- DEFAULT_CELL_SCOPE.customScopes,
- );
-
- if (isDefined(objectMetadataItem.labelIdentifierFieldMetadataId)) {
- setActiveDropdownFocusIdAndMemorizePrevious(
- getDropdownFocusIdForRecordField(
- recordId,
- objectMetadataItem.labelIdentifierFieldMetadataId,
- 'table-cell',
- ),
- );
+ const recordIndexOpenRecordIn = snapshot
+ .getLoadable(recordIndexOpenRecordInState)
+ .getValue();
+
+ await createOneRecord({ id: recordId });
+
+ if (recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL) {
+ openRecordInCommandMenu({
+ recordId,
+ objectNameSingular: objectMetadataItem.nameSingular,
+ isNewRecord: true,
+ });
+
+ openRecordTitleCell({
+ recordId,
+ fieldMetadataId: objectMetadataItem.labelIdentifierFieldMetadataId,
+ });
+ } else {
+ navigate(AppPath.RecordShowPage, {
+ objectNameSingular: objectMetadataItem.nameSingular,
+ objectRecordId: recordId,
+ });
}
},
[
createOneRecord,
- isCommandMenuV2Enabled,
navigate,
objectMetadataItem.labelIdentifierFieldMetadataId,
objectMetadataItem.nameSingular,
openRecordInCommandMenu,
openRecordTitleCell,
- setActiveDropdownFocusIdAndMemorizePrevious,
- setHotkeyScope,
- setPendingRecordId,
- setSelectedTableCellEditMode,
],
);
const createNewTableRecordInGroup = useRecoilCallback(
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2.ts
index de501a8bb5c..c25fe586b15 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCellV2.ts
@@ -10,8 +10,6 @@ import { SOFT_FOCUS_CLICK_OUTSIDE_LISTENER_ID } from '@/object-record/record-tab
import { useLeaveTableFocus } from '@/object-record/record-table/hooks/internal/useLeaveTableFocus';
import { useMoveEditModeToTableCellPosition } from '@/object-record/record-table/hooks/internal/useMoveEditModeToCellPosition';
import { TableCellPosition } from '@/object-record/record-table/types/TableCellPosition';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
@@ -22,7 +20,7 @@ import { isDefined } from 'twenty-shared';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { useOpenFieldInputEditMode } from '@/object-record/record-field/hooks/useOpenFieldInputEditMode';
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
-import { recordIndexOpenRecordInSelector } from '@/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector';
+import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState';
import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState';
import { RECORD_TABLE_CLICK_OUTSIDE_LISTENER_ID } from '@/object-record/record-table/constants/RecordTableClickOutsideListenerId';
import { getDropdownFocusIdForRecordField } from '@/object-record/utils/getDropdownFocusIdForRecordField';
@@ -30,7 +28,6 @@ import { useSetActiveDropdownFocusIdAndMemorizePrevious } from '@/ui/layout/drop
import { useClickOustideListenerStates } from '@/ui/utilities/pointer-event/hooks/useClickOustideListenerStates';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { useNavigate } from 'react-router-dom';
-import { IconList } from 'twenty-ui';
import { TableHotkeyScope } from '../../types/TableHotkeyScope';
export const DEFAULT_CELL_SCOPE: HotkeyScope = {
@@ -68,7 +65,6 @@ export const useOpenRecordTableCellV2 = (tableScopeId: string) => {
const initDraftValue = useInitDraftValueV2();
- const { openRightDrawer } = useRightDrawer();
const setViewableRecordId = useSetRecoilState(viewableRecordIdState);
const setViewableRecordNameSingular = useSetRecoilState(
viewableRecordNameSingularState,
@@ -124,7 +120,7 @@ export const useOpenRecordTableCellV2 = (tableScopeId: string) => {
leaveTableFocus();
const openRecordIn = snapshot
- .getLoadable(recordIndexOpenRecordInSelector)
+ .getLoadable(recordIndexOpenRecordInState)
.getValue();
if (openRecordIn === ViewOpenRecordInType.RECORD_PAGE) {
@@ -145,10 +141,6 @@ export const useOpenRecordTableCellV2 = (tableScopeId: string) => {
leaveTableFocus();
setViewableRecordId(recordId);
setViewableRecordNameSingular(objectNameSingular);
- openRightDrawer(RightDrawerPages.ViewRecord, {
- title: objectNameSingular,
- Icon: IconList,
- });
return;
}
@@ -204,7 +196,6 @@ export const useOpenRecordTableCellV2 = (tableScopeId: string) => {
openRecordInCommandMenu,
setViewableRecordId,
setViewableRecordNameSingular,
- openRightDrawer,
setHotkeyScope,
],
);
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 43a7863c71d..e1bacd3294a 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
@@ -2,10 +2,8 @@ import { useRecoilCallback } from 'recoil';
import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';
import { recordIndexActionMenuDropdownPositionComponentState } from '@/action-menu/states/recordIndexActionMenuDropdownPositionComponentState';
-import { getActionBarIdFromActionMenuId } from '@/action-menu/utils/getActionBarIdFromActionMenuId';
import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/getActionMenuDropdownIdFromActionMenuId';
import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState';
-import { isBottomBarOpenedComponentState } from '@/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState';
import { useSetActiveDropdownFocusIdAndMemorizePrevious } from '@/ui/layout/dropdown/hooks/useSetFocusedDropdownIdAndMemorizePrevious';
import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
@@ -37,10 +35,6 @@ export const useTriggerActionMenuDropdown = ({
getActionMenuDropdownIdFromActionMenuId(actionMenuInstanceId),
);
- const isActionBarOpenState = isBottomBarOpenedComponentState.atomFamily({
- instanceId: getActionBarIdFromActionMenuId(actionMenuInstanceId),
- });
-
const { setActiveDropdownFocusIdAndMemorizePrevious } =
useSetActiveDropdownFocusIdAndMemorizePrevious();
@@ -63,7 +57,6 @@ export const useTriggerActionMenuDropdown = ({
set(isRowSelectedFamilyState(recordId), true);
}
- set(isActionBarOpenState, false);
set(isActionMenuDropdownOpenState, true);
const actionMenuDropdownId =
@@ -72,7 +65,6 @@ export const useTriggerActionMenuDropdown = ({
setActiveDropdownFocusIdAndMemorizePrevious(actionMenuDropdownId);
},
[
- isActionBarOpenState,
isActionMenuDropdownOpenState,
isRowSelectedFamilyState,
recordIndexActionMenuDropdownPositionState,
diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockPage.tsx b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockPage.tsx
index c8ede31324b..d1d19a579c5 100644
--- a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockPage.tsx
+++ b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockPage.tsx
@@ -3,11 +3,9 @@ import { IconBuildingSkyscraper } from 'twenty-ui';
import { RecordFieldValueSelectorContextProvider } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext';
import { SignInBackgroundMockContainer } from '@/sign-in-background-mock/components/SignInBackgroundMockContainer';
-import { PageAddButton } from '@/ui/layout/page/components/PageAddButton';
import { PageBody } from '@/ui/layout/page/components/PageBody';
import { PageContainer } from '@/ui/layout/page/components/PageContainer';
import { PageHeader } from '@/ui/layout/page/components/PageHeader';
-import { PageHotkeysEffect } from '@/ui/layout/page/components/PageHotkeysEffect';
const StyledTableContainer = styled.div`
display: flex;
@@ -18,10 +16,7 @@ const StyledTableContainer = styled.div`
export const SignInBackgroundMockPage = () => {
return (
<PageContainer>
- <PageHeader title="Companies" Icon={IconBuildingSkyscraper}>
- <PageHotkeysEffect onAddButtonClick={() => {}} />
- <PageAddButton />
- </PageHeader>
+ <PageHeader title="Companies" Icon={IconBuildingSkyscraper} />
<PageBody>
<RecordFieldValueSelectorContextProvider>
<StyledTableContainer>
diff --git a/packages/twenty-front/src/modules/ui/layout/bottom-bar/components/BottomBar.tsx b/packages/twenty-front/src/modules/ui/layout/bottom-bar/components/BottomBar.tsx
deleted file mode 100644
index 46ccff887a7..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/bottom-bar/components/BottomBar.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import styled from '@emotion/styled';
-
-import { useBottomBarInternalHotkeyScopeManagement } from '@/ui/layout/bottom-bar/hooks/useBottomBarInternalHotkeyScopeManagement';
-import { BottomBarInstanceContext } from '@/ui/layout/bottom-bar/states/contexts/BottomBarInstanceContext';
-import { isBottomBarOpenedComponentState } from '@/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
-import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
-
-const StyledContainerActionBar = styled.div`
- align-items: center;
- background: ${({ theme }) => theme.background.secondary};
- border: 1px solid ${({ theme }) => theme.border.color.medium};
- border-radius: ${({ theme }) => theme.border.radius.md};
- bottom: 38px;
- box-shadow: ${({ theme }) => theme.boxShadow.strong};
- display: flex;
- height: 48px;
- width: max-content;
- left: 50%;
- padding-left: ${({ theme }) => theme.spacing(2)};
- padding-right: ${({ theme }) => theme.spacing(2)};
- position: absolute;
- top: auto;
-
- transform: translateX(-50%);
- z-index: 1;
-`;
-
-type BottomBarProps = {
- bottomBarId: string;
- bottomBarHotkeyScopeFromParent: HotkeyScope;
- children: React.ReactNode;
-};
-
-export const BottomBar = ({
- bottomBarId,
- bottomBarHotkeyScopeFromParent,
- children,
-}: BottomBarProps) => {
- const isBottomBarOpen = useRecoilComponentValueV2(
- isBottomBarOpenedComponentState,
- bottomBarId,
- );
-
- useBottomBarInternalHotkeyScopeManagement({
- bottomBarId,
- bottomBarHotkeyScopeFromParent,
- });
-
- if (!isBottomBarOpen) {
- return null;
- }
-
- return (
- <BottomBarInstanceContext.Provider value={{ instanceId: bottomBarId }}>
- <StyledContainerActionBar data-select-disable className="bottom-bar">
- {children}
- </StyledContainerActionBar>
- </BottomBarInstanceContext.Provider>
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/bottom-bar/components/__stories__/BottomBar.stories.tsx b/packages/twenty-front/src/modules/ui/layout/bottom-bar/components/__stories__/BottomBar.stories.tsx
deleted file mode 100644
index 96f43c1bc26..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/bottom-bar/components/__stories__/BottomBar.stories.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-import { BottomBar } from '@/ui/layout/bottom-bar/components/BottomBar';
-import { isBottomBarOpenedComponentState } from '@/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState';
-import styled from '@emotion/styled';
-import { Meta, StoryObj } from '@storybook/react';
-import { RecoilRoot } from 'recoil';
-import { Button, IconPlus } from 'twenty-ui';
-
-const StyledContainer = styled.div`
- display: flex;
- gap: 10px;
-`;
-
-const meta: Meta<typeof BottomBar> = {
- title: 'UI/Layout/BottomBar/BottomBar',
- component: BottomBar,
- args: {
- bottomBarId: 'test',
- bottomBarHotkeyScopeFromParent: { scope: 'test' },
- children: (
- <StyledContainer>
- <Button title="Test 1" Icon={IconPlus} />
- <Button title="Test 2" Icon={IconPlus} />
- <Button title="Test 3" Icon={IconPlus} />
- </StyledContainer>
- ),
- },
- argTypes: {
- bottomBarId: { control: false },
- bottomBarHotkeyScopeFromParent: { control: false },
- children: { control: false },
- },
-};
-
-export default meta;
-
-export const Default: StoryObj<typeof BottomBar> = {
- decorators: [
- (Story) => (
- <RecoilRoot
- initializeState={({ set }) => {
- set(
- isBottomBarOpenedComponentState.atomFamily({
- instanceId: 'test',
- }),
- true,
- );
- }}
- >
- <Story />
- </RecoilRoot>
- ),
- ],
-};
-
-export const Closed: StoryObj<typeof BottomBar> = {
- decorators: [
- (Story) => (
- <RecoilRoot>
- <Story />
- </RecoilRoot>
- ),
- ],
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/bottom-bar/hooks/useBottomBar.ts b/packages/twenty-front/src/modules/ui/layout/bottom-bar/hooks/useBottomBar.ts
deleted file mode 100644
index 7cbb867f26b..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/bottom-bar/hooks/useBottomBar.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-import { useRecoilCallback } from 'recoil';
-
-import { bottomBarHotkeyComponentState } from '@/ui/layout/bottom-bar/states/bottomBarHotkeyComponentState';
-import { isBottomBarOpenedComponentState } from '@/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState';
-import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
-import { isDefined } from 'twenty-shared';
-
-export const useBottomBar = () => {
- const {
- setHotkeyScopeAndMemorizePreviousScope,
- goBackToPreviousHotkeyScope,
- } = usePreviousHotkeyScope();
-
- const closeBottomBar = useRecoilCallback(
- ({ set }) =>
- (specificComponentId: string) => {
- goBackToPreviousHotkeyScope();
- set(
- isBottomBarOpenedComponentState.atomFamily({
- instanceId: specificComponentId,
- }),
- false,
- );
- },
- [goBackToPreviousHotkeyScope],
- );
-
- const openBottomBar = useRecoilCallback(
- ({ set, snapshot }) =>
- (specificComponentId: string, customHotkeyScope?: HotkeyScope) => {
- const bottomBarHotkeyScope = snapshot
- .getLoadable(
- bottomBarHotkeyComponentState.atomFamily({
- instanceId: specificComponentId,
- }),
- )
- .getValue();
-
- set(
- isBottomBarOpenedComponentState.atomFamily({
- instanceId: specificComponentId,
- }),
- true,
- );
-
- if (isDefined(customHotkeyScope)) {
- setHotkeyScopeAndMemorizePreviousScope(
- customHotkeyScope.scope,
- customHotkeyScope.customScopes,
- );
- } else if (isDefined(bottomBarHotkeyScope)) {
- setHotkeyScopeAndMemorizePreviousScope(
- bottomBarHotkeyScope.scope,
- bottomBarHotkeyScope.customScopes,
- );
- }
- },
- [setHotkeyScopeAndMemorizePreviousScope],
- );
-
- const toggleBottomBar = useRecoilCallback(
- ({ snapshot }) =>
- (specificComponentId: string) => {
- const isBottomBarOpen = snapshot
- .getLoadable(
- isBottomBarOpenedComponentState.atomFamily({
- instanceId: specificComponentId,
- }),
- )
- .getValue();
-
- if (isBottomBarOpen) {
- closeBottomBar(specificComponentId);
- } else {
- openBottomBar(specificComponentId);
- }
- },
- [closeBottomBar, openBottomBar],
- );
-
- return {
- closeBottomBar,
- openBottomBar,
- toggleBottomBar,
- };
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/bottom-bar/hooks/useBottomBarInternalHotkeyScopeManagement.ts b/packages/twenty-front/src/modules/ui/layout/bottom-bar/hooks/useBottomBarInternalHotkeyScopeManagement.ts
deleted file mode 100644
index a35ccfc69ea..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/bottom-bar/hooks/useBottomBarInternalHotkeyScopeManagement.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { useEffect } from 'react';
-
-import { bottomBarHotkeyComponentState } from '@/ui/layout/bottom-bar/states/bottomBarHotkeyComponentState';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
-import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
-import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
-
-export const useBottomBarInternalHotkeyScopeManagement = ({
- bottomBarId,
- bottomBarHotkeyScopeFromParent,
-}: {
- bottomBarId?: string;
- bottomBarHotkeyScopeFromParent?: HotkeyScope;
-}) => {
- const [bottomBarHotkeyScope, setBottomBarHotkeyScope] =
- useRecoilComponentStateV2(bottomBarHotkeyComponentState, bottomBarId);
-
- useEffect(() => {
- if (!isDeeplyEqual(bottomBarHotkeyScopeFromParent, bottomBarHotkeyScope)) {
- setBottomBarHotkeyScope(bottomBarHotkeyScopeFromParent);
- }
- }, [
- bottomBarHotkeyScope,
- bottomBarHotkeyScopeFromParent,
- setBottomBarHotkeyScope,
- ]);
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/bottomBarHotkeyComponentState.ts b/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/bottomBarHotkeyComponentState.ts
deleted file mode 100644
index 89144d6c8c3..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/bottomBarHotkeyComponentState.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { BottomBarInstanceContext } from '@/ui/layout/bottom-bar/states/contexts/BottomBarInstanceContext';
-import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
-import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
-
-export const bottomBarHotkeyComponentState = createComponentStateV2<
- HotkeyScope | null | undefined
->({
- key: 'bottomBarHotkeyComponentState',
- defaultValue: null,
- componentInstanceContext: BottomBarInstanceContext,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/contexts/BottomBarInstanceContext.tsx b/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/contexts/BottomBarInstanceContext.tsx
deleted file mode 100644
index e2b29e54cfc..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/contexts/BottomBarInstanceContext.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-import { createComponentInstanceContext } from '@/ui/utilities/state/component-state/utils/createComponentInstanceContext';
-
-export const BottomBarInstanceContext = createComponentInstanceContext();
diff --git a/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState.ts b/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState.ts
deleted file mode 100644
index 071ad8de53c..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { BottomBarInstanceContext } from '@/ui/layout/bottom-bar/states/contexts/BottomBarInstanceContext';
-import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
-
-export const isBottomBarOpenedComponentState = createComponentStateV2<boolean>({
- key: 'isBottomBarOpenedComponentState',
- defaultValue: false,
- componentInstanceContext: BottomBarInstanceContext,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderOpenCommandMenuButton.tsx b/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderOpenCommandMenuButton.tsx
index 65e5f37d360..bc3601abafa 100644
--- a/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderOpenCommandMenuButton.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderOpenCommandMenuButton.tsx
@@ -1,21 +1,12 @@
-import {
- AnimatedButton,
- IconButton,
- IconDotsVertical,
- IconX,
- getOsControlSymbol,
- useIsMobile,
-} from 'twenty-ui';
+import { AnimatedButton, getOsControlSymbol, useIsMobile } from 'twenty-ui';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { t } from '@lingui/core/macro';
import { motion } from 'framer-motion';
import { useRecoilValue } from 'recoil';
-import { FeatureFlagKey } from '~/generated/graphql';
const StyledButtonWrapper = styled.div`
z-index: 30;
@@ -108,10 +99,6 @@ export const PageHeaderOpenCommandMenuButton = () => {
const { toggleCommandMenu } = useCommandMenu();
const isCommandMenuOpened = useRecoilValue(isCommandMenuOpenedState);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const isMobile = useIsMobile();
const ariaLabel = isCommandMenuOpened
@@ -122,37 +109,24 @@ export const PageHeaderOpenCommandMenuButton = () => {
return (
<StyledButtonWrapper>
- {isCommandMenuV2Enabled ? (
- <AnimatedButton
- animatedSvg={
- <AnimatedIcon isCommandMenuOpened={isCommandMenuOpened} />
- }
- className="page-header-command-menu-button"
- dataTestId="page-header-command-menu-button"
- size={isMobile ? 'medium' : 'small'}
- variant="secondary"
- accent="default"
- hotkeys={[getOsControlSymbol(), 'K']}
- ariaLabel={ariaLabel}
- onClick={toggleCommandMenu}
- animate={{
- rotate: isCommandMenuOpened ? 90 : 0,
- }}
- transition={{
- duration: theme.animation.duration.normal,
- ease: 'easeInOut',
- }}
- />
- ) : (
- <IconButton
- Icon={isCommandMenuOpened ? IconX : IconDotsVertical}
- size="medium"
- dataTestId="more-showpage-button"
- accent="default"
- variant="secondary"
- onClick={toggleCommandMenu}
- />
- )}
+ <AnimatedButton
+ animatedSvg={<AnimatedIcon isCommandMenuOpened={isCommandMenuOpened} />}
+ className="page-header-command-menu-button"
+ dataTestId="page-header-command-menu-button"
+ size={isMobile ? 'medium' : 'small'}
+ variant="secondary"
+ accent="default"
+ hotkeys={[getOsControlSymbol(), 'K']}
+ ariaLabel={ariaLabel}
+ onClick={toggleCommandMenu}
+ animate={{
+ rotate: isCommandMenuOpened ? 90 : 0,
+ }}
+ transition={{
+ duration: theme.animation.duration.normal,
+ ease: 'easeInOut',
+ }}
+ />
</StyledButtonWrapper>
);
};
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/PageAddButton.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/PageAddButton.tsx
index 4a2c96465b7..e86dbec355e 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/PageAddButton.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/PageAddButton.tsx
@@ -1,18 +1,12 @@
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useLingui } from '@lingui/react/macro';
-import { Button, IconButton, IconPlus, useIsMobile } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated/graphql';
+import { Button, IconPlus, useIsMobile } from 'twenty-ui';
type PageAddButtonProps = {
onClick?: () => void;
};
export const PageAddButton = ({ onClick }: PageAddButtonProps) => {
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const hasObjectReadOnlyPermission = useHasObjectReadOnlyPermission();
const isMobile = useIsMobile();
@@ -24,29 +18,15 @@ export const PageAddButton = ({ onClick }: PageAddButtonProps) => {
}
return (
- <>
- {isCommandMenuV2Enabled ? (
- <Button
- Icon={IconPlus}
- dataTestId="add-button"
- size={isMobile ? 'medium' : 'small'}
- variant="secondary"
- accent="default"
- title={isMobile ? '' : t`New record`}
- onClick={onClick}
- ariaLabel={t`New record`}
- />
- ) : (
- <IconButton
- Icon={IconPlus}
- dataTestId="add-button"
- size="medium"
- variant="secondary"
- accent="default"
- ariaLabel={t`Add`}
- onClick={onClick}
- />
- )}
- </>
+ <Button
+ Icon={IconPlus}
+ dataTestId="add-button"
+ size={isMobile ? 'medium' : 'small'}
+ variant="secondary"
+ accent="default"
+ title={isMobile ? '' : t`New record`}
+ onClick={onClick}
+ ariaLabel={t`New record`}
+ />
);
};
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/PageBody.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/PageBody.tsx
index 5b97f13dd2f..45ae01c5f98 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/PageBody.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/PageBody.tsx
@@ -1,9 +1,7 @@
-import { ReactNode } from 'react';
import styled from '@emotion/styled';
+import { ReactNode } from 'react';
import { MOBILE_VIEWPORT } from 'twenty-ui';
-import { RightDrawer } from '@/ui/layout/right-drawer/components/RightDrawer';
-
import { PagePanel } from './PagePanel';
type PageBodyProps = {
@@ -45,6 +43,5 @@ export const PageBody = ({ children }: PageBodyProps) => (
<StyledLeftContainer>
<PagePanel>{children}</PagePanel>
</StyledLeftContainer>
- <RightDrawer />
</StyledMainContainer>
);
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx
index 51d2dc1de9c..69a83ddc873 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx
@@ -3,9 +3,6 @@ import styled from '@emotion/styled';
import { ReactNode } from 'react';
import { useRecoilValue } from 'recoil';
import {
- IconButton,
- IconChevronDown,
- IconChevronUp,
IconComponent,
IconX,
LightIconButton,
@@ -17,8 +14,6 @@ import { NavigationDrawerCollapseButton } from '@/ui/navigation/navigation-drawe
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { FeatureFlagKey } from '~/generated/graphql';
export const PAGE_BAR_MIN_HEIGHT = 40;
@@ -94,11 +89,6 @@ type PageHeaderProps = {
title?: ReactNode;
hasClosePageButton?: boolean;
onClosePage?: () => void;
- hasPaginationButtons?: boolean;
- hasPreviousRecord?: boolean;
- hasNextRecord?: boolean;
- navigateToPreviousRecord?: () => void;
- navigateToNextRecord?: () => void;
Icon?: IconComponent;
children?: ReactNode;
};
@@ -107,9 +97,6 @@ export const PageHeader = ({
title,
hasClosePageButton,
onClosePage,
- hasPaginationButtons,
- navigateToPreviousRecord,
- navigateToNextRecord,
Icon,
children,
}: PageHeaderProps) => {
@@ -119,10 +106,6 @@ export const PageHeader = ({
isNavigationDrawerExpandedState,
);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
return (
<StyledTopBarContainer>
<StyledLeftContainer>
@@ -141,25 +124,11 @@ export const PageHeader = ({
)}
<StyledTopBarIconStyledTitleContainer>
- {!isCommandMenuV2Enabled && hasPaginationButtons && (
- <>
- <IconButton
- Icon={IconChevronUp}
- size="small"
- variant="secondary"
- onClick={() => navigateToPreviousRecord?.()}
- />
- <IconButton
- Icon={IconChevronDown}
- size="small"
- variant="secondary"
- onClick={() => navigateToNextRecord?.()}
- />
- </>
+ {Icon && (
+ <StyledIconContainer>
+ <Icon size={theme.icon.size.md} />
+ </StyledIconContainer>
)}
- <StyledIconContainer>
- {Icon && <Icon size={theme.icon.size.md} />}
- </StyledIconContainer>
{title && (
<StyledTitleContainer data-testid="top-bar-title">
{typeof title === 'string' ? (
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/PageHotkeysEffect.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/PageHotkeysEffect.tsx
deleted file mode 100644
index 6800209d123..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/page/components/PageHotkeysEffect.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { TableHotkeyScope } from '@/object-record/record-table/types/TableHotkeyScope';
-import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
-
-type PageHotkeysEffectProps = {
- onAddButtonClick?: () => void;
-};
-
-export const PageHotkeysEffect = ({
- onAddButtonClick,
-}: PageHotkeysEffectProps) => {
- useScopedHotkeys('c', () => onAddButtonClick?.(), TableHotkeyScope.Table, [
- onAddButtonClick,
- ]);
-
- return <></>;
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawer.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawer.tsx
deleted file mode 100644
index a2498d774a1..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawer.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import { isRightDrawerAnimationCompletedState } from '@/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState';
-import { isRightDrawerMinimizedState } from '@/ui/layout/right-drawer/states/isRightDrawerMinimizedState';
-
-import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
-import { useTheme } from '@emotion/react';
-import styled from '@emotion/styled';
-import { motion } from 'framer-motion';
-import { useRecoilValue, useSetRecoilState } from 'recoil';
-import { isDefined } from 'twenty-shared';
-
-import { isRightDrawerOpenState } from '../states/isRightDrawerOpenState';
-import { rightDrawerPageState } from '../states/rightDrawerPageState';
-
-import { RIGHT_DRAWER_ANIMATION_VARIANTS } from '@/ui/layout/right-drawer/constants/RightDrawerAnimationVariants';
-import { RightDrawerAnimationVariant } from '@/ui/layout/right-drawer/types/RightDrawerAnimationVariant';
-import { RightDrawerRouter } from './RightDrawerRouter';
-
-const StyledContainer = styled(motion.div)<{ isRightDrawerMinimized: boolean }>`
- background: ${({ theme }) => theme.background.primary};
- border-left: ${({ theme, isRightDrawerMinimized }) =>
- isRightDrawerMinimized
- ? `1px solid ${theme.border.color.strong}`
- : `1px solid ${theme.border.color.medium}`};
- border-top: ${({ theme, isRightDrawerMinimized }) =>
- isRightDrawerMinimized ? `1px solid ${theme.border.color.strong}` : 'none'};
- border-top-left-radius: ${({ theme, isRightDrawerMinimized }) =>
- isRightDrawerMinimized ? theme.border.radius.md : '0'};
- box-shadow: ${({ theme, isRightDrawerMinimized }) =>
- isRightDrawerMinimized ? 'none' : theme.boxShadow.light};
- height: 100dvh;
- overflow-x: hidden;
- position: fixed;
-
- right: 0;
- top: 0;
- z-index: 30;
-
- .modal-backdrop {
- background: ${({ theme }) => theme.background.overlayTertiary};
- }
-`;
-
-const StyledRightDrawer = styled.div`
- display: flex;
- flex-direction: row;
- width: 100%;
-`;
-
-export const RightDrawer = () => {
- const theme = useTheme();
-
- const isRightDrawerOpen = useRecoilValue(isRightDrawerOpenState);
-
- const isRightDrawerMinimized = useRecoilValue(isRightDrawerMinimizedState);
-
- const setIsRightDrawerAnimationCompleted = useSetRecoilState(
- isRightDrawerAnimationCompletedState,
- );
-
- const rightDrawerPage = useRecoilValue(rightDrawerPageState);
-
- const isMobile = useIsMobile();
-
- const targetVariantForAnimation: RightDrawerAnimationVariant =
- !isRightDrawerOpen
- ? 'closed'
- : isRightDrawerMinimized
- ? 'minimized'
- : isMobile
- ? 'fullScreen'
- : 'normal';
-
- const handleAnimationComplete = () => {
- setIsRightDrawerAnimationCompleted(isRightDrawerOpen);
- };
-
- if (!isDefined(rightDrawerPage)) {
- return <></>;
- }
-
- return (
- <StyledContainer
- isRightDrawerMinimized={isRightDrawerMinimized}
- animate={targetVariantForAnimation}
- variants={RIGHT_DRAWER_ANIMATION_VARIANTS}
- transition={{ duration: theme.animation.duration.normal }}
- onAnimationComplete={handleAnimationComplete}
- >
- <StyledRightDrawer>
- {isRightDrawerOpen && <RightDrawerRouter />}
- </StyledRightDrawer>
- </StyledContainer>
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerContainer.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerContainer.tsx
deleted file mode 100644
index 01bd2aef12b..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerContainer.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import { RIGHT_DRAWER_CLICK_OUTSIDE_LISTENER_ID } from '@/ui/layout/right-drawer/constants/RightDrawerClickOutsideListener';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { isRightDrawerMinimizedState } from '@/ui/layout/right-drawer/states/isRightDrawerMinimizedState';
-import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
-import { rightDrawerCloseEventState } from '@/ui/layout/right-drawer/states/rightDrawerCloseEventsState';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
-import {
- ClickOutsideMode,
- useListenClickOutside,
-} from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
-import { workflowReactFlowRefState } from '@/workflow/workflow-diagram/states/workflowReactFlowRefState';
-import styled from '@emotion/styled';
-import { useRef } from 'react';
-import { useRecoilCallback, useRecoilValue } from 'recoil';
-import { Key } from 'ts-key-enum';
-
-const StyledRightDrawerPage = styled.div`
- display: flex;
- flex-direction: column;
- height: 100%;
- width: 100%;
-`;
-
-export const RightDrawerContainer = ({
- children,
-}: {
- children: React.ReactNode;
-}) => {
- const rightDrawerRef = useRef<HTMLDivElement>(null);
-
- const isRightDrawerOpen = useRecoilValue(isRightDrawerOpenState);
-
- const isRightDrawerMinimized = useRecoilValue(isRightDrawerMinimizedState);
-
- const { closeRightDrawer } = useRightDrawer();
-
- const workflowReactFlowRef = useRecoilValue(workflowReactFlowRefState);
-
- useListenClickOutside({
- refs: [
- rightDrawerRef,
- ...(workflowReactFlowRef ? [workflowReactFlowRef] : []),
- ],
- excludeClassNames: ['confirmation-modal'],
- listenerId: RIGHT_DRAWER_CLICK_OUTSIDE_LISTENER_ID,
- callback: useRecoilCallback(
- ({ snapshot, set }) =>
- (event) => {
- const isRightDrawerOpen = snapshot
- .getLoadable(isRightDrawerOpenState)
- .getValue();
- const isRightDrawerMinimized = snapshot
- .getLoadable(isRightDrawerMinimizedState)
- .getValue();
-
- if (isRightDrawerOpen && !isRightDrawerMinimized) {
- set(rightDrawerCloseEventState, event);
-
- closeRightDrawer();
- }
- },
- [closeRightDrawer],
- ),
- mode: ClickOutsideMode.comparePixels,
- });
-
- useScopedHotkeys(
- [Key.Escape],
- () => {
- if (isRightDrawerOpen && !isRightDrawerMinimized) {
- closeRightDrawer();
- }
- },
- RightDrawerHotkeyScope.RightDrawer,
- [isRightDrawerOpen, isRightDrawerMinimized],
- );
-
- return (
- <StyledRightDrawerPage ref={rightDrawerRef}>
- {children}
- </StyledRightDrawerPage>
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerRouter.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerRouter.tsx
deleted file mode 100644
index 957c01de055..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerRouter.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import styled from '@emotion/styled';
-import { useRecoilState, useRecoilValue } from 'recoil';
-
-import { RightDrawerCalendarEvent } from '@/activities/calendar/right-drawer/components/RightDrawerCalendarEvent';
-import { RightDrawerAIChat } from '@/activities/copilot/right-drawer/components/RightDrawerAIChat';
-import { RightDrawerEmailThread } from '@/activities/emails/right-drawer/components/RightDrawerEmailThread';
-import { RightDrawerRecord } from '@/object-record/record-right-drawer/components/RightDrawerRecord';
-import { isRightDrawerMinimizedState } from '@/ui/layout/right-drawer/states/isRightDrawerMinimizedState';
-
-import { RightDrawerContainer } from '@/ui/layout/right-drawer/components/RightDrawerContainer';
-import { RightDrawerTopBar } from '@/ui/layout/right-drawer/components/RightDrawerTopBar';
-import { RightDrawerWorkflowEditStep } from '@/workflow/workflow-steps/components/RightDrawerWorkflowEditStep';
-import { RightDrawerWorkflowRunViewStep } from '@/workflow/workflow-steps/components/RightDrawerWorkflowRunViewStep';
-import { RightDrawerWorkflowViewStep } from '@/workflow/workflow-steps/components/RightDrawerWorkflowViewStep';
-import { RightDrawerWorkflowSelectAction } from '@/workflow/workflow-steps/workflow-actions/components/RightDrawerWorkflowSelectAction';
-import { RightDrawerWorkflowSelectTriggerType } from '@/workflow/workflow-trigger/components/RightDrawerWorkflowSelectTriggerType';
-import { isDefined } from 'twenty-shared';
-import { rightDrawerPageState } from '../states/rightDrawerPageState';
-import { RightDrawerPages } from '../types/RightDrawerPages';
-
-const StyledRightDrawerBody = styled.div`
- display: flex;
- flex-direction: column;
- height: calc(
- 100vh - ${({ theme }) => theme.spacing(14)} - 1px
- ); // (-1 for border)
- //overflow: auto;
- position: relative;
-`;
-
-const RIGHT_DRAWER_PAGES_CONFIG = {
- [RightDrawerPages.ViewEmailThread]: <RightDrawerEmailThread />,
- [RightDrawerPages.ViewCalendarEvent]: <RightDrawerCalendarEvent />,
- [RightDrawerPages.ViewRecord]: <RightDrawerRecord />,
- [RightDrawerPages.Copilot]: <RightDrawerAIChat />,
- [RightDrawerPages.WorkflowStepSelectTriggerType]: (
- <RightDrawerWorkflowSelectTriggerType />
- ),
- [RightDrawerPages.WorkflowStepSelectAction]: (
- <RightDrawerWorkflowSelectAction />
- ),
- [RightDrawerPages.WorkflowStepEdit]: <RightDrawerWorkflowEditStep />,
- [RightDrawerPages.WorkflowStepView]: <RightDrawerWorkflowViewStep />,
- [RightDrawerPages.WorkflowRunStepView]: <RightDrawerWorkflowRunViewStep />,
-} satisfies Record<RightDrawerPages, JSX.Element>;
-
-export const RightDrawerRouter = () => {
- const [rightDrawerPage] = useRecoilState(rightDrawerPageState);
-
- const rightDrawerPageComponent = isDefined(rightDrawerPage) ? (
- RIGHT_DRAWER_PAGES_CONFIG[rightDrawerPage]
- ) : (
- <></>
- );
-
- const isRightDrawerMinimized = useRecoilValue(isRightDrawerMinimizedState);
-
- return (
- <RightDrawerContainer>
- <RightDrawerTopBar />
- {!isRightDrawerMinimized && (
- <StyledRightDrawerBody>
- {rightDrawerPageComponent}
- </StyledRightDrawerBody>
- )}
- </RightDrawerContainer>
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBar.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBar.tsx
deleted file mode 100644
index 6f0d0711364..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBar.tsx
+++ /dev/null
@@ -1,140 +0,0 @@
-import { useTheme } from '@emotion/react';
-import styled from '@emotion/styled';
-import { useRecoilState, useRecoilValue } from 'recoil';
-import { Chip, ChipAccent, ChipSize, useIcons } from 'twenty-ui';
-
-import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
-import { getBasePathToShowPage } from '@/object-metadata/utils/getBasePathToShowPage';
-import { isNewViewableRecordLoadingState } from '@/object-record/record-right-drawer/states/isNewViewableRecordLoading';
-import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
-import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState';
-import { RightDrawerTopBarCloseButton } from '@/ui/layout/right-drawer/components/RightDrawerTopBarCloseButton';
-import { RightDrawerTopBarExpandButton } from '@/ui/layout/right-drawer/components/RightDrawerTopBarExpandButton';
-import { RightDrawerTopBarMinimizeButton } from '@/ui/layout/right-drawer/components/RightDrawerTopBarMinimizeButton';
-import { StyledRightDrawerTopBar } from '@/ui/layout/right-drawer/components/StyledRightDrawerTopBar';
-import { RIGHT_DRAWER_PAGE_ICONS } from '@/ui/layout/right-drawer/constants/RightDrawerPageIcons';
-import { RIGHT_DRAWER_PAGE_TITLES } from '@/ui/layout/right-drawer/constants/RightDrawerPageTitles';
-import { isRightDrawerMinimizedState } from '@/ui/layout/right-drawer/states/isRightDrawerMinimizedState';
-import { rightDrawerPageState } from '@/ui/layout/right-drawer/states/rightDrawerPageState';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
-
-const StyledTopBarWrapper = styled.div`
- align-items: center;
- display: flex;
-`;
-
-const StyledMinimizeTopBarTitleContainer = styled.div`
- align-items: center;
- display: flex;
- gap: ${({ theme }) => theme.spacing(1)};
- height: 24px;
- width: 168px;
-`;
-
-const StyledMinimizeTopBarTitle = styled.div`
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-`;
-
-const StyledMinimizeTopBarIcon = styled.div`
- align-items: center;
- display: flex;
-`;
-
-export const RightDrawerTopBar = () => {
- const isMobile = useIsMobile();
-
- const rightDrawerPage = useRecoilValue(rightDrawerPageState);
-
- const [isRightDrawerMinimized, setIsRightDrawerMinimized] = useRecoilState(
- isRightDrawerMinimizedState,
- );
-
- const theme = useTheme();
-
- const handleOnclick = () => {
- if (isRightDrawerMinimized) {
- setIsRightDrawerMinimized(false);
- }
- };
-
- const { getIcon } = useIcons();
-
- const viewableRecordNameSingular = useRecoilValue(
- viewableRecordNameSingularState,
- );
-
- const isNewViewableRecordLoading = useRecoilValue(
- isNewViewableRecordLoadingState,
- );
-
- const viewableRecordId = useRecoilValue(viewableRecordIdState);
-
- const { objectMetadataItem } = useObjectMetadataItem({
- objectNameSingular: viewableRecordNameSingular ?? 'company',
- });
-
- if (!rightDrawerPage) {
- return null;
- }
-
- const PageIcon = getIcon(RIGHT_DRAWER_PAGE_ICONS[rightDrawerPage]);
-
- const ObjectIcon = getIcon(objectMetadataItem.icon);
-
- const isViewRecordRightDrawerPage =
- rightDrawerPage === RightDrawerPages.ViewRecord;
-
- const label = isViewRecordRightDrawerPage
- ? objectMetadataItem.labelSingular
- : RIGHT_DRAWER_PAGE_TITLES[rightDrawerPage];
-
- const Icon = isViewRecordRightDrawerPage ? ObjectIcon : PageIcon;
-
- return (
- <StyledRightDrawerTopBar
- onClick={handleOnclick}
- isRightDrawerMinimized={isRightDrawerMinimized}
- >
- {!isRightDrawerMinimized && (
- <Chip
- disabled={isNewViewableRecordLoading}
- label={label}
- leftComponent={() => <Icon size={theme.icon.size.md} />}
- size={ChipSize.Large}
- accent={ChipAccent.TextSecondary}
- clickable={false}
- />
- )}
- {isRightDrawerMinimized && (
- <StyledMinimizeTopBarTitleContainer>
- <StyledMinimizeTopBarIcon>
- <Icon size={theme.icon.size.md} />
- </StyledMinimizeTopBarIcon>
- <StyledMinimizeTopBarTitle>{label}</StyledMinimizeTopBarTitle>
- </StyledMinimizeTopBarTitleContainer>
- )}
- <StyledTopBarWrapper>
- {!isMobile && !isRightDrawerMinimized && (
- <RightDrawerTopBarMinimizeButton />
- )}
-
- {!isMobile &&
- !isRightDrawerMinimized &&
- isViewRecordRightDrawerPage && (
- <RightDrawerTopBarExpandButton
- to={
- getBasePathToShowPage({
- objectNameSingular: viewableRecordNameSingular ?? '',
- }) + viewableRecordId
- }
- />
- )}
-
- <RightDrawerTopBarCloseButton />
- </StyledTopBarWrapper>
- </StyledRightDrawerTopBar>
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarCloseButton.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarCloseButton.tsx
deleted file mode 100644
index 68bc57c0af0..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarCloseButton.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { IconX, LightIconButton } from 'twenty-ui';
-
-import { useRightDrawer } from '../hooks/useRightDrawer';
-
-export const RightDrawerTopBarCloseButton = () => {
- const { closeRightDrawer } = useRightDrawer();
-
- const handleButtonClick = () => {
- closeRightDrawer();
- };
-
- return (
- <LightIconButton
- Icon={IconX}
- onClick={handleButtonClick}
- size="medium"
- accent="tertiary"
- />
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarExpandButton.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarExpandButton.tsx
deleted file mode 100644
index 847f3314373..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarExpandButton.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { IconExternalLink, LightIconButton, UndecoratedLink } from 'twenty-ui';
-
-export const RightDrawerTopBarExpandButton = ({ to }: { to: string }) => {
- const { closeRightDrawer } = useRightDrawer();
-
- return (
- <UndecoratedLink to={to}>
- <LightIconButton
- size="medium"
- accent="tertiary"
- Icon={IconExternalLink}
- onClick={() => closeRightDrawer()}
- />
- </UndecoratedLink>
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarMinimizeButton.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarMinimizeButton.tsx
deleted file mode 100644
index 8f5635ec020..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBarMinimizeButton.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { IconMinus, LightIconButton } from 'twenty-ui';
-
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-
-export const RightDrawerTopBarMinimizeButton = () => {
- const { isRightDrawerMinimized, minimizeRightDrawer, maximizeRightDrawer } =
- useRightDrawer();
-
- const handleButtonClick = () => {
- isRightDrawerMinimized ? maximizeRightDrawer() : minimizeRightDrawer();
- };
-
- return (
- <LightIconButton
- Icon={IconMinus}
- onClick={handleButtonClick}
- size="medium"
- accent="tertiary"
- />
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/StyledRightDrawerTopBar.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/StyledRightDrawerTopBar.tsx
deleted file mode 100644
index 3378e36ddca..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/StyledRightDrawerTopBar.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import styled from '@emotion/styled';
-
-export const StyledRightDrawerTopBar = styled.div<{
- isRightDrawerMinimized: boolean;
-}>`
- align-items: center;
- background: ${({ theme }) => theme.background.secondary};
- border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
- color: ${({ theme }) => theme.font.color.secondary};
- display: flex;
- flex-direction: row;
- font-size: ${({ theme }) => theme.font.size.md};
- gap: ${({ theme }) => theme.spacing(1)};
- height: ${({ isRightDrawerMinimized }) =>
- isRightDrawerMinimized ? '40px' : '56px'};
- justify-content: space-between;
- padding-left: ${({ theme }) => theme.spacing(2)};
-
- padding-right: ${({ theme }) => theme.spacing(2)};
- cursor: ${({ isRightDrawerMinimized }) =>
- isRightDrawerMinimized ? 'pointer' : 'default'};
-`;
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/__stories__/RightDrawerTopBar.stories.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/components/__stories__/RightDrawerTopBar.stories.tsx
deleted file mode 100644
index 16f53f1a213..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/components/__stories__/RightDrawerTopBar.stories.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { expect } from '@storybook/jest';
-import { Meta, StoryObj } from '@storybook/react';
-
-import { RightDrawerTopBar } from '../RightDrawerTopBar';
-import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
-import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
-import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
-import { useSetRecoilState } from 'recoil';
-import { rightDrawerPageState } from '@/ui/layout/right-drawer/states/rightDrawerPageState';
-import { isRightDrawerMinimizedState } from '@/ui/layout/right-drawer/states/isRightDrawerMinimizedState';
-import { useEffect } from 'react';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';
-import { within } from '@storybook/test';
-
-const RightDrawerTopBarStateSetterEffect = () => {
- const setRightDrawerPage = useSetRecoilState(rightDrawerPageState);
-
- const setIsRightDrawerMinimizedState = useSetRecoilState(
- isRightDrawerMinimizedState,
- );
-
- useEffect(() => {
- setRightDrawerPage(RightDrawerPages.ViewRecord);
- setIsRightDrawerMinimizedState(false);
- }, [setIsRightDrawerMinimizedState, setRightDrawerPage]);
- return null;
-};
-
-const meta: Meta<typeof RightDrawerTopBar> = {
- title: 'Modules/Activities/RightDrawer/RightDrawerTopBar',
- component: RightDrawerTopBar,
- decorators: [
- (Story) => (
- <div style={{ width: '500px' }}>
- <Story />
- <RightDrawerTopBarStateSetterEffect />
- </div>
- ),
- IconsProviderDecorator,
- ComponentWithRouterDecorator,
- ObjectMetadataItemsDecorator,
- SnackBarDecorator,
- ],
-};
-
-export default meta;
-type Story = StoryObj<typeof RightDrawerTopBar>;
-
-export const Default: Story = {
- play: async () => {
- const canvas = within(document.body);
-
- expect(await canvas.findByText('Company')).toBeInTheDocument();
- },
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerAnimationVariants.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerAnimationVariants.ts
deleted file mode 100644
index 710f38f686e..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerAnimationVariants.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { THEME_COMMON } from 'twenty-ui';
-
-export const RIGHT_DRAWER_ANIMATION_VARIANTS = {
- fullScreen: {
- x: '0%',
- width: '100%',
- height: '100%',
- bottom: '0',
- top: '0',
- },
- normal: {
- x: '0%',
- width: THEME_COMMON.rightDrawerWidth,
- height: '100%',
- bottom: '0',
- top: '0',
- },
- closed: {
- x: '100%',
- width: '0',
- height: '100%',
- bottom: '0',
- top: 'auto',
- },
- minimized: {
- x: '0%',
- width: 220,
- height: 41,
- bottom: '0',
- top: 'auto',
- },
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerClickOutsideListener.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerClickOutsideListener.ts
deleted file mode 100644
index 79ab542b238..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerClickOutsideListener.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export const RIGHT_DRAWER_CLICK_OUTSIDE_LISTENER_ID =
- 'right-drawer-click-outside-listener';
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerPageIcons.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerPageIcons.ts
deleted file mode 100644
index 51fcc526425..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerPageIcons.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-
-export const RIGHT_DRAWER_PAGE_ICONS = {
- [RightDrawerPages.ViewEmailThread]: 'IconMail',
- [RightDrawerPages.ViewCalendarEvent]: 'IconCalendarEvent',
- [RightDrawerPages.ViewRecord]: 'Icon123',
- [RightDrawerPages.Copilot]: 'IconSparkles',
- [RightDrawerPages.WorkflowStepSelectTriggerType]: 'IconSparkles',
- [RightDrawerPages.WorkflowStepSelectAction]: 'IconSparkles',
- [RightDrawerPages.WorkflowStepEdit]: 'IconSparkles',
- [RightDrawerPages.WorkflowStepView]: 'IconSparkles',
- [RightDrawerPages.WorkflowRunStepView]: 'IconSparkles',
-} satisfies Record<RightDrawerPages, string>;
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerPageTitles.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerPageTitles.ts
deleted file mode 100644
index fb918821b0d..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/constants/RightDrawerPageTitles.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-
-export const RIGHT_DRAWER_PAGE_TITLES = {
- [RightDrawerPages.ViewEmailThread]: 'Email Thread',
- [RightDrawerPages.ViewCalendarEvent]: 'Calendar Event',
- [RightDrawerPages.ViewRecord]: 'Record Editor',
- [RightDrawerPages.Copilot]: 'Copilot',
- [RightDrawerPages.WorkflowStepSelectTriggerType]: 'Workflow',
- [RightDrawerPages.WorkflowStepSelectAction]: 'Workflow',
- [RightDrawerPages.WorkflowStepEdit]: 'Workflow',
- [RightDrawerPages.WorkflowStepView]: 'Workflow',
- [RightDrawerPages.WorkflowRunStepView]: 'Workflow',
-} satisfies Record<RightDrawerPages, string>;
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/__tests__/useRightDrawer.test.tsx b/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/__tests__/useRightDrawer.test.tsx
deleted file mode 100644
index a7b678c6a41..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/__tests__/useRightDrawer.test.tsx
+++ /dev/null
@@ -1,52 +0,0 @@
-import { renderHook } from '@testing-library/react';
-import { act } from 'react-dom/test-utils';
-import { RecoilRoot, useRecoilValue } from 'recoil';
-
-import { IconList } from 'twenty-ui';
-import { isRightDrawerOpenState } from '../../states/isRightDrawerOpenState';
-import { rightDrawerPageState } from '../../states/rightDrawerPageState';
-import { RightDrawerPages } from '../../types/RightDrawerPages';
-import { useRightDrawer } from '../useRightDrawer';
-
-describe('useRightDrawer', () => {
- it('Should test the default behavior of useRightDrawer and change the states as the function calls', async () => {
- const useCombinedHooks = () => {
- const { openRightDrawer, closeRightDrawer } = useRightDrawer();
- const isRightDrawerOpen = useRecoilValue(isRightDrawerOpenState);
-
- const rightDrawerPage = useRecoilValue(rightDrawerPageState);
-
- return {
- openRightDrawer,
- closeRightDrawer,
- isRightDrawerOpen,
- rightDrawerPage,
- };
- };
-
- const { result } = renderHook(() => useCombinedHooks(), {
- wrapper: RecoilRoot,
- });
-
- expect(result.current.rightDrawerPage).toBeNull();
- expect(result.current.isRightDrawerOpen).toBeFalsy();
- expect(result.current.openRightDrawer).toBeInstanceOf(Function);
- expect(result.current.closeRightDrawer).toBeInstanceOf(Function);
-
- await act(async () => {
- result.current.openRightDrawer(RightDrawerPages.ViewRecord, {
- title: 'Company',
- Icon: IconList,
- });
- });
-
- expect(result.current.rightDrawerPage).toEqual(RightDrawerPages.ViewRecord);
- expect(result.current.isRightDrawerOpen).toBeTruthy();
-
- await act(async () => {
- result.current.closeRightDrawer();
- });
-
- expect(result.current.isRightDrawerOpen).toBeFalsy();
- });
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useRightDrawer.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useRightDrawer.ts
deleted file mode 100644
index 36b915b7d2d..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/hooks/useRightDrawer.ts
+++ /dev/null
@@ -1,114 +0,0 @@
-import { useRecoilCallback, useRecoilValue } from 'recoil';
-
-import { isRightDrawerMinimizedState } from '@/ui/layout/right-drawer/states/isRightDrawerMinimizedState';
-import { rightDrawerCloseEventState } from '@/ui/layout/right-drawer/states/rightDrawerCloseEventsState';
-
-import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { emitRightDrawerCloseEvent } from '@/ui/layout/right-drawer/utils/emitRightDrawerCloseEvent';
-import { mapRightDrawerPageToCommandMenuPage } from '@/ui/layout/right-drawer/utils/mapRightDrawerPageToCommandMenuPage';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { isDefined } from 'twenty-shared';
-import { IconComponent } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated/graphql';
-import { isRightDrawerOpenState } from '../states/isRightDrawerOpenState';
-import { rightDrawerPageState } from '../states/rightDrawerPageState';
-import { RightDrawerPages } from '../types/RightDrawerPages';
-
-export const useRightDrawer = () => {
- const isRightDrawerOpen = useRecoilValue(isRightDrawerOpenState);
- const isRightDrawerMinimized = useRecoilValue(isRightDrawerMinimizedState);
-
- const rightDrawerPage = useRecoilValue(rightDrawerPageState);
-
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
- const { navigateCommandMenu } = useCommandMenu();
-
- const openRightDrawer = useRecoilCallback(
- ({ set }) =>
- (
- rightDrawerPage: RightDrawerPages,
- commandMenuPageInfo: {
- title: string;
- Icon: IconComponent;
- },
- ) => {
- if (isCommandMenuV2Enabled) {
- const commandMenuPage =
- mapRightDrawerPageToCommandMenuPage(rightDrawerPage);
-
- navigateCommandMenu({
- page: commandMenuPage,
- pageTitle: commandMenuPageInfo.title,
- pageIcon: commandMenuPageInfo.Icon,
- });
-
- return;
- }
-
- set(rightDrawerPageState, rightDrawerPage);
- set(isRightDrawerOpenState, true);
- set(isRightDrawerMinimizedState, false);
- },
- [isCommandMenuV2Enabled, navigateCommandMenu],
- );
-
- const closeRightDrawer = useRecoilCallback(
- ({ set }) =>
- (args?: { emitCloseEvent?: boolean }) => {
- set(isRightDrawerOpenState, false);
- set(isRightDrawerMinimizedState, false);
- if (isDefined(args?.emitCloseEvent) && args?.emitCloseEvent) {
- emitRightDrawerCloseEvent();
- }
- },
- [],
- );
-
- const minimizeRightDrawer = useRecoilCallback(
- ({ set }) =>
- () => {
- set(isRightDrawerOpenState, true);
- set(isRightDrawerMinimizedState, true);
- },
- [],
- );
-
- const maximizeRightDrawer = useRecoilCallback(
- ({ set }) =>
- () => {
- set(isRightDrawerMinimizedState, false);
- set(isRightDrawerOpenState, true);
- },
- [],
- );
-
- const isSameEventThanRightDrawerClose = useRecoilCallback(
- ({ snapshot }) =>
- (event: MouseEvent | TouchEvent) => {
- const rightDrawerCloseEvent = snapshot
- .getLoadable(rightDrawerCloseEventState)
- .getValue();
-
- const isSameEvent =
- rightDrawerCloseEvent?.target === event.target &&
- rightDrawerCloseEvent?.timeStamp === event.timeStamp;
-
- return isSameEvent;
- },
- [],
- );
-
- return {
- rightDrawerPage,
- isRightDrawerOpen,
- isRightDrawerMinimized,
- openRightDrawer,
- closeRightDrawer,
- minimizeRightDrawer,
- maximizeRightDrawer,
- isSameEventThanRightDrawerClose,
- };
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState.ts
deleted file mode 100644
index 61d75e2d5c6..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerAnimationCompletedState.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createState } from '@ui/utilities/state/utils/createState';
-
-export const isRightDrawerAnimationCompletedState = createState<boolean>({
- key: 'isRightDrawerAnimationCompletedState',
- defaultValue: false,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerMinimizedState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerMinimizedState.ts
deleted file mode 100644
index 822f909c022..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerMinimizedState.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createState } from '@ui/utilities/state/utils/createState';
-
-export const isRightDrawerMinimizedState = createState<boolean>({
- key: 'ui/layout/is-right-drawer-minimized',
- defaultValue: false,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerOpenState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerOpenState.ts
deleted file mode 100644
index 0fad6afabfe..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/isRightDrawerOpenState.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createState } from '@ui/utilities/state/utils/createState';
-
-export const isRightDrawerOpenState = createState<boolean>({
- key: 'ui/layout/is-right-drawer-open',
- defaultValue: false,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/messageThreadState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/messageThreadState.ts
deleted file mode 100644
index 77f9cd76a8c..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/messageThreadState.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { createState } from '@ui/utilities/state/utils/createState';
-
-import { MessageThread } from '@/activities/emails/types/MessageThread';
-
-export const messageThreadState = createState<MessageThread | null>({
- key: 'messageThreadState',
- defaultValue: null,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerCloseEventsState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerCloseEventsState.ts
deleted file mode 100644
index 9601f157214..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerCloseEventsState.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createState } from '@ui/utilities/state/utils/createState';
-
-export const rightDrawerCloseEventState = createState<Event | null>({
- key: 'rightDrawerCloseEventState',
- defaultValue: null,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerHeaderDropdownButtonState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerHeaderDropdownButtonState.ts
deleted file mode 100644
index e61330290b1..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerHeaderDropdownButtonState.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { createState } from '@ui/utilities/state/utils/createState';
-
-import { RightDrawerTopBarDropdownButtons } from '@/ui/layout/right-drawer/types/RightDrawerTopBarDropdownButtons';
-
-export const rightDrawerTopBarDropdownButtonState =
- createState<RightDrawerTopBarDropdownButtons | null>({
- key: 'rightDrawerTopBarDropdownButtonState',
- defaultValue: null,
- });
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerPageState.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerPageState.ts
deleted file mode 100644
index 441988db3a5..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/states/rightDrawerPageState.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { createState } from '@ui/utilities/state/utils/createState';
-
-import { RightDrawerPages } from '../types/RightDrawerPages';
-
-export const rightDrawerPageState = createState<RightDrawerPages | null>({
- key: 'ui/layout/right-drawer-page',
- defaultValue: null,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerAnimationVariant.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerAnimationVariant.ts
deleted file mode 100644
index bbe1358248a..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerAnimationVariant.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import { RIGHT_DRAWER_ANIMATION_VARIANTS } from '@/ui/layout/right-drawer/constants/RightDrawerAnimationVariants';
-
-export type RightDrawerAnimationVariant =
- keyof typeof RIGHT_DRAWER_ANIMATION_VARIANTS;
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerHotkeyScope.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerHotkeyScope.ts
deleted file mode 100644
index f062a36e0e9..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerHotkeyScope.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum RightDrawerHotkeyScope {
- RightDrawer = 'right-drawer',
-}
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerPages.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerPages.ts
deleted file mode 100644
index 764b410a8af..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerPages.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export enum RightDrawerPages {
- ViewEmailThread = 'view-email-thread',
- ViewCalendarEvent = 'view-calendar-event',
- ViewRecord = 'view-record',
- Copilot = 'copilot',
- WorkflowStepSelectTriggerType = 'workflow-step-select-trigger-type',
- WorkflowStepSelectAction = 'workflow-step-select-action',
- WorkflowStepView = 'workflow-step-view',
- WorkflowStepEdit = 'workflow-step-edit',
- WorkflowRunStepView = 'workflow-run-step-view',
-}
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerTopBarDropdownButtons.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerTopBarDropdownButtons.ts
deleted file mode 100644
index b76d5b3996d..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/types/RightDrawerTopBarDropdownButtons.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export enum RightDrawerTopBarDropdownButtons {
- EmailThreadSubscribers = 'EmailThreadSubscribers',
-}
diff --git a/packages/twenty-front/src/modules/ui/layout/right-drawer/utils/mapRightDrawerPageToCommandMenuPage.ts b/packages/twenty-front/src/modules/ui/layout/right-drawer/utils/mapRightDrawerPageToCommandMenuPage.ts
deleted file mode 100644
index 8a22d1e25f8..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/right-drawer/utils/mapRightDrawerPageToCommandMenuPage.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { CommandMenuPages } from '@/command-menu/types/CommandMenuPages';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-
-export const mapRightDrawerPageToCommandMenuPage = (
- rightDrawerPage: RightDrawerPages,
-) => {
- const rightDrawerPagesToCommandMenuPages: Record<
- RightDrawerPages,
- CommandMenuPages
- > = {
- [RightDrawerPages.ViewRecord]: CommandMenuPages.ViewRecord,
- [RightDrawerPages.ViewEmailThread]: CommandMenuPages.ViewEmailThread,
- [RightDrawerPages.ViewCalendarEvent]: CommandMenuPages.ViewCalendarEvent,
- [RightDrawerPages.Copilot]: CommandMenuPages.Copilot,
- [RightDrawerPages.WorkflowStepSelectTriggerType]:
- CommandMenuPages.WorkflowStepSelectTriggerType,
- [RightDrawerPages.WorkflowStepSelectAction]:
- CommandMenuPages.WorkflowStepSelectAction,
- [RightDrawerPages.WorkflowStepView]: CommandMenuPages.WorkflowStepView,
- [RightDrawerPages.WorkflowRunStepView]:
- CommandMenuPages.WorkflowRunStepView,
- [RightDrawerPages.WorkflowStepEdit]: CommandMenuPages.WorkflowStepEdit,
- };
-
- return (
- rightDrawerPagesToCommandMenuPages[rightDrawerPage] ?? CommandMenuPages.Root
- );
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageAddButton.tsx b/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageAddButton.tsx
index 558c76713f8..69f292e5c04 100644
--- a/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageAddButton.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageAddButton.tsx
@@ -1,12 +1,5 @@
import styled from '@emotion/styled';
-import {
- Button,
- IconButton,
- IconCheckbox,
- IconNotes,
- IconPlus,
- MenuItem,
-} from 'twenty-ui';
+import { Button, IconCheckbox, IconNotes, IconPlus, MenuItem } from 'twenty-ui';
import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateActivityDrawer';
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';
@@ -18,8 +11,6 @@ import { SHOW_PAGE_ADD_BUTTON_DROPDOWN_ID } from '@/ui/layout/show-page/constant
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { isWorkflowSubObjectMetadata } from '@/object-metadata/utils/isWorkflowSubObjectMetadata';
import { useHasObjectReadOnlyPermission } from '@/settings/roles/hooks/useHasObjectReadOnlyPermission';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { FeatureFlagKey } from '~/generated/graphql';
import { Dropdown } from '../../dropdown/components/Dropdown';
const StyledContainer = styled.div`
@@ -56,10 +47,6 @@ export const ShowPageAddButton = ({
closeDropdown();
};
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
if (
activityTargetObject.targetObjectNameSingular ===
CoreObjectNameSingular.Task ||
@@ -79,25 +66,15 @@ export const ShowPageAddButton = ({
<Dropdown
dropdownId={SHOW_PAGE_ADD_BUTTON_DROPDOWN_ID}
clickableComponent={
- isCommandMenuV2Enabled ? (
- <Button
- Icon={IconPlus}
- dataTestId="add-button"
- size="small"
- variant="secondary"
- accent="default"
- title="New note/task"
- ariaLabel="New note/task"
- />
- ) : (
- <IconButton
- Icon={IconPlus}
- size="medium"
- dataTestId="add-showpage-button"
- accent="default"
- variant="secondary"
- />
- )
+ <Button
+ Icon={IconPlus}
+ dataTestId="add-button"
+ size="small"
+ variant="secondary"
+ accent="default"
+ title="New note/task"
+ ariaLabel="New note/task"
+ />
}
dropdownComponents={
<DropdownMenuItemsContainer>
diff --git a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx
deleted file mode 100644
index 4e2be00705c..00000000000
--- a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx
+++ /dev/null
@@ -1,133 +0,0 @@
-import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
-import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
-import { useActivateWorkflowVersion } from '@/workflow/hooks/useActivateWorkflowVersion';
-import { useDeactivateWorkflowVersion } from '@/workflow/hooks/useDeactivateWorkflowVersion';
-import { useDeleteOneWorkflowVersion } from '@/workflow/hooks/useDeleteOneWorkflowVersion';
-import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
-import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
-import { useTheme } from '@emotion/react';
-import { useLingui } from '@lingui/react/macro';
-
-import { isDefined } from 'twenty-shared';
-import {
- Button,
- IconPlayerPlay,
- IconPlayerStop,
- IconPower,
- IconSettingsAutomation,
- IconTrash,
-} from 'twenty-ui';
-import { assertWorkflowWithCurrentVersionIsDefined } from '../utils/assertWorkflowWithCurrentVersionIsDefined';
-
-export const RecordShowPageWorkflowHeader = ({
- workflowId,
-}: {
- workflowId: string;
-}) => {
- const { t } = useLingui();
- const workflowWithCurrentVersion = useWorkflowWithCurrentVersion(workflowId);
-
- const isWaitingForWorkflowWithCurrentVersion =
- !isDefined(workflowWithCurrentVersion) ||
- !isDefined(workflowWithCurrentVersion.currentVersion);
-
- const { activateWorkflowVersion } = useActivateWorkflowVersion();
- const { deactivateWorkflowVersion } = useDeactivateWorkflowVersion();
- const { deleteOneWorkflowVersion } = useDeleteOneWorkflowVersion();
- const { runWorkflowVersion } = useRunWorkflowVersion();
-
- const { enqueueSnackBar } = useSnackBar();
- const theme = useTheme();
-
- const trigger = workflowWithCurrentVersion?.currentVersion.trigger;
-
- const canWorkflowBeTested =
- trigger?.type === 'MANUAL' && !trigger.settings.objectType;
-
- return (
- <>
- <Button
- title={t`Test`}
- variant="secondary"
- Icon={IconPlayerPlay}
- disabled={isWaitingForWorkflowWithCurrentVersion}
- onClick={async () => {
- assertWorkflowWithCurrentVersionIsDefined(workflowWithCurrentVersion);
-
- if (!canWorkflowBeTested) {
- enqueueSnackBar(t`Workflow cannot be tested`, {
- variant: SnackBarVariant.Error,
- detailedMessage: t`Trigger type should be Manual - when no record(s) are selected`,
- icon: (
- <IconSettingsAutomation
- size={16}
- color={theme.snackBar.error.color}
- />
- ),
- });
- return;
- }
-
- await runWorkflowVersion({
- workflowVersionId: workflowWithCurrentVersion.currentVersion.id,
- });
- }}
- />
-
- {workflowWithCurrentVersion?.currentVersion?.status === 'DRAFT' &&
- workflowWithCurrentVersion.versions?.length > 1 ? (
- <Button
- title={t`Discard Draft`}
- variant="secondary"
- Icon={IconTrash}
- disabled={isWaitingForWorkflowWithCurrentVersion}
- onClick={() => {
- assertWorkflowWithCurrentVersionIsDefined(
- workflowWithCurrentVersion,
- );
-
- return deleteOneWorkflowVersion({
- workflowVersionId: workflowWithCurrentVersion.currentVersion.id,
- });
- }}
- />
- ) : null}
-
- {workflowWithCurrentVersion?.currentVersion?.status === 'DRAFT' ||
- workflowWithCurrentVersion?.currentVersion?.status === 'DEACTIVATED' ? (
- <Button
- title={t`Activate`}
- variant="secondary"
- Icon={IconPower}
- disabled={isWaitingForWorkflowWithCurrentVersion}
- onClick={() => {
- assertWorkflowWithCurrentVersionIsDefined(
- workflowWithCurrentVersion,
- );
-
- return activateWorkflowVersion({
- workflowVersionId: workflowWithCurrentVersion.currentVersion.id,
- workflowId: workflowWithCurrentVersion.id,
- });
- }}
- />
- ) : workflowWithCurrentVersion?.currentVersion?.status === 'ACTIVE' ? (
- <Button
- title={t`Deactivate`}
- variant="secondary"
- Icon={IconPlayerStop}
- disabled={isWaitingForWorkflowWithCurrentVersion}
- onClick={() => {
- assertWorkflowWithCurrentVersionIsDefined(
- workflowWithCurrentVersion,
- );
-
- return deactivateWorkflowVersion({
- workflowVersionId: workflowWithCurrentVersion.currentVersion.id,
- });
- }}
- />
- ) : null}
- </>
- );
-};
diff --git a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx b/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx
deleted file mode 100644
index f4b9e74ac88..00000000000
--- a/packages/twenty-front/src/modules/workflow/components/RecordShowPageWorkflowVersionHeader.tsx
+++ /dev/null
@@ -1,144 +0,0 @@
-import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
-import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
-import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
-import { AppPath } from '@/types/AppPath';
-import { OverrideWorkflowDraftConfirmationModal } from '@/workflow/components/OverrideWorkflowDraftConfirmationModal';
-import { useActivateWorkflowVersion } from '@/workflow/hooks/useActivateWorkflowVersion';
-import { useCreateDraftFromWorkflowVersion } from '@/workflow/hooks/useCreateDraftFromWorkflowVersion';
-import { useDeactivateWorkflowVersion } from '@/workflow/hooks/useDeactivateWorkflowVersion';
-import { useWorkflowVersion } from '@/workflow/hooks/useWorkflowVersion';
-import { openOverrideWorkflowDraftConfirmationModalState } from '@/workflow/states/openOverrideWorkflowDraftConfirmationModalState';
-import { Workflow, WorkflowVersion } from '@/workflow/types/Workflow';
-import { useSetRecoilState } from 'recoil';
-import { isDefined } from 'twenty-shared';
-import { Button, IconPencil, IconPlayerStop, IconPower } from 'twenty-ui';
-
-import { useNavigateApp } from '~/hooks/useNavigateApp';
-
-export const RecordShowPageWorkflowVersionHeader = ({
- workflowVersionId,
-}: {
- workflowVersionId: string;
-}) => {
- const workflowVersion = useWorkflowVersion(workflowVersionId);
-
- const workflowVersionRelatedWorkflowQuery = useFindOneRecord<
- Pick<Workflow, '__typename' | 'id' | 'lastPublishedVersionId'>
- >({
- objectNameSingular: CoreObjectNameSingular.Workflow,
- objectRecordId: workflowVersion?.workflowId,
- recordGqlFields: {
- id: true,
- lastPublishedVersionId: true,
- },
- skip: !isDefined(workflowVersion),
- });
-
- // TODO: In the future, use the workflow.status property to determine if there is a draft version
- const {
- records: draftWorkflowVersions,
- loading: loadingDraftWorkflowVersions,
- } = useFindManyRecords<WorkflowVersion>({
- objectNameSingular: CoreObjectNameSingular.WorkflowVersion,
- filter: {
- workflowId: {
- eq: workflowVersion?.workflow.id,
- },
- status: {
- eq: 'DRAFT',
- },
- },
- skip: !isDefined(workflowVersion),
- limit: 1,
- });
- const draftWorkflowVersion: WorkflowVersion | undefined =
- draftWorkflowVersions[0];
-
- const showUseAsDraftButton =
- !loadingDraftWorkflowVersions &&
- isDefined(workflowVersion) &&
- !workflowVersionRelatedWorkflowQuery.loading &&
- isDefined(workflowVersionRelatedWorkflowQuery.record) &&
- workflowVersion.status !== 'DRAFT' &&
- workflowVersion.id !==
- workflowVersionRelatedWorkflowQuery.record.lastPublishedVersionId;
-
- const hasAlreadyDraftVersion =
- !loadingDraftWorkflowVersions && isDefined(draftWorkflowVersion);
-
- const isWaitingForWorkflowVersion = !isDefined(workflowVersion);
-
- const { activateWorkflowVersion } = useActivateWorkflowVersion();
- const { deactivateWorkflowVersion } = useDeactivateWorkflowVersion();
- const { createDraftFromWorkflowVersion } =
- useCreateDraftFromWorkflowVersion();
-
- const setOpenOverrideWorkflowDraftConfirmationModal = useSetRecoilState(
- openOverrideWorkflowDraftConfirmationModalState,
- );
-
- const navigate = useNavigateApp();
-
- return (
- <>
- {showUseAsDraftButton ? (
- <Button
- title={'Use as Draft'}
- variant="secondary"
- Icon={IconPencil}
- disabled={isWaitingForWorkflowVersion}
- onClick={async () => {
- if (hasAlreadyDraftVersion) {
- setOpenOverrideWorkflowDraftConfirmationModal(true);
- } else {
- await createDraftFromWorkflowVersion({
- workflowId: workflowVersion.workflow.id,
- workflowVersionIdToCopy: workflowVersion.id,
- });
-
- navigate(AppPath.RecordShowPage, {
- objectNameSingular: CoreObjectNameSingular.Workflow,
- objectRecordId: workflowVersion.workflow.id,
- });
- }
- }}
- />
- ) : null}
-
- {workflowVersion?.status === 'DRAFT' ||
- workflowVersion?.status === 'DEACTIVATED' ? (
- <Button
- title="Activate"
- variant="secondary"
- Icon={IconPower}
- disabled={isWaitingForWorkflowVersion}
- onClick={() => {
- return activateWorkflowVersion({
- workflowVersionId: workflowVersion.id,
- workflowId: workflowVersion.workflowId,
- });
- }}
- />
- ) : workflowVersion?.status === 'ACTIVE' ? (
- <Button
- title="Deactivate"
- variant="secondary"
- Icon={IconPlayerStop}
- disabled={isWaitingForWorkflowVersion}
- onClick={() => {
- return deactivateWorkflowVersion({
- workflowVersionId: workflowVersion.id,
- });
- }}
- />
- ) : null}
-
- {isDefined(workflowVersion) && isDefined(draftWorkflowVersion) ? (
- <OverrideWorkflowDraftConfirmationModal
- workflowId={workflowVersion.workflowId}
- workflowVersionIdToCopy={workflowVersionId}
- />
- ) : null}
- </>
- );
-};
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 bbb7a8dadee..f0530e90f25 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
@@ -13,8 +13,6 @@ import { getOrganizedDiagram } from '@/workflow/workflow-diagram/utils/getOrgani
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import {
- applyEdgeChanges,
- applyNodeChanges,
Background,
EdgeChange,
EdgeProps,
@@ -22,13 +20,15 @@ import {
NodeChange,
NodeProps,
ReactFlow,
+ applyEdgeChanges,
+ applyNodeChanges,
useReactFlow,
} from '@xyflow/react';
import '@xyflow/react/dist/style.css';
import React, { useEffect, useMemo, useRef } from 'react';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { isDefined } from 'twenty-shared';
-import { Tag, TagColor, THEME_COMMON } from 'twenty-ui';
+import { THEME_COMMON, Tag, TagColor } from 'twenty-ui';
const StyledResetReactflowStyles = styled.div`
height: 100%;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasEditableEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasEditableEffect.tsx
index f7009a93fe2..520b63e0824 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasEditableEffect.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasEditableEffect.tsx
@@ -1,10 +1,10 @@
+import { useCallback, useContext } from 'react';
+import { useRecoilValue, useSetRecoilState } from 'recoil';
+
import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
+
import { workflowIdState } from '@/workflow/states/workflowIdState';
import { EMPTY_TRIGGER_STEP_ID } from '@/workflow/workflow-diagram/constants/EmptyTriggerStepId';
import { useStartNodeCreation } from '@/workflow/workflow-diagram/hooks/useStartNodeCreation';
@@ -16,28 +16,19 @@ import {
} from '@/workflow/workflow-diagram/types/WorkflowDiagram';
import { getWorkflowNodeIconKey } from '@/workflow/workflow-diagram/utils/getWorkflowNodeIconKey';
import { isCreateStepNode } from '@/workflow/workflow-diagram/utils/isCreateStepNode';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { useLingui } from '@lingui/react/macro';
import { OnSelectionChangeParams, useOnSelectionChange } from '@xyflow/react';
-import { useCallback, useContext } from 'react';
-import { useRecoilValue, useSetRecoilState } from 'recoil';
import { isDefined } from 'twenty-shared';
-import { IconBolt, useIcons } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
+import { useIcons } from 'twenty-ui';
export const WorkflowDiagramCanvasEditableEffect = () => {
- const { t } = useLingui();
const { getIcon } = useIcons();
const { startNodeCreation } = useStartNodeCreation();
- const { openRightDrawer, closeRightDrawer } = useRightDrawer();
const {
openWorkflowTriggerTypeInCommandMenu,
openWorkflowEditStepInCommandMenu,
} = useCommandMenu();
- const setHotkeyScope = useSetHotkeyScope();
-
const setWorkflowSelectedNode = useSetRecoilState(workflowSelectedNodeState);
const setCommandMenuNavigationStack = useSetRecoilState(
@@ -48,36 +39,21 @@ export const WorkflowDiagramCanvasEditableEffect = () => {
const workflowId = useRecoilValue(workflowIdState);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const handleSelectionChange = useCallback(
({ nodes }: OnSelectionChangeParams) => {
const selectedNode = nodes[0] as WorkflowDiagramNode;
- const isClosingStep = isDefined(selectedNode) === false;
if (!isInRightDrawer) {
setCommandMenuNavigationStack([]);
}
- if (isClosingStep) {
- closeRightDrawer();
- return;
- }
-
const isEmptyTriggerNode = selectedNode.type === EMPTY_TRIGGER_STEP_ID;
if (isEmptyTriggerNode) {
- if (isCommandMenuV2Enabled && isDefined(workflowId)) {
+ if (isDefined(workflowId)) {
openWorkflowTriggerTypeInCommandMenu(workflowId);
return;
}
- openRightDrawer(RightDrawerPages.WorkflowStepSelectTriggerType, {
- title: t`Trigger Type`,
- Icon: IconBolt,
- });
-
return;
}
@@ -91,7 +67,7 @@ export const WorkflowDiagramCanvasEditableEffect = () => {
setWorkflowSelectedNode(selectedNode.id);
- if (isCommandMenuV2Enabled && isDefined(workflowId)) {
+ if (isDefined(workflowId)) {
openWorkflowEditStepInCommandMenu(
workflowId,
selectedNodeData.name,
@@ -100,27 +76,16 @@ export const WorkflowDiagramCanvasEditableEffect = () => {
return;
}
-
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
- openRightDrawer(RightDrawerPages.WorkflowStepEdit, {
- title: selectedNodeData.name,
- Icon: getIcon(getWorkflowNodeIconKey(selectedNodeData)),
- });
},
[
isInRightDrawer,
- isCommandMenuV2Enabled,
setCommandMenuNavigationStack,
- closeRightDrawer,
workflowId,
- openRightDrawer,
- t,
openWorkflowTriggerTypeInCommandMenu,
startNodeCreation,
openWorkflowEditStepInCommandMenu,
getIcon,
setWorkflowSelectedNode,
- setHotkeyScope,
],
);
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasReadonlyEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasReadonlyEffect.tsx
index 92d5394673d..1bb9ef28c39 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasReadonlyEffect.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasReadonlyEffect.tsx
@@ -1,10 +1,5 @@
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { workflowIdState } from '@/workflow/states/workflowIdState';
-import { EMPTY_TRIGGER_STEP_ID } from '@/workflow/workflow-diagram/constants/EmptyTriggerStepId';
import { useTriggerNodeSelection } from '@/workflow/workflow-diagram/hooks/useTriggerNodeSelection';
import { workflowSelectedNodeState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeState';
import {
@@ -12,64 +7,40 @@ import {
WorkflowDiagramStepNodeData,
} from '@/workflow/workflow-diagram/types/WorkflowDiagram';
import { getWorkflowNodeIconKey } from '@/workflow/workflow-diagram/utils/getWorkflowNodeIconKey';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { OnSelectionChangeParams, useOnSelectionChange } from '@xyflow/react';
import { useCallback } from 'react';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { isDefined } from 'twenty-shared';
import { useIcons } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const WorkflowDiagramCanvasReadonlyEffect = () => {
const { getIcon } = useIcons();
- const { openRightDrawer, closeRightDrawer } = useRightDrawer();
const setWorkflowSelectedNode = useSetRecoilState(workflowSelectedNodeState);
- const setHotkeyScope = useSetHotkeyScope();
const { openWorkflowViewStepInCommandMenu } = useCommandMenu();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
const workflowId = useRecoilValue(workflowIdState);
const handleSelectionChange = useCallback(
({ nodes }: OnSelectionChangeParams) => {
const selectedNode = nodes[0] as WorkflowDiagramNode;
- const isClosingStep = isDefined(selectedNode) === false;
-
- if (isClosingStep || selectedNode.type === EMPTY_TRIGGER_STEP_ID) {
- closeRightDrawer();
- return;
- }
setWorkflowSelectedNode(selectedNode.id);
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
const selectedNodeData = selectedNode.data as WorkflowDiagramStepNodeData;
- if (isCommandMenuV2Enabled && isDefined(workflowId)) {
+ if (isDefined(workflowId)) {
openWorkflowViewStepInCommandMenu(
workflowId,
selectedNodeData.name,
getIcon(getWorkflowNodeIconKey(selectedNodeData)),
);
- return;
}
-
- openRightDrawer(RightDrawerPages.WorkflowStepView, {
- title: selectedNodeData.name,
- Icon: getIcon(getWorkflowNodeIconKey(selectedNodeData)),
- });
},
[
setWorkflowSelectedNode,
- setHotkeyScope,
- isCommandMenuV2Enabled,
- closeRightDrawer,
openWorkflowViewStepInCommandMenu,
workflowId,
getIcon,
- openRightDrawer,
],
);
diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunDiagramCanvasEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunDiagramCanvasEffect.tsx
index 62e471936c0..dc0b45b8f06 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunDiagramCanvasEffect.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunDiagramCanvasEffect.tsx
@@ -1,9 +1,5 @@
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import { useTabListStates } from '@/ui/layout/tab/hooks/internal/useTabListStates';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { getSnapshotValue } from '@/ui/utilities/state/utils/getSnapshotValue';
import { workflowIdState } from '@/workflow/states/workflowIdState';
import { workflowSelectedNodeState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeState';
@@ -15,23 +11,16 @@ import { getWorkflowNodeIconKey } from '@/workflow/workflow-diagram/utils/getWor
import { WORKFLOW_RUN_STEP_SIDE_PANEL_TAB_LIST_COMPONENT_ID } from '@/workflow/workflow-steps/constants/WorkflowRunStepSidePanelTabListComponentId';
import { WorkflowRunTabId } from '@/workflow/workflow-steps/types/WorkflowRunTabId';
import { TRIGGER_STEP_ID } from '@/workflow/workflow-trigger/constants/TriggerStepId';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { OnSelectionChangeParams, useOnSelectionChange } from '@xyflow/react';
import { useCallback } from 'react';
import { useRecoilCallback, useRecoilValue, useSetRecoilState } from 'recoil';
import { isDefined } from 'twenty-shared';
import { useIcons } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const WorkflowRunDiagramCanvasEffect = () => {
const { getIcon } = useIcons();
- const { openRightDrawer, closeRightDrawer } = useRightDrawer();
const setWorkflowSelectedNode = useSetRecoilState(workflowSelectedNodeState);
- const setHotkeyScope = useSetHotkeyScope();
const { openWorkflowViewRunStepInCommandMenu } = useCommandMenu();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
const workflowId = useRecoilValue(workflowIdState);
@@ -61,15 +50,8 @@ export const WorkflowRunDiagramCanvasEffect = () => {
const handleSelectionChange = useCallback(
({ nodes }: OnSelectionChangeParams) => {
const selectedNode = nodes[0] as WorkflowDiagramNode;
- const isClosingStep = isDefined(selectedNode) === false;
-
- if (isClosingStep) {
- closeRightDrawer();
- return;
- }
setWorkflowSelectedNode(selectedNode.id);
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
const selectedNodeData = selectedNode.data as WorkflowDiagramStepNodeData;
@@ -81,29 +63,18 @@ export const WorkflowRunDiagramCanvasEffect = () => {
goBackToFirstWorkflowRunRightDrawerTabIfNeeded();
}
- if (isCommandMenuV2Enabled && isDefined(workflowId)) {
+ if (isDefined(workflowId)) {
openWorkflowViewRunStepInCommandMenu(
workflowId,
selectedNodeData.name,
getIcon(getWorkflowNodeIconKey(selectedNodeData)),
);
-
- return;
}
-
- openRightDrawer(RightDrawerPages.WorkflowRunStepView, {
- title: selectedNodeData.name,
- Icon: getIcon(getWorkflowNodeIconKey(selectedNodeData)),
- });
},
[
setWorkflowSelectedNode,
- setHotkeyScope,
- isCommandMenuV2Enabled,
workflowId,
- openRightDrawer,
getIcon,
- closeRightDrawer,
goBackToFirstWorkflowRunRightDrawerTabIfNeeded,
openWorkflowViewRunStepInCommandMenu,
],
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
index dbf0e3187c2..25b84052659 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts
+++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts
@@ -1,24 +1,12 @@
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
import { CommandMenuAnimationVariant } from '@/command-menu/types/CommandMenuAnimationVariant';
-import { isRightDrawerMinimizedState } from '@/ui/layout/right-drawer/states/isRightDrawerMinimizedState';
-import { isRightDrawerOpenState } from '@/ui/layout/right-drawer/states/isRightDrawerOpenState';
-import { RightDrawerAnimationVariant } from '@/ui/layout/right-drawer/types/RightDrawerAnimationVariant';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useRecoilValue } from 'recoil';
import { useIsMobile } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated/graphql';
export const useRightDrawerState = (): {
- rightDrawerState: RightDrawerAnimationVariant | CommandMenuAnimationVariant;
+ rightDrawerState: CommandMenuAnimationVariant;
} => {
- const isRightDrawerOpen = useRecoilValue(isRightDrawerOpenState);
- const isRightDrawerMinimized = useRecoilValue(isRightDrawerMinimizedState);
const isMobile = useIsMobile();
-
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
const isCommandMenuOpened = useRecoilValue(isCommandMenuOpenedState);
if (isMobile) {
@@ -27,17 +15,7 @@ export const useRightDrawerState = (): {
};
}
- if (isCommandMenuV2Enabled) {
- return {
- rightDrawerState: isCommandMenuOpened ? 'normal' : 'closed',
- };
- }
-
return {
- rightDrawerState: !isRightDrawerOpen
- ? 'closed'
- : isRightDrawerMinimized
- ? 'minimized'
- : 'normal',
+ rightDrawerState: isCommandMenuOpened ? '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 f550e45ad72..55e268bf7c6 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,31 +1,19 @@
+import { useCallback } from 'react';
+import { useRecoilValue, useSetRecoilState } from 'recoil';
+
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDrawerHotkeyScope';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
-import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { workflowIdState } from '@/workflow/states/workflowIdState';
import { workflowCreateStepFromParentStepIdState } from '@/workflow/workflow-steps/states/workflowCreateStepFromParentStepIdState';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { useCallback } from 'react';
-import { useRecoilValue, useSetRecoilState } from 'recoil';
import { isDefined } from 'twenty-shared';
-import { IconSettingsAutomation } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const useStartNodeCreation = () => {
- const { openRightDrawer } = useRightDrawer();
const setWorkflowCreateStepFromParentStepId = useSetRecoilState(
workflowCreateStepFromParentStepIdState,
);
- const setHotkeyScope = useSetHotkeyScope();
const { openWorkflowActionInCommandMenu } = useCommandMenu();
const workflowId = useRecoilValue(workflowIdState);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
/**
* This function is used in a context where dependencies shouldn't change much.
* That's why its wrapped in a `useCallback` hook. Removing memoization might break the app unexpectedly.
@@ -34,24 +22,15 @@ export const useStartNodeCreation = () => {
(parentNodeId: string) => {
setWorkflowCreateStepFromParentStepId(parentNodeId);
- if (isCommandMenuV2Enabled && isDefined(workflowId)) {
+ if (isDefined(workflowId)) {
openWorkflowActionInCommandMenu(workflowId);
return;
}
-
- setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
- openRightDrawer(RightDrawerPages.WorkflowStepSelectAction, {
- title: 'Select Action',
- Icon: IconSettingsAutomation,
- });
},
[
setWorkflowCreateStepFromParentStepId,
- isCommandMenuV2Enabled,
- openWorkflowActionInCommandMenu,
workflowId,
- setHotkeyScope,
- openRightDrawer,
+ openWorkflowActionInCommandMenu,
],
);
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useDeleteStep.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useDeleteStep.test.ts
index 90aa98275fa..5829d2a8e9d 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useDeleteStep.test.ts
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/__tests__/useDeleteStep.test.ts
@@ -3,7 +3,6 @@ import { useDeleteStep } from '@/workflow/workflow-steps/hooks/useDeleteStep';
import { renderHook } from '@testing-library/react';
import { RecoilRoot } from 'recoil';
-const mockCloseRightDrawer = jest.fn();
const mockDeleteWorkflowVersionStep = jest.fn();
const updateOneRecordMock = jest.fn();
const mockCreateDraftFromWorkflowVersion = jest.fn().mockResolvedValue('457');
@@ -14,12 +13,6 @@ jest.mock('@/object-record/hooks/useUpdateOneRecord', () => ({
}),
}));
-jest.mock('@/ui/layout/right-drawer/hooks/useRightDrawer', () => ({
- useRightDrawer: () => ({
- closeRightDrawer: mockCloseRightDrawer,
- }),
-}));
-
jest.mock('@/workflow/hooks/useDeleteWorkflowVersionStep', () => ({
useDeleteWorkflowVersionStep: () => ({
deleteWorkflowVersionStep: mockDeleteWorkflowVersionStep,
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 4fa6adaeae8..1431ef1a0a6 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,7 +1,6 @@
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
import { useDeleteWorkflowVersionStep } from '@/workflow/hooks/useDeleteWorkflowVersionStep';
import { useGetUpdatableWorkflowVersion } from '@/workflow/hooks/useGetUpdatableWorkflowVersion';
import { useStepsOutputSchema } from '@/workflow/hooks/useStepsOutputSchema';
@@ -24,11 +23,9 @@ export const useDeleteStep = ({
const { deleteStepOutputSchema } = useStepsOutputSchema();
const { getUpdatableWorkflowVersion } = useGetUpdatableWorkflowVersion();
- const { closeRightDrawer } = useRightDrawer();
const { closeCommandMenu } = useCommandMenu();
const deleteStep = async (stepId: string) => {
- closeRightDrawer();
closeCommandMenu();
const workflowVersionId = await getUpdatableWorkflowVersion(workflow);
if (stepId === TRIGGER_STEP_ID) {
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionFormServerlessFunction.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionFormServerlessFunction.tsx
index f4dde72e1f6..c94ea35a544 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionFormServerlessFunction.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionFormServerlessFunction.tsx
@@ -16,6 +16,7 @@ import { getFunctionInputFromSourceCode } from '@/serverless-functions/utils/get
import { getFunctionOutputSchema } from '@/serverless-functions/utils/getFunctionOutputSchema';
import { mergeDefaultFunctionInputAndFunctionInput } from '@/serverless-functions/utils/mergeDefaultFunctionInputAndFunctionInput';
import { InputLabel } from '@/ui/input/components/InputLabel';
+import { TextArea } from '@/ui/input/components/TextArea';
import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter';
import { TabList } from '@/ui/layout/tab/components/TabList';
import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
@@ -36,7 +37,6 @@ import { useRecoilState, useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
import { CodeEditor, IconCode, IconPlayerPlay, useIcons } from 'twenty-ui';
import { useDebouncedCallback } from 'use-debounce';
-import { TextArea } from '@/ui/input/components/TextArea';
const StyledContainer = styled.div`
display: flex;
diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/RightDrawerWorkflowSelectTriggerTypeContent.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/RightDrawerWorkflowSelectTriggerTypeContent.tsx
index b8996a11e5c..6e997852697 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/RightDrawerWorkflowSelectTriggerTypeContent.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/RightDrawerWorkflowSelectTriggerTypeContent.tsx
@@ -1,7 +1,5 @@
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems';
-import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
-import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
import {
WorkflowTriggerType,
WorkflowWithCurrentVersion,
@@ -14,10 +12,8 @@ import { OTHER_TRIGGER_TYPES } from '@/workflow/workflow-trigger/constants/Other
import { TRIGGER_STEP_ID } from '@/workflow/workflow-trigger/constants/TriggerStepId';
import { useUpdateWorkflowVersionTrigger } from '@/workflow/workflow-trigger/hooks/useUpdateWorkflowVersionTrigger';
import { getTriggerDefaultDefinition } from '@/workflow/workflow-trigger/utils/getTriggerDefaultDefinition';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { useSetRecoilState } from 'recoil';
import { MenuItemCommand, useIcons } from 'twenty-ui';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const RightDrawerWorkflowSelectTriggerTypeContent = ({
workflow,
@@ -29,12 +25,8 @@ export const RightDrawerWorkflowSelectTriggerTypeContent = ({
const { activeObjectMetadataItems } = useFilteredObjectMetadataItems();
- const { openRightDrawer } = useRightDrawer();
const setWorkflowSelectedNode = useSetRecoilState(workflowSelectedNodeState);
const { openWorkflowEditStepInCommandMenu } = useCommandMenu();
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
const handleTriggerTypeClick = ({
type,
@@ -56,18 +48,11 @@ export const RightDrawerWorkflowSelectTriggerTypeContent = ({
setWorkflowSelectedNode(TRIGGER_STEP_ID);
- if (isCommandMenuV2Enabled) {
- openWorkflowEditStepInCommandMenu(
- workflow.id,
- defaultLabel,
- getIcon(icon),
- );
- } else {
- openRightDrawer(RightDrawerPages.WorkflowStepEdit, {
- title: defaultLabel,
- Icon: getIcon(icon),
- });
- }
+ openWorkflowEditStepInCommandMenu(
+ workflow.id,
+ defaultLabel,
+ getIcon(icon),
+ );
};
};
diff --git a/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx b/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx
index 172a82a9332..47284649b8d 100644
--- a/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx
+++ b/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx
@@ -5,7 +5,6 @@ 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 { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext';
import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext';
import { RecordShowContainer } from '@/object-record/record-show/components/RecordShowContainer';
@@ -16,10 +15,6 @@ import { RecordFieldValueSelectorContextProvider } from '@/object-record/record-
import { PageBody } from '@/ui/layout/page/components/PageBody';
import { PageContainer } from '@/ui/layout/page/components/PageContainer';
import { PageTitle } from '@/ui/utilities/page-title/components/PageTitle';
-import { RecordShowPageWorkflowHeader } from '@/workflow/components/RecordShowPageWorkflowHeader';
-import { RecordShowPageWorkflowVersionHeader } from '@/workflow/components/RecordShowPageWorkflowVersionHeader';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-import { FeatureFlagKey } from '~/generated/graphql';
import { RecordShowPageHeader } from '~/pages/object-record/RecordShowPageHeader';
export const RecordShowPage = () => {
@@ -29,25 +24,17 @@ export const RecordShowPage = () => {
}>();
const {
+ pageTitle,
objectNameSingular,
objectRecordId,
headerIcon,
loading,
- pageTitle,
pageName,
- isFavorite,
- record,
- objectMetadataItem,
- handleFavoriteButtonClick,
} = useRecordShowPage(
parameters.objectNameSingular ?? '',
parameters.objectRecordId ?? '',
);
- const isCommandMenuV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCommandMenuV2Enabled,
- );
-
return (
<RecordFieldValueSelectorContextProvider>
<RecordFilterGroupsComponentInstanceContext.Provider
@@ -73,37 +60,7 @@ export const RecordShowPage = () => {
objectRecordId={objectRecordId}
headerIcon={headerIcon}
>
- <>
- {!isCommandMenuV2Enabled &&
- objectNameSingular ===
- CoreObjectNameSingular.Workflow && (
- <RecordShowPageWorkflowHeader
- workflowId={objectRecordId}
- />
- )}
- {!isCommandMenuV2Enabled &&
- objectNameSingular ===
- CoreObjectNameSingular.WorkflowVersion && (
- <RecordShowPageWorkflowVersionHeader
- workflowVersionId={objectRecordId}
- />
- )}
- {(isCommandMenuV2Enabled ||
- (objectNameSingular !==
- CoreObjectNameSingular.Workflow &&
- objectNameSingular !==
- CoreObjectNameSingular.WorkflowVersion)) && (
- <RecordShowActionMenu
- {...{
- isFavorite,
- record,
- handleFavoriteButtonClick,
- objectMetadataItem,
- objectNameSingular,
- }}
- />
- )}
- </>
+ <RecordShowActionMenu />
</RecordShowPageHeader>
<PageBody>
<TimelineActivityContext.Provider
diff --git a/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx b/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx
index 37549ebc401..88b6d09cfb3 100644
--- a/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx
+++ b/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx
@@ -16,13 +16,8 @@ export const RecordShowPageHeader = ({
headerIcon: React.ComponentType;
children?: React.ReactNode;
}) => {
- const {
- viewName,
- navigateToPreviousRecord,
- navigateToNextRecord,
- navigateToIndexView,
- objectMetadataItem,
- } = useRecordShowPagePagination(objectNameSingular, objectRecordId);
+ const { viewName, navigateToIndexView, objectMetadataItem } =
+ useRecordShowPagePagination(objectNameSingular, objectRecordId);
const { headerIcon } = useRecordShowPage(objectNameSingular, objectRecordId);
@@ -52,11 +47,8 @@ export const RecordShowPageHeader = ({
viewName
)
}
- hasPaginationButtons
hasClosePageButton
onClosePage={navigateToIndexView}
- navigateToPreviousRecord={navigateToPreviousRecord}
- navigateToNextRecord={navigateToNextRecord}
Icon={headerIcon}
>
{children}
diff --git a/packages/twenty-server/src/database/typeorm-seeds/core/feature-flags.ts b/packages/twenty-server/src/database/typeorm-seeds/core/feature-flags.ts
index afdd4ff886d..428d8f068c6 100644
--- a/packages/twenty-server/src/database/typeorm-seeds/core/feature-flags.ts
+++ b/packages/twenty-server/src/database/typeorm-seeds/core/feature-flags.ts
@@ -65,11 +65,6 @@ export const seedFeatureFlags = async (
workspaceId: workspaceId,
value: false,
},
- {
- key: FeatureFlagKey.IsCommandMenuV2Enabled,
- workspaceId: workspaceId,
- value: true,
- },
{
key: FeatureFlagKey.IsNewRelationEnabled,
workspaceId: workspaceId,
diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts
index d2676f6e674..cef1bfdd4da 100644
--- a/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts
+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts
@@ -7,10 +7,7 @@ type FeatureFlagMetadata = {
};
export type PublicFeatureFlag = {
- key: Extract<
- FeatureFlagKey,
- FeatureFlagKey.IsWorkflowEnabled | FeatureFlagKey.IsCommandMenuV2Enabled
- >;
+ key: Extract<FeatureFlagKey, FeatureFlagKey.IsWorkflowEnabled>;
metadata: FeatureFlagMetadata;
};
@@ -23,13 +20,4 @@ export const PUBLIC_FEATURE_FLAGS: PublicFeatureFlag[] = [
imagePath: 'https://twenty.com/images/lab/is-workflow-enabled.png',
},
},
- {
- key: FeatureFlagKey.IsCommandMenuV2Enabled,
- metadata: {
- label: 'Side Panel',
- description:
- 'Click on the 3 dots menu at the top right or press command K to open your new side panel.',
- imagePath: 'https://twenty.com/images/lab/side-panel.png',
- },
- },
];
diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts
index 704bb80a5e7..86d641a3312 100644
--- a/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts
+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts
@@ -8,7 +8,6 @@ export enum FeatureFlagKey {
IsAnalyticsV2Enabled = 'IS_ANALYTICS_V2_ENABLED',
IsUniqueIndexesEnabled = 'IS_UNIQUE_INDEXES_ENABLED',
IsAdvancedFiltersEnabled = 'IS_ADVANCED_FILTERS_ENABLED',
- IsCommandMenuV2Enabled = 'IS_COMMAND_MENU_V2_ENABLED',
IsJsonFilterEnabled = 'IS_JSON_FILTER_ENABLED',
IsCustomDomainEnabled = 'IS_CUSTOM_DOMAIN_ENABLED',
IsApprovedAccessDomainsEnabled = 'IS_APPROVED_ACCESS_DOMAINS_ENABLED',
diff --git a/packages/twenty-website/public/images/lab/side-panel.png b/packages/twenty-website/public/images/lab/side-panel.png
deleted file mode 100644
index 87416c5ce4d..00000000000
Binary files a/packages/twenty-website/public/images/lab/side-panel.png and /dev/null differ