Closes #8737 - Refactored actions by creating hooks to add the possibility to register actions programatically. - Small fixes from #8610 review - Fixed shortcuts display inside the command menu - Removed `actionMenuEntriesComponentState` and introduced `actionMenuEntriesComponentSelector`
24 lines
962 B
TypeScript
24 lines
962 B
TypeScript
import { actionMenuEntriesComponentSelector } from '@/action-menu/states/actionMenuEntriesComponentSelector';
|
|
import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext';
|
|
import { Command } from '@/command-menu/types/Command';
|
|
import { computeCommandMenuCommands } from '@/command-menu/utils/computeCommandMenuCommands';
|
|
import { createComponentSelectorV2 } from '@/ui/utilities/state/component-state/utils/createComponentSelectorV2';
|
|
|
|
export const commandMenuCommandsComponentSelector = createComponentSelectorV2<
|
|
Command[]
|
|
>({
|
|
key: 'commandMenuCommandsComponentSelector',
|
|
componentInstanceContext: ActionMenuComponentInstanceContext,
|
|
get:
|
|
({ instanceId }) =>
|
|
({ get }) => {
|
|
const actionMenuEntries = get(
|
|
actionMenuEntriesComponentSelector.selectorFamily({
|
|
instanceId,
|
|
}),
|
|
);
|
|
|
|
return computeCommandMenuCommands(actionMenuEntries);
|
|
},
|
|
});
|