Skip to content

The open alternative to Salesforce, designed for AI.

Make csv export unavailable when only one record is selected (#8409)

Raphaël Bosiaa270950d961
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 2bcc8400d25..7d64ec72c0d 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
@@ -8,14 +8,17 @@ import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMeta
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
-const globalRecordActionEffects = [ExportRecordsActionEffect];
+const noSelectionRecordActionEffects = [ExportRecordsActionEffect];
const singleRecordActionEffects = [
ManageFavoritesActionEffect,
DeleteRecordsActionEffect,
];
-const multipleRecordActionEffects = [DeleteRecordsActionEffect];
+const multipleRecordActionEffects = [
+ ExportRecordsActionEffect,
+ DeleteRecordsActionEffect,
+];
export const RecordActionMenuEntriesSetter = () => {
const contextStoreNumberOfSelectedRecords = useRecoilComponentValueV2(
@@ -39,23 +42,18 @@ export const RecordActionMenuEntriesSetter = () => {
}
const actions =
- contextStoreNumberOfSelectedRecords === 1
- ? singleRecordActionEffects
- : multipleRecordActionEffects;
+ contextStoreNumberOfSelectedRecords === 0
+ ? noSelectionRecordActionEffects
+ : contextStoreNumberOfSelectedRecords === 1
+ ? singleRecordActionEffects
+ : multipleRecordActionEffects;
return (
<>
- {globalRecordActionEffects.map((ActionEffect, index) => (
- <ActionEffect
- key={index}
- position={index}
- objectMetadataItem={objectMetadataItem}
- />
- ))}
{actions.map((ActionEffect, index) => (
<ActionEffect
key={index}
- position={globalRecordActionEffects.length + index}
+ position={index}
objectMetadataItem={objectMetadataItem}
/>
))}