-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
7665 handle the select all case inside the action menu (#7742)
Closes #7665 - Handle select all - Handle Filters --------- Co-authored-by: Charles Bochet <[email protected]>
- Loading branch information
1 parent
eaab2d0
commit 40152d3
Showing
52 changed files
with
785 additions
and
424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 10 additions & 21 deletions
31
...t/src/modules/action-menu/actions/record-actions/components/ExportRecordsActionEffect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 11 additions & 14 deletions
25
...src/modules/action-menu/actions/record-actions/components/ManageFavoritesActionEffect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 11 additions & 2 deletions
13
.../action-menu/actions/record-actions/components/MultipleRecordsActionMenuEntriesSetter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 31 additions & 7 deletions
38
...c/modules/action-menu/actions/record-actions/components/RecordActionMenuEntriesSetter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
import { MultipleRecordsActionMenuEntriesSetter } from '@/action-menu/actions/record-actions/components/MultipleRecordsActionMenuEntriesSetter'; | ||
import { SingleRecordActionMenuEntriesSetter } from '@/action-menu/actions/record-actions/components/SingleRecordActionMenuEntriesSetter'; | ||
import { contextStoreTargetedRecordIdsState } from '@/context-store/states/contextStoreTargetedRecordIdsState'; | ||
import { contextStoreCurrentObjectMetadataIdState } from '@/context-store/states/contextStoreCurrentObjectMetadataIdState'; | ||
import { contextStoreNumberOfSelectedRecordsState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsState'; | ||
import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById'; | ||
import { useRecoilValue } from 'recoil'; | ||
|
||
export const RecordActionMenuEntriesSetter = () => { | ||
const contextStoreTargetedRecordIds = useRecoilValue( | ||
contextStoreTargetedRecordIdsState, | ||
const contextStoreNumberOfSelectedRecords = useRecoilValue( | ||
contextStoreNumberOfSelectedRecordsState, | ||
); | ||
|
||
if (contextStoreTargetedRecordIds.length === 0) { | ||
const contextStoreCurrentObjectMetadataId = useRecoilValue( | ||
contextStoreCurrentObjectMetadataIdState, | ||
); | ||
|
||
const { objectMetadataItem } = useObjectMetadataItemById({ | ||
objectId: contextStoreCurrentObjectMetadataId ?? '', | ||
}); | ||
|
||
if (!objectMetadataItem) { | ||
throw new Error( | ||
`Object metadata item not found for id ${contextStoreCurrentObjectMetadataId}`, | ||
); | ||
} | ||
|
||
if (!contextStoreNumberOfSelectedRecords) { | ||
return null; | ||
} | ||
|
||
if (contextStoreTargetedRecordIds.length === 1) { | ||
return <SingleRecordActionMenuEntriesSetter />; | ||
if (contextStoreNumberOfSelectedRecords === 1) { | ||
return ( | ||
<SingleRecordActionMenuEntriesSetter | ||
objectMetadataItem={objectMetadataItem} | ||
/> | ||
); | ||
} | ||
|
||
return <MultipleRecordsActionMenuEntriesSetter />; | ||
return ( | ||
<MultipleRecordsActionMenuEntriesSetter | ||
objectMetadataItem={objectMetadataItem} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/twenty-front/src/modules/action-menu/components/ActionMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { RecordActionMenuEntriesSetter } from '@/action-menu/actions/record-actions/components/RecordActionMenuEntriesSetter'; | ||
import { ActionMenuBar } from '@/action-menu/components/ActionMenuBar'; | ||
import { ActionMenuConfirmationModals } from '@/action-menu/components/ActionMenuConfirmationModals'; | ||
import { ActionMenuDropdown } from '@/action-menu/components/ActionMenuDropdown'; | ||
import { ActionMenuEffect } from '@/action-menu/components/ActionMenuEffect'; | ||
import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; | ||
import { contextStoreCurrentObjectMetadataIdState } from '@/context-store/states/contextStoreCurrentObjectMetadataIdState'; | ||
import { useRecoilValue } from 'recoil'; | ||
|
||
export const ActionMenu = ({ actionMenuId }: { actionMenuId: string }) => { | ||
const contextStoreCurrentObjectMetadataId = useRecoilValue( | ||
contextStoreCurrentObjectMetadataIdState, | ||
); | ||
|
||
return ( | ||
<> | ||
{contextStoreCurrentObjectMetadataId && ( | ||
<ActionMenuComponentInstanceContext.Provider | ||
value={{ instanceId: actionMenuId }} | ||
> | ||
<ActionMenuBar /> | ||
<ActionMenuDropdown /> | ||
<ActionMenuConfirmationModals /> | ||
<ActionMenuEffect /> | ||
<RecordActionMenuEntriesSetter /> | ||
</ActionMenuComponentInstanceContext.Provider> | ||
)} | ||
</> | ||
); | ||
}; |
Oops, something went wrong.