diff --git a/packages/twenty-front/src/modules/object-record/record-field/components/FormFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/components/FormFieldInput.tsx index 36036343b..244a35ab4 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/components/FormFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/components/FormFieldInput.tsx @@ -48,6 +48,7 @@ type FormFieldInputProps = { onChange: (value: JsonValue) => void; VariablePicker?: VariablePickerComponent; readonly?: boolean; + placeholder?: string; }; export const FormFieldInput = ({ @@ -56,15 +57,16 @@ export const FormFieldInput = ({ onChange, VariablePicker, readonly, + placeholder, }: FormFieldInputProps) => { return isFieldNumber(field) ? ( ) : isFieldBoolean(field) ? ( ) : isFieldSelect(field) ? ( ) : isFieldFullName(field) ? ( ) : isFieldDateTime(field) ? ( ) : isFieldRawJson(field) ? ( ) : isFieldUuid(field) ? ( ) : isFieldCurrency(field) ? ( void; VariablePicker?: VariablePickerComponent; readonly?: boolean; + placeholder?: string; }; export const FormDateFieldInput = ({ @@ -15,6 +16,7 @@ export const FormDateFieldInput = ({ onChange, VariablePicker, readonly, + placeholder, }: FormDateFieldInputProps) => { return ( ); }; diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx index b9702f4c9..e686a9e84 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormDateTimeFieldInput.tsx @@ -29,8 +29,8 @@ import { useRef, useState, } from 'react'; -import { Nullable, TEXT_INPUT_STYLE } from 'twenty-ui'; import { isDefined } from 'twenty-shared/utils'; +import { Nullable, TEXT_INPUT_STYLE } from 'twenty-ui'; const StyledInputContainer = styled(FormFieldInputInputContainer)` display: grid; @@ -77,9 +77,9 @@ type DraftValue = type FormDateTimeFieldInputProps = { dateOnly?: boolean; label?: string; - placeholder?: string; defaultValue: string | undefined; onChange: (value: string | null) => void; + placeholder?: string; VariablePicker?: VariablePickerComponent; readonly?: boolean; }; @@ -91,6 +91,7 @@ export const FormDateTimeFieldInput = ({ onChange, VariablePicker, readonly, + placeholder, }: FormDateTimeFieldInputProps) => { const { timeZone } = useContext(UserContext); @@ -149,7 +150,8 @@ export const FormDateTimeFieldInput = ({ const displayDatePicker = draftValue.type === 'static' && draftValue.mode === 'edit'; - const placeholder = dateOnly ? 'mm/dd/yyyy' : 'mm/dd/yyyy hh:mm'; + const placeholderToDisplay = + placeholder ?? (dateOnly ? 'mm/dd/yyyy' : 'mm/dd/yyyy hh:mm'); useListenClickOutside({ refs: [datePickerWrapperRef], @@ -340,7 +342,7 @@ export const FormDateTimeFieldInput = ({ <> void; VariablePicker?: VariablePickerComponent; readonly?: boolean; + placeholder?: string; }; export const FormLinksFieldInput = ({ @@ -20,6 +21,7 @@ export const FormLinksFieldInput = ({ onChange, readonly, VariablePicker, + placeholder, }: FormLinksFieldInputProps) => { const handleChange = (field: keyof FieldLinksDraftValue) => (updatedLinksPart: string) => { @@ -40,7 +42,7 @@ export const FormLinksFieldInput = ({ label="Primary Link Label" defaultValue={defaultValue?.primaryLinkLabel} onChange={handleChange('primaryLinkLabel')} - placeholder={'Primary Link Label'} + placeholder={placeholder ?? 'Primary Link Label'} readonly={readonly} VariablePicker={VariablePicker} /> @@ -48,7 +50,7 @@ export const FormLinksFieldInput = ({ label="Primary Link URL" defaultValue={defaultValue?.primaryLinkUrl} onChange={handleChange('primaryLinkUrl')} - placeholder={'Primary Link URL'} + placeholder={placeholder ?? 'Primary Link URL'} readonly={readonly} VariablePicker={VariablePicker} /> diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx index 12ee65cb2..c03e35d2a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormNumberFieldInput.tsx @@ -10,11 +10,11 @@ import { InputLabel } from '@/ui/input/components/InputLabel'; import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString'; import styled from '@emotion/styled'; import { useId, useState } from 'react'; +import { isDefined } from 'twenty-shared/utils'; import { canBeCastAsNumberOrNull, castAsNumberOrNull, } from '~/utils/cast-as-number-or-null'; -import { isDefined } from 'twenty-shared/utils'; const StyledInput = styled(TextInput)` padding: ${({ theme }) => `${theme.spacing(1)} ${theme.spacing(2)}`}; @@ -23,13 +23,13 @@ const StyledInput = styled(TextInput)` type FormNumberFieldInputProps = { label?: string; error?: string; - placeholder: string; defaultValue: number | string | undefined; onChange: (value: number | null | string) => void; onBlur?: () => void; VariablePicker?: VariablePickerComponent; hint?: string; readonly?: boolean; + placeholder?: string; }; export const FormNumberFieldInput = ({ @@ -115,7 +115,7 @@ export const FormNumberFieldInput = ({ {draftValue.type === 'static' ? ( void; readonly?: boolean; VariablePicker?: VariablePickerComponent; + placeholder?: string; }; export const FormRawJsonFieldInput = ({ @@ -29,7 +29,7 @@ export const FormRawJsonFieldInput = ({ const inputId = useId(); const editor = useTextVariableEditor({ - placeholder, + placeholder: placeholder ?? 'Enter a JSON object', multiline: true, readonly, defaultValue: defaultValue ?? undefined, diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormTextFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormTextFieldInput.tsx index 9510572c0..89a6ffa3d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormTextFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormTextFieldInput.tsx @@ -16,11 +16,11 @@ type FormTextFieldInputProps = { error?: string; hint?: string; defaultValue: string | undefined; - placeholder: string; onChange: (value: string) => void; onBlur?: () => void; multiline?: boolean; readonly?: boolean; + placeholder?: string; VariablePicker?: VariablePickerComponent; }; @@ -39,7 +39,7 @@ export const FormTextFieldInput = ({ const inputId = useId(); const editor = useTextVariableEditor({ - placeholder, + placeholder: placeholder ?? 'Enter text', multiline, readonly, defaultValue, diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormUuidFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormUuidFieldInput.tsx index 3ddf3d38e..2944a9fe4 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormUuidFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormUuidFieldInput.tsx @@ -17,10 +17,10 @@ const StyledInput = styled(TextInput)` type FormUuidFieldInputProps = { label?: string; defaultValue: string | null | undefined; - placeholder: string; onChange: (value: string | null) => void; readonly?: boolean; VariablePicker?: VariablePickerComponent; + placeholder?: string; }; export const FormUuidFieldInput = ({ @@ -100,7 +100,7 @@ export const FormUuidFieldInput = ({ {draftValue.type === 'static' ? ( - {field.placeholder} + + {isDefined(field.placeholder) && + isNonEmptyString(field.placeholder) + ? field.placeholder + : getDefaultFormFieldSettings(field.type).placeholder} + {!isFieldSelected(field.id) && ( ))} diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx index 0458aa44a..2cc2b9375 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsNumber.tsx @@ -1,8 +1,9 @@ import { FormFieldInputContainer } from '@/object-record/record-field/form-types/components/FormFieldInputContainer'; import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput'; import { InputLabel } from '@/ui/input/components/InputLabel'; +import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings'; import styled from '@emotion/styled'; -import { t } from '@lingui/core/macro'; +import { FieldMetadataType } from 'twenty-shared/types'; type WorkflowFormFieldSettingsNumberProps = { label?: string; @@ -29,8 +30,10 @@ export const WorkflowFormFieldSettingsNumber = ({ onChange={(newLabel: string | null) => { onChange('label', newLabel); }} - defaultValue={label ?? t`Number`} - placeholder={t`Text`} + defaultValue={label} + placeholder={ + getDefaultFormFieldSettings(FieldMetadataType.NUMBER).label + } /> @@ -39,8 +42,10 @@ export const WorkflowFormFieldSettingsNumber = ({ onChange={(newPlaceholder: string | null) => { onChange('placeholder', newPlaceholder); }} - defaultValue={placeholder ?? '1000'} - placeholder={'1000'} + defaultValue={placeholder} + placeholder={ + getDefaultFormFieldSettings(FieldMetadataType.NUMBER).placeholder + } /> diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx index f19cfaa8c..9962286f8 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsText.tsx @@ -1,7 +1,9 @@ import { FormFieldInputContainer } from '@/object-record/record-field/form-types/components/FormFieldInputContainer'; import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput'; import { InputLabel } from '@/ui/input/components/InputLabel'; +import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings'; import styled from '@emotion/styled'; +import { FieldMetadataType } from 'twenty-shared/types'; type WorkflowFormFieldSettingsTextProps = { label?: string; @@ -29,7 +31,9 @@ export const WorkflowFormFieldSettingsText = ({ onChange('label', newLabel); }} defaultValue={label} - placeholder={'Text'} + placeholder={ + getDefaultFormFieldSettings(FieldMetadataType.TEXT).label + } /> @@ -39,7 +43,9 @@ export const WorkflowFormFieldSettingsText = ({ onChange('placeholder', newPlaceholder); }} defaultValue={placeholder} - placeholder={'Enter your text'} + placeholder={ + getDefaultFormFieldSettings(FieldMetadataType.TEXT).placeholder + } /> diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormFiller.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormFiller.stories.tsx index c98fda0bd..a5d4aadab 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormFiller.stories.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/__stories__/WorkflowEditActionFormFiller.stories.tsx @@ -94,7 +94,7 @@ export const ReadonlyMode: Story = { const textField = await canvas.findByText('Text Field'); expect(textField).toBeVisible(); - const numberInput = await canvas.findByPlaceholderText('Number Field'); + const numberInput = await canvas.findByPlaceholderText('Enter number'); expect(numberInput).toBeDisabled(); const submitButton = await canvas.queryByText('Submit'); diff --git a/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx b/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx index d77006f11..9c1dcbb6d 100644 --- a/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx +++ b/packages/twenty-front/src/pages/object-record/RecordShowPage.tsx @@ -24,7 +24,7 @@ export const RecordShowPage = () => { objectRecordId: string; }>(); - const { objectNameSingular, objectRecordId, headerIcon } = useRecordShowPage( + const { objectNameSingular, objectRecordId } = useRecordShowPage( parameters.objectNameSingular ?? '', parameters.objectRecordId ?? '', ); @@ -55,7 +55,6 @@ export const RecordShowPage = () => { diff --git a/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx b/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx index 88b6d09cf..f0a7ca9f5 100644 --- a/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx +++ b/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx @@ -13,7 +13,6 @@ export const RecordShowPageHeader = ({ }: { objectNameSingular: string; objectRecordId: string; - headerIcon: React.ComponentType; children?: React.ReactNode; }) => { const { viewName, navigateToIndexView, objectMetadataItem } = diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons.ts index e24ab0e2b..f02f178c5 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons.ts @@ -36,7 +36,7 @@ export const STANDARD_OBJECT_ICONS = { webhook: 'IconRobot', workflow: 'IconSettingsAutomation', workflowEventListener: 'IconSettingsAutomation', - workflowRun: 'IconSettingsAutomation', - workflowVersion: 'IconSettingsAutomation', + workflowRun: 'IconHistoryToggle', + workflowVersion: 'IconVersions', workspaceMember: 'IconUserCircle', };