Fix command menu context chip display on show page (#10267)
## New Company ### Before: <img width="500" alt="Capture d’écran 2025-02-17 à 16 47 54" src="https://github.com/user-attachments/assets/4573450d-14b1-41f0-9b86-24003f489fde" /> ### After: <img width="500" alt="Capture d’écran 2025-02-17 à 16 46 24" src="https://github.com/user-attachments/assets/6622bd75-900a-451b-ac21-c98bddeee32d" /> ## Task ### Before: <img width="500" alt="Capture d’écran 2025-02-17 à 16 47 35" src="https://github.com/user-attachments/assets/04b77faa-b628-4839-ab94-95c8570c1818" /> ### After: <img width="501" alt="Capture d’écran 2025-02-17 à 16 47 03" src="https://github.com/user-attachments/assets/1577dea6-7541-497e-af6e-3a4559f1a913" />
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
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';
|
||||
@ -7,7 +8,6 @@ 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 { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { IconList } from 'twenty-ui';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
@ -33,6 +33,8 @@ export const useOpenActivityRightDrawer = ({
|
||||
FeatureFlagKey.IsCommandMenuV2Enabled,
|
||||
);
|
||||
|
||||
const { openRecordInCommandMenu } = useCommandMenu();
|
||||
|
||||
return (activityId: string) => {
|
||||
if (
|
||||
isRightDrawerOpen &&
|
||||
@ -43,16 +45,19 @@ export const useOpenActivityRightDrawer = ({
|
||||
}
|
||||
|
||||
if (isCommandMenuV2Enabled) {
|
||||
setHotkeyScope(AppHotkeyScope.CommandMenuOpen, { goto: false });
|
||||
openRecordInCommandMenu({
|
||||
recordId: activityId,
|
||||
objectNameSingular,
|
||||
isNewRecord: false,
|
||||
});
|
||||
} else {
|
||||
setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
|
||||
setViewableRecordId(activityId);
|
||||
setViewableRecordNameSingular(objectNameSingular);
|
||||
openRightDrawer(RightDrawerPages.ViewRecord, {
|
||||
title: objectNameSingular,
|
||||
Icon: IconList,
|
||||
});
|
||||
}
|
||||
|
||||
setViewableRecordId(activityId);
|
||||
setViewableRecordNameSingular(objectNameSingular);
|
||||
openRightDrawer(RightDrawerPages.ViewRecord, {
|
||||
title: objectNameSingular,
|
||||
Icon: IconList,
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user