mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-23 12:02:10 +03:00
Make csv export unavailable when only one record is selected (#8409)
Make csv export unavailable when only one record is selected
This commit is contained in:
parent
a7a7d62502
commit
aa270950d9
@ -8,14 +8,17 @@ import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMeta
|
|||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
|
|
||||||
const globalRecordActionEffects = [ExportRecordsActionEffect];
|
const noSelectionRecordActionEffects = [ExportRecordsActionEffect];
|
||||||
|
|
||||||
const singleRecordActionEffects = [
|
const singleRecordActionEffects = [
|
||||||
ManageFavoritesActionEffect,
|
ManageFavoritesActionEffect,
|
||||||
DeleteRecordsActionEffect,
|
DeleteRecordsActionEffect,
|
||||||
];
|
];
|
||||||
|
|
||||||
const multipleRecordActionEffects = [DeleteRecordsActionEffect];
|
const multipleRecordActionEffects = [
|
||||||
|
ExportRecordsActionEffect,
|
||||||
|
DeleteRecordsActionEffect,
|
||||||
|
];
|
||||||
|
|
||||||
export const RecordActionMenuEntriesSetter = () => {
|
export const RecordActionMenuEntriesSetter = () => {
|
||||||
const contextStoreNumberOfSelectedRecords = useRecoilComponentValueV2(
|
const contextStoreNumberOfSelectedRecords = useRecoilComponentValueV2(
|
||||||
@ -39,23 +42,18 @@ export const RecordActionMenuEntriesSetter = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const actions =
|
const actions =
|
||||||
contextStoreNumberOfSelectedRecords === 1
|
contextStoreNumberOfSelectedRecords === 0
|
||||||
? singleRecordActionEffects
|
? noSelectionRecordActionEffects
|
||||||
: multipleRecordActionEffects;
|
: contextStoreNumberOfSelectedRecords === 1
|
||||||
|
? singleRecordActionEffects
|
||||||
|
: multipleRecordActionEffects;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{globalRecordActionEffects.map((ActionEffect, index) => (
|
|
||||||
<ActionEffect
|
|
||||||
key={index}
|
|
||||||
position={index}
|
|
||||||
objectMetadataItem={objectMetadataItem}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
{actions.map((ActionEffect, index) => (
|
{actions.map((ActionEffect, index) => (
|
||||||
<ActionEffect
|
<ActionEffect
|
||||||
key={index}
|
key={index}
|
||||||
position={globalRecordActionEffects.length + index}
|
position={index}
|
||||||
objectMetadataItem={objectMetadataItem}
|
objectMetadataItem={objectMetadataItem}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
Loading…
Reference in New Issue
Block a user