refactor(command-menu-item): rename Actions to CommandMenuItem (#18489)
actions are being renamed to command menu item, they will be migrated to server and will be served as headless front components --------- Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com>
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId';
|
||||
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { Button } from 'twenty-ui/input';
|
||||
import { getOsControlSymbol } from 'twenty-ui/utilities';
|
||||
|
||||
export const WorkflowStepCmdEnterButton = ({
|
||||
title,
|
||||
onClick,
|
||||
disabled = false,
|
||||
}: {
|
||||
title: string;
|
||||
onClick: () => void;
|
||||
disabled?: boolean;
|
||||
}) => {
|
||||
useHotkeysOnFocusedElement({
|
||||
keys: [`${Key.Control}+${Key.Enter}`, `${Key.Meta}+${Key.Enter}`],
|
||||
callback: () => onClick(),
|
||||
focusId: SIDE_PANEL_FOCUS_ID,
|
||||
dependencies: [onClick],
|
||||
});
|
||||
|
||||
return (
|
||||
<Button
|
||||
title={title}
|
||||
variant={disabled ? 'secondary' : 'primary'}
|
||||
accent="blue"
|
||||
size="small"
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
hotkeys={[getOsControlSymbol(), '⏎']}
|
||||
/>
|
||||
);
|
||||
};
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
import { ActionButton } from '@/action-menu/actions/display/components/ActionButton';
|
||||
import { CommandMenuButton } from '@/command-menu/components/CommandMenuButton';
|
||||
import { getAdvancedFilterAddFilterRuleSelectDropdownId } from '@/object-record/advanced-filter/utils/getAdvancedFilterAddFilterRuleSelectDropdownId';
|
||||
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
||||
import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
|
||||
@@ -95,8 +95,8 @@ export const WorkflowStepFilterAddFilterRuleSelect = ({
|
||||
|
||||
if (!isFilterRuleGroupOptionVisible) {
|
||||
return (
|
||||
<ActionButton
|
||||
action={{
|
||||
<CommandMenuButton
|
||||
command={{
|
||||
Icon: IconPlus,
|
||||
label: t`Add rule`,
|
||||
shortLabel: t`Add rule`,
|
||||
@@ -111,8 +111,8 @@ export const WorkflowStepFilterAddFilterRuleSelect = ({
|
||||
<Dropdown
|
||||
dropdownId={dropdownId}
|
||||
clickableComponent={
|
||||
<ActionButton
|
||||
action={{
|
||||
<CommandMenuButton
|
||||
command={{
|
||||
Icon: IconPlus,
|
||||
label: t`Add filter rule`,
|
||||
shortLabel: t`Add filter rule`,
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
import { CmdEnterActionButton } from '@/action-menu/components/CmdEnterActionButton';
|
||||
import { WorkflowStepCmdEnterButton } from '@/workflow/workflow-steps/components/WorkflowStepCmdEnterButton';
|
||||
import { useAiModelOptions } from '@/ai/hooks/useAiModelOptions';
|
||||
import { TabList } from '@/ui/layout/tab-list/components/TabList';
|
||||
import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';
|
||||
@@ -244,7 +244,7 @@ export const WorkflowEditActionAiAgent = ({
|
||||
|
||||
if (workflowAiAgentPermissionsIsAddingPermission) {
|
||||
return [
|
||||
<CmdEnterActionButton
|
||||
<WorkflowStepCmdEnterButton
|
||||
key="view-role"
|
||||
title={t`View role`}
|
||||
onClick={handleViewRole}
|
||||
@@ -258,7 +258,7 @@ export const WorkflowEditActionAiAgent = ({
|
||||
}
|
||||
|
||||
return [
|
||||
<CmdEnterActionButton
|
||||
<WorkflowStepCmdEnterButton
|
||||
key="add-permission"
|
||||
title={t`Add permission`}
|
||||
onClick={() => setWorkflowAiAgentPermissionsIsAddingPermission(true)}
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/wo
|
||||
import { type WorkflowCodeAction } from '@/workflow/types/Workflow';
|
||||
import { setNestedValue } from '@/workflow/workflow-steps/workflow-actions/code-action/utils/setNestedValue';
|
||||
|
||||
import { CmdEnterActionButton } from '@/action-menu/components/CmdEnterActionButton';
|
||||
import { WorkflowStepCmdEnterButton } from '@/workflow/workflow-steps/components/WorkflowStepCmdEnterButton';
|
||||
import { LogicFunctionExecutionResult } from '@/logic-functions/components/LogicFunctionExecutionResult';
|
||||
import { LogicFunctionLogs } from '@/logic-functions/components/LogicFunctionLogs';
|
||||
import { mergeDefaultFunctionInputAndFunctionInput } from '@/workflow/workflow-steps/workflow-actions/code-action/utils/mergeDefaultFunctionInputAndFunctionInput';
|
||||
@@ -434,7 +434,7 @@ export const WorkflowEditActionCode = ({
|
||||
additionalActions={
|
||||
activeTabId === WorkflowLogicFunctionTabId.TEST
|
||||
? [
|
||||
<CmdEnterActionButton
|
||||
<WorkflowStepCmdEnterButton
|
||||
title={t`Test`}
|
||||
onClick={handleTestFunction}
|
||||
disabled={isExecuting}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { CmdEnterActionButton } from '@/action-menu/components/CmdEnterActionButton';
|
||||
import { WorkflowStepCmdEnterButton } from '@/workflow/workflow-steps/components/WorkflowStepCmdEnterButton';
|
||||
import { useSidePanelHistory } from '@/side-panel/hooks/useSidePanelHistory';
|
||||
import { FormFieldInput } from '@/object-record/record-field/ui/components/FormFieldInput';
|
||||
import { FormSingleRecordPicker } from '@/object-record/record-field/ui/form-types/components/FormSingleRecordPicker';
|
||||
@@ -183,7 +183,7 @@ export const WorkflowEditActionFormFiller = ({
|
||||
{!actionOptions.readonly && (
|
||||
<SidePanelFooter
|
||||
actions={[
|
||||
<CmdEnterActionButton
|
||||
<WorkflowStepCmdEnterButton
|
||||
title={t`Submit`}
|
||||
onClick={onSubmit}
|
||||
disabled={!canSubmit}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import { Select } from '@/ui/input/components/Select';
|
||||
import { type WorkflowHttpRequestAction } from '@/workflow/types/Workflow';
|
||||
import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody';
|
||||
|
||||
import { CmdEnterActionButton } from '@/action-menu/components/CmdEnterActionButton';
|
||||
import { WorkflowStepCmdEnterButton } from '@/workflow/workflow-steps/components/WorkflowStepCmdEnterButton';
|
||||
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
|
||||
import { TabList } from '@/ui/layout/tab-list/components/TabList';
|
||||
import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';
|
||||
@@ -212,7 +212,7 @@ export const WorkflowEditActionHttpRequest = ({
|
||||
additionalActions={
|
||||
activeTabId === WorkflowHttpRequestTabId.TEST
|
||||
? [
|
||||
<CmdEnterActionButton
|
||||
<WorkflowStepCmdEnterButton
|
||||
title={t`Test`}
|
||||
onClick={handleTestRequest}
|
||||
disabled={isTesting}
|
||||
|
||||
Reference in New Issue
Block a user