324 add search records as a fallback action in case of no results (#9976)
Closes https://github.com/twentyhq/core-team-issues/issues/324 Fixed typos: 'No results' is used when multiple results are expected and 'No result' is used when only one result is expected. https://github.com/user-attachments/assets/e3655ced-465a-44b1-92af-63878b9d8a94
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { RecordAgnosticActionsKey } from '@/action-menu/actions/record-agnostic-actions/types/RecordAgnosticActionsKey';
|
||||
import { actionMenuEntriesComponentSelector } from '@/action-menu/states/actionMenuEntriesComponentSelector';
|
||||
import {
|
||||
ActionMenuEntryScope,
|
||||
@ -128,6 +129,25 @@ export const useCommandMenuCommands = () => {
|
||||
hotKeys: actionMenuEntry.hotKeys,
|
||||
}));
|
||||
|
||||
const searchRecordsAction = actionMenuEntries.find(
|
||||
(actionMenuEntry) =>
|
||||
actionMenuEntry.key === RecordAgnosticActionsKey.SEARCH_RECORDS,
|
||||
);
|
||||
|
||||
const fallbackCommands: Command[] = searchRecordsAction
|
||||
? [
|
||||
{
|
||||
id: searchRecordsAction.key,
|
||||
label: i18n._(searchRecordsAction.label),
|
||||
Icon: searchRecordsAction.Icon,
|
||||
onCommandClick: searchRecordsAction.onClick,
|
||||
type: CommandType.StandardAction,
|
||||
scope: CommandScope.Global,
|
||||
hotKeys: searchRecordsAction.hotKeys,
|
||||
},
|
||||
]
|
||||
: [];
|
||||
|
||||
return {
|
||||
copilotCommands,
|
||||
navigateCommands,
|
||||
@ -136,5 +156,6 @@ export const useCommandMenuCommands = () => {
|
||||
actionObjectCommands,
|
||||
workflowRunRecordSelectionCommands,
|
||||
workflowRunGlobalCommands,
|
||||
fallbackCommands,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user