Remove "When no records are selected" actions on record page ⌘O (#8575)
Closes #8566 - Introduce the concept of scope for an ActionMenuEntry, scope is either `global` or `record-selection`
This commit is contained in:
@ -65,21 +65,25 @@ export const RightDrawerActionMenuDropdown = () => {
|
||||
}}
|
||||
dropdownComponents={
|
||||
<DropdownMenuItemsContainer>
|
||||
{actionMenuEntries.map((item, index) => (
|
||||
<MenuItem
|
||||
key={index}
|
||||
LeftIcon={item.Icon}
|
||||
onClick={() => {
|
||||
closeDropdown(
|
||||
getRightDrawerActionMenuDropdownIdFromActionMenuId(
|
||||
actionMenuId,
|
||||
),
|
||||
);
|
||||
item.onClick?.();
|
||||
}}
|
||||
text={item.label}
|
||||
/>
|
||||
))}
|
||||
{actionMenuEntries
|
||||
.filter(
|
||||
(actionMenuEntry) => actionMenuEntry.scope === 'record-selection',
|
||||
)
|
||||
.map((actionMenuEntry, index) => (
|
||||
<MenuItem
|
||||
key={index}
|
||||
LeftIcon={actionMenuEntry.Icon}
|
||||
onClick={() => {
|
||||
closeDropdown(
|
||||
getRightDrawerActionMenuDropdownIdFromActionMenuId(
|
||||
actionMenuId,
|
||||
),
|
||||
);
|
||||
actionMenuEntry.onClick?.();
|
||||
}}
|
||||
text={actionMenuEntry.label}
|
||||
/>
|
||||
))}
|
||||
</DropdownMenuItemsContainer>
|
||||
}
|
||||
/>
|
||||
|
||||
@ -48,6 +48,7 @@ const meta: Meta<typeof RecordIndexActionMenuBar> = {
|
||||
|
||||
map.set('delete', {
|
||||
isPinned: true,
|
||||
scope: 'record-selection',
|
||||
type: 'standard',
|
||||
key: 'delete',
|
||||
label: 'Delete',
|
||||
|
||||
@ -22,6 +22,7 @@ export const Default: Story = {
|
||||
args: {
|
||||
entry: {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'delete',
|
||||
label: 'Delete',
|
||||
position: 0,
|
||||
@ -35,6 +36,7 @@ export const WithDangerAccent: Story = {
|
||||
args: {
|
||||
entry: {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'delete',
|
||||
label: 'Delete',
|
||||
position: 0,
|
||||
@ -49,6 +51,7 @@ export const WithInteraction: Story = {
|
||||
args: {
|
||||
entry: {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'markAsDone',
|
||||
label: 'Mark as done',
|
||||
position: 0,
|
||||
|
||||
@ -42,6 +42,7 @@ const meta: Meta<typeof RecordIndexActionMenuDropdown> = {
|
||||
|
||||
map.set('delete', {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'delete',
|
||||
label: 'Delete',
|
||||
position: 0,
|
||||
@ -51,6 +52,7 @@ const meta: Meta<typeof RecordIndexActionMenuDropdown> = {
|
||||
|
||||
map.set('markAsDone', {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'markAsDone',
|
||||
label: 'Mark as done',
|
||||
position: 1,
|
||||
@ -60,6 +62,7 @@ const meta: Meta<typeof RecordIndexActionMenuDropdown> = {
|
||||
|
||||
map.set('addToFavorites', {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'addToFavorites',
|
||||
label: 'Add to favorites',
|
||||
position: 2,
|
||||
|
||||
@ -55,6 +55,7 @@ const meta: Meta<typeof RightDrawerActionMenuDropdown> = {
|
||||
|
||||
map.set('addToFavorites', {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'addToFavorites',
|
||||
label: 'Add to favorites',
|
||||
position: 0,
|
||||
@ -64,6 +65,7 @@ const meta: Meta<typeof RightDrawerActionMenuDropdown> = {
|
||||
|
||||
map.set('export', {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'export',
|
||||
label: 'Export',
|
||||
position: 1,
|
||||
@ -73,6 +75,7 @@ const meta: Meta<typeof RightDrawerActionMenuDropdown> = {
|
||||
|
||||
map.set('delete', {
|
||||
type: 'standard',
|
||||
scope: 'record-selection',
|
||||
key: 'delete',
|
||||
label: 'Delete',
|
||||
position: 2,
|
||||
|
||||
Reference in New Issue
Block a user