Skip to content

Commit b9f68f9

Browse files
committed
Set const for default label + add a tooltip props
1 parent efced12 commit b9f68f9

File tree

51 files changed

+388
-210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+388
-210
lines changed

packages/twenty-front/src/modules/command-menu/components/SidePanelHeader.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type SidePanelHeaderProps = {
5252
iconColor: string;
5353
initialTitle: string;
5454
headerType: string;
55+
iconTooltip?: string;
5556
} & (
5657
| {
5758
disabled: true;
@@ -70,6 +71,7 @@ export const SidePanelHeader = ({
7071
headerType,
7172
disabled,
7273
onTitleChange,
74+
iconTooltip,
7375
}: SidePanelHeaderProps) => {
7476
const theme = useTheme();
7577

@@ -89,7 +91,6 @@ export const SidePanelHeader = ({
8991
});
9092
};
9193

92-
// Create a unique ID for the tooltip anchor
9394
const tooltipId = `side-panel-icon-tooltip-${headerType.replace(/\s+/g, '-')}`;
9495

9596
return (
@@ -101,11 +102,13 @@ export const SidePanelHeader = ({
101102
size={theme.icon.size.lg}
102103
/>
103104
</StyledHeaderIconContainer>
104-
<AppTooltip
105-
anchorSelect={`#${tooltipId}`}
106-
content={headerType}
107-
place="top"
108-
/>
105+
{iconTooltip && (
106+
<AppTooltip
107+
anchorSelect={`#${tooltipId}`}
108+
content={iconTooltip}
109+
place="top"
110+
/>
111+
)}
109112
<StyledHeaderInfo>
110113
<StyledHeaderTitle>
111114
<TitleInput

packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/WorkflowActionMenuItems.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { useTheme } from '@emotion/react';
44
import { useIcons } from 'twenty-ui/display';
55
import { MenuItem } from 'twenty-ui/navigation';
66

7-
type Action = { type: WorkflowActionType; label: string; icon: string };
7+
type Action = {
8+
defaultLabel: string;
9+
type: WorkflowActionType;
10+
icon: string;
11+
};
812

913
export const WorkflowActionMenuItems = ({
1014
actions,
@@ -34,7 +38,7 @@ export const WorkflowActionMenuItems = ({
3438
size={16}
3539
/>
3640
)}
37-
text={action.label}
41+
text={action.defaultLabel}
3842
onClick={() => onClick(action.type)}
3943
/>
4044
);

packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Select } from '@/ui/input/components/Select';
66
import { type WorkflowAiAgentAction } from '@/workflow/types/Workflow';
77
import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody';
88
import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';
9+
import { AI_AGENT_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/AiAgentAction';
910
import { useWorkflowActionHeader } from '@/workflow/workflow-steps/workflow-actions/hooks/useWorkflowActionHeader';
1011
import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker';
1112
import { type AiAgentOutputSchema } from '@/workflow/workflow-variables/types/AiAgentOutputSchema';
@@ -44,7 +45,7 @@ export const WorkflowEditActionAiAgent = ({
4445
const { headerTitle, headerIcon, headerIconColor, headerType } =
4546
useWorkflowActionHeader({
4647
action,
47-
defaultTitle: 'AI Agent',
48+
defaultTitle: AI_AGENT_ACTION.defaultLabel,
4849
});
4950

5051
const { handleOutputSchemaChange, outputFields } = useAiAgentOutputSchema(
@@ -111,6 +112,7 @@ export const WorkflowEditActionAiAgent = ({
111112
initialTitle={headerTitle}
112113
headerType={headerType}
113114
disabled={actionOptions.readonly}
115+
iconTooltip={AI_AGENT_ACTION.defaultLabel}
114116
/>
115117
<WorkflowStepBody>
116118
<div>

packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionServerlessFunction.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { useLingui } from '@lingui/react/macro';
4040
import { SOURCE_FOLDER_NAME } from '@/serverless-functions/constants/SourceFolderName';
4141
import { computeNewSources } from '@/serverless-functions/utils/computeNewSources';
4242
import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';
43+
import { CODE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CodeAction';
4344
import { type Monaco } from '@monaco-editor/react';
4445
import { type editor } from 'monaco-editor';
4546
import { AutoTypings } from 'monaco-editor-auto-typings';
@@ -326,7 +327,7 @@ export const WorkflowEditActionServerlessFunction = ({
326327

327328
const headerTitle = isDefined(action.name)
328329
? action.name
329-
: 'Code - Serverless Function';
330+
: CODE_ACTION.defaultLabel;
330331
const headerIcon = getActionIcon(action.type);
331332
const headerIconColor = useActionIconColorOrThrow(action.type);
332333
const headerType = useActionHeaderTypeOrThrow(action.type);
@@ -431,6 +432,7 @@ export const WorkflowEditActionServerlessFunction = ({
431432
initialTitle={headerTitle}
432433
headerType={headerType}
433434
disabled={actionOptions.readonly}
435+
iconTooltip={CODE_ACTION.defaultLabel}
434436
/>
435437
<WorkflowStepBody>
436438
{activeTabId === WorkflowServerlessFunctionTabId.CODE && (

packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateRecord.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { useViewOrDefaultViewFromPrefetchedViews } from '@/views/hooks/useViewOr
1010
import { type WorkflowCreateRecordAction } from '@/workflow/types/Workflow';
1111
import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody';
1212
import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';
13+
import { CREATE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/CreateRecordAction';
1314
import { useWorkflowActionHeader } from '@/workflow/workflow-steps/workflow-actions/hooks/useWorkflowActionHeader';
1415
import { shouldDisplayFormField } from '@/workflow/workflow-steps/workflow-actions/utils/shouldDisplayFormField';
1516
import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker';
@@ -198,7 +199,7 @@ export const WorkflowEditActionCreateRecord = ({
198199
const { headerTitle, headerIcon, headerIconColor, headerType } =
199200
useWorkflowActionHeader({
200201
action,
201-
defaultTitle: 'Create Record',
202+
defaultTitle: CREATE_RECORD_ACTION.defaultLabel,
202203
});
203204

204205
return (
@@ -219,6 +220,7 @@ export const WorkflowEditActionCreateRecord = ({
219220
initialTitle={headerTitle}
220221
headerType={headerType}
221222
disabled={isFormDisabled}
223+
iconTooltip={CREATE_RECORD_ACTION.defaultLabel}
222224
/>
223225
<WorkflowStepBody>
224226
<Select

packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionDeleteRecord.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useEffect, useState } from 'react';
88
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
99
import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody';
1010
import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';
11+
import { DELETE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/DeleteRecordAction';
1112
import { useWorkflowActionHeader } from '@/workflow/workflow-steps/workflow-actions/hooks/useWorkflowActionHeader';
1213
import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker';
1314
import { useTheme } from '@emotion/react';
@@ -118,7 +119,7 @@ export const WorkflowEditActionDeleteRecord = ({
118119
const { headerTitle, headerIcon, headerIconColor, headerType } =
119120
useWorkflowActionHeader({
120121
action,
121-
defaultTitle: 'Delete Record',
122+
defaultTitle: DELETE_RECORD_ACTION.defaultLabel,
122123
});
123124

124125
return (
@@ -139,6 +140,7 @@ export const WorkflowEditActionDeleteRecord = ({
139140
initialTitle={headerTitle}
140141
headerType={headerType}
141142
disabled={isFormDisabled}
143+
iconTooltip={DELETE_RECORD_ACTION.defaultLabel}
142144
/>
143145
<WorkflowStepBody>
144146
<Select

packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionSendEmail.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/wo
1919
import { type WorkflowSendEmailAction } from '@/workflow/types/Workflow';
2020
import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody';
2121
import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';
22+
import { SEND_EMAIL_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/SendEmailAction';
2223
import { useWorkflowActionHeader } from '@/workflow/workflow-steps/workflow-actions/hooks/useWorkflowActionHeader';
2324
import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker';
2425
import { useTheme } from '@emotion/react';
@@ -246,7 +247,7 @@ export const WorkflowEditActionSendEmail = ({
246247
const { headerTitle, headerIcon, headerIconColor, headerType } =
247248
useWorkflowActionHeader({
248249
action,
249-
defaultTitle: 'Send Email',
250+
defaultTitle: SEND_EMAIL_ACTION.defaultLabel,
250251
});
251252

252253
const navigate = useNavigateSettings();
@@ -272,6 +273,7 @@ export const WorkflowEditActionSendEmail = ({
272273
initialTitle={headerTitle}
273274
headerType={headerType}
274275
disabled={actionOptions.readonly}
276+
iconTooltip={SEND_EMAIL_ACTION.defaultLabel}
275277
/>
276278
<WorkflowStepBody>
277279
<Select

packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpdateRecord.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { type WorkflowUpdateRecordAction } from '@/workflow/types/Workflow';
33
import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';
44
import { WorkflowUpdateRecordBody } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowUpdateRecordBody';
55

6+
import { UPDATE_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/UpdateRecordAction';
67
import { useWorkflowActionHeader } from '@/workflow/workflow-steps/workflow-actions/hooks/useWorkflowActionHeader';
78
import { type UpdateRecordFormData } from '@/workflow/workflow-steps/workflow-actions/types/update-record-form-data.type';
89
import { useIcons } from 'twenty-ui/display';
@@ -26,7 +27,7 @@ export const WorkflowEditActionUpdateRecord = ({
2627
const { headerTitle, headerIcon, headerIconColor, headerType } =
2728
useWorkflowActionHeader({
2829
action,
29-
defaultTitle: 'Update Record',
30+
defaultTitle: UPDATE_RECORD_ACTION.defaultLabel,
3031
});
3132

3233
const { getIcon } = useIcons();
@@ -70,6 +71,7 @@ export const WorkflowEditActionUpdateRecord = ({
7071
initialTitle={headerTitle}
7172
headerType={headerType}
7273
disabled={isFormDisabled}
74+
iconTooltip={UPDATE_RECORD_ACTION.defaultLabel}
7375
/>
7476
<WorkflowUpdateRecordBody
7577
defaultObjectNameSingular={action.settings.input.objectName}

packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpsertRecord.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { type WorkflowUpsertRecordAction } from '@/workflow/types/Workflow';
33
import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter';
44
import { WorkflowUpdateRecordBody } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowUpdateRecordBody';
55

6+
import { UPSERT_RECORD_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/UpsertRecordAction';
67
import { useWorkflowActionHeader } from '@/workflow/workflow-steps/workflow-actions/hooks/useWorkflowActionHeader';
78
import { type UpdateRecordFormData } from '@/workflow/workflow-steps/workflow-actions/types/update-record-form-data.type';
89
import { useIcons } from 'twenty-ui/display';
@@ -26,7 +27,7 @@ export const WorkflowEditActionUpsertRecord = ({
2627
const { headerTitle, headerIcon, headerIconColor, headerType } =
2728
useWorkflowActionHeader({
2829
action,
29-
defaultTitle: 'Create or Update Record',
30+
defaultTitle: UPSERT_RECORD_ACTION.defaultLabel,
3031
});
3132

3233
const { getIcon } = useIcons();
@@ -69,6 +70,7 @@ export const WorkflowEditActionUpsertRecord = ({
6970
initialTitle={headerTitle}
7071
headerType={headerType}
7172
disabled={isFormDisabled}
73+
iconTooltip={UPSERT_RECORD_ACTION.defaultLabel}
7274
/>
7375
<WorkflowUpdateRecordBody
7476
defaultObjectNameSingular={action.settings.input.objectName}
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import { type WorkflowActionType } from '@/workflow/types/Workflow';
2+
import { AI_AGENT_ACTION } from '@/workflow/workflow-steps/workflow-actions/constants/actions/AiAgentAction';
23

34
export const AI_ACTIONS: Array<{
4-
label: string;
5+
defaultLabel: string;
56
type: Extract<WorkflowActionType, 'AI_AGENT'>;
67
icon: string;
7-
}> = [
8-
{
9-
label: 'AI Agent',
10-
type: 'AI_AGENT',
11-
icon: 'IconBrain',
12-
},
13-
];
8+
}> = [AI_AGENT_ACTION];

0 commit comments

Comments
 (0)