-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
77 create new record action and remove old behavior (#9598)
Closes twentyhq/core-team-issues#77
- Loading branch information
1 parent
765deda
commit 5fb6b18
Showing
16 changed files
with
117 additions
and
36 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
24 changes: 24 additions & 0 deletions
24
...tions/record-actions/no-selection/hooks/useCreateNewTableRecordNoSelectionRecordAction.ts
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,24 @@ | ||
import { ActionHookWithObjectMetadataItem } from '@/action-menu/actions/types/ActionHook'; | ||
import { useCreateNewTableRecord } from '@/object-record/record-table/hooks/useCreateNewTableRecords'; | ||
import { getRecordIndexIdFromObjectNamePlural } from '@/object-record/utils/getRecordIndexIdFromObjectNamePlural'; | ||
|
||
export const useCreateNewTableRecordNoSelectionRecordAction: ActionHookWithObjectMetadataItem = | ||
({ objectMetadataItem }) => { | ||
const recordTableId = getRecordIndexIdFromObjectNamePlural( | ||
objectMetadataItem.namePlural, | ||
); | ||
|
||
const { createNewTableRecord } = useCreateNewTableRecord({ | ||
objectMetadataItem, | ||
recordTableId, | ||
}); | ||
|
||
const onClick = () => { | ||
createNewTableRecord(); | ||
}; | ||
|
||
return { | ||
shouldBeRegistered: true, | ||
onClick, | ||
}; | ||
}; |
1 change: 1 addition & 0 deletions
1
...ules/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKey.ts
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,3 +1,4 @@ | ||
export enum NoSelectionRecordActionKeys { | ||
EXPORT_VIEW = 'export-view-no-selection', | ||
CREATE_NEW_RECORD = 'create-new-record-no-selection', | ||
} |
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
9 changes: 0 additions & 9 deletions
9
packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuButtons.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
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
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
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
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
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
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
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
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
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
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
5 changes: 5 additions & 0 deletions
5
...ages/twenty-front/src/modules/object-record/utils/getRecordIndexIdFromObjectNamePlural.ts
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,5 @@ | ||
export const getRecordIndexIdFromObjectNamePlural = ( | ||
objectNamePlural: string, | ||
) => { | ||
return objectNamePlural; | ||
}; |