Fix workflow placeholders and icons (#11222)
- allow all form fields that may need a placeholder to set it - update main icons on versions and runs
This commit is contained in:
@ -48,6 +48,7 @@ type FormFieldInputProps = {
|
|||||||
onChange: (value: JsonValue) => void;
|
onChange: (value: JsonValue) => void;
|
||||||
VariablePicker?: VariablePickerComponent;
|
VariablePicker?: VariablePickerComponent;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FormFieldInput = ({
|
export const FormFieldInput = ({
|
||||||
@ -56,15 +57,16 @@ export const FormFieldInput = ({
|
|||||||
onChange,
|
onChange,
|
||||||
VariablePicker,
|
VariablePicker,
|
||||||
readonly,
|
readonly,
|
||||||
|
placeholder,
|
||||||
}: FormFieldInputProps) => {
|
}: FormFieldInputProps) => {
|
||||||
return isFieldNumber(field) ? (
|
return isFieldNumber(field) ? (
|
||||||
<FormNumberFieldInput
|
<FormNumberFieldInput
|
||||||
label={field.label}
|
label={field.label}
|
||||||
defaultValue={defaultValue as string | number | undefined}
|
defaultValue={defaultValue as string | number | undefined}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder={field.label}
|
|
||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
) : isFieldBoolean(field) ? (
|
) : isFieldBoolean(field) ? (
|
||||||
<FormBooleanFieldInput
|
<FormBooleanFieldInput
|
||||||
@ -79,9 +81,9 @@ export const FormFieldInput = ({
|
|||||||
label={field.label}
|
label={field.label}
|
||||||
defaultValue={defaultValue as string | undefined}
|
defaultValue={defaultValue as string | undefined}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder={field.label}
|
|
||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
) : isFieldSelect(field) ? (
|
) : isFieldSelect(field) ? (
|
||||||
<FormSelectFieldInput
|
<FormSelectFieldInput
|
||||||
@ -92,7 +94,7 @@ export const FormFieldInput = ({
|
|||||||
options={field.metadata.options}
|
options={field.metadata.options}
|
||||||
clearLabel={field.label}
|
clearLabel={field.label}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
placeholder={field.label}
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
) : isFieldFullName(field) ? (
|
) : isFieldFullName(field) ? (
|
||||||
<FormFullNameFieldInput
|
<FormFullNameFieldInput
|
||||||
@ -141,6 +143,7 @@ export const FormFieldInput = ({
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
) : isFieldDateTime(field) ? (
|
) : isFieldDateTime(field) ? (
|
||||||
<FormDateTimeFieldInput
|
<FormDateTimeFieldInput
|
||||||
@ -158,25 +161,25 @@ export const FormFieldInput = ({
|
|||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
options={field.metadata.options}
|
options={field.metadata.options}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
placeholder={field.label}
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
) : isFieldRawJson(field) ? (
|
) : isFieldRawJson(field) ? (
|
||||||
<FormRawJsonFieldInput
|
<FormRawJsonFieldInput
|
||||||
label={field.label}
|
label={field.label}
|
||||||
defaultValue={defaultValue as string | undefined}
|
defaultValue={defaultValue as string | undefined}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder={field.label}
|
|
||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
) : isFieldUuid(field) ? (
|
) : isFieldUuid(field) ? (
|
||||||
<FormUuidFieldInput
|
<FormUuidFieldInput
|
||||||
label={field.label}
|
label={field.label}
|
||||||
defaultValue={defaultValue as string | null | undefined}
|
defaultValue={defaultValue as string | null | undefined}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
placeholder={field.label}
|
|
||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
) : isFieldCurrency(field) ? (
|
) : isFieldCurrency(field) ? (
|
||||||
<FormCurrencyFieldInput
|
<FormCurrencyFieldInput
|
||||||
|
|||||||
@ -7,6 +7,7 @@ type FormDateFieldInputProps = {
|
|||||||
onChange: (value: string | null) => void;
|
onChange: (value: string | null) => void;
|
||||||
VariablePicker?: VariablePickerComponent;
|
VariablePicker?: VariablePickerComponent;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FormDateFieldInput = ({
|
export const FormDateFieldInput = ({
|
||||||
@ -15,6 +16,7 @@ export const FormDateFieldInput = ({
|
|||||||
onChange,
|
onChange,
|
||||||
VariablePicker,
|
VariablePicker,
|
||||||
readonly,
|
readonly,
|
||||||
|
placeholder,
|
||||||
}: FormDateFieldInputProps) => {
|
}: FormDateFieldInputProps) => {
|
||||||
return (
|
return (
|
||||||
<FormDateTimeFieldInput
|
<FormDateTimeFieldInput
|
||||||
@ -24,6 +26,7 @@ export const FormDateFieldInput = ({
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
|
placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -29,8 +29,8 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { Nullable, TEXT_INPUT_STYLE } from 'twenty-ui';
|
|
||||||
import { isDefined } from 'twenty-shared/utils';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
import { Nullable, TEXT_INPUT_STYLE } from 'twenty-ui';
|
||||||
|
|
||||||
const StyledInputContainer = styled(FormFieldInputInputContainer)`
|
const StyledInputContainer = styled(FormFieldInputInputContainer)`
|
||||||
display: grid;
|
display: grid;
|
||||||
@ -77,9 +77,9 @@ type DraftValue =
|
|||||||
type FormDateTimeFieldInputProps = {
|
type FormDateTimeFieldInputProps = {
|
||||||
dateOnly?: boolean;
|
dateOnly?: boolean;
|
||||||
label?: string;
|
label?: string;
|
||||||
placeholder?: string;
|
|
||||||
defaultValue: string | undefined;
|
defaultValue: string | undefined;
|
||||||
onChange: (value: string | null) => void;
|
onChange: (value: string | null) => void;
|
||||||
|
placeholder?: string;
|
||||||
VariablePicker?: VariablePickerComponent;
|
VariablePicker?: VariablePickerComponent;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
};
|
};
|
||||||
@ -91,6 +91,7 @@ export const FormDateTimeFieldInput = ({
|
|||||||
onChange,
|
onChange,
|
||||||
VariablePicker,
|
VariablePicker,
|
||||||
readonly,
|
readonly,
|
||||||
|
placeholder,
|
||||||
}: FormDateTimeFieldInputProps) => {
|
}: FormDateTimeFieldInputProps) => {
|
||||||
const { timeZone } = useContext(UserContext);
|
const { timeZone } = useContext(UserContext);
|
||||||
|
|
||||||
@ -149,7 +150,8 @@ export const FormDateTimeFieldInput = ({
|
|||||||
const displayDatePicker =
|
const displayDatePicker =
|
||||||
draftValue.type === 'static' && draftValue.mode === 'edit';
|
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({
|
useListenClickOutside({
|
||||||
refs: [datePickerWrapperRef],
|
refs: [datePickerWrapperRef],
|
||||||
@ -340,7 +342,7 @@ export const FormDateTimeFieldInput = ({
|
|||||||
<>
|
<>
|
||||||
<StyledDateInput
|
<StyledDateInput
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={placeholder}
|
placeholder={placeholderToDisplay}
|
||||||
value={inputDateTime}
|
value={inputDateTime}
|
||||||
onFocus={handleInputFocus}
|
onFocus={handleInputFocus}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ type FormLinksFieldInputProps = {
|
|||||||
onChange: (value: FieldLinksValue) => void;
|
onChange: (value: FieldLinksValue) => void;
|
||||||
VariablePicker?: VariablePickerComponent;
|
VariablePicker?: VariablePickerComponent;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FormLinksFieldInput = ({
|
export const FormLinksFieldInput = ({
|
||||||
@ -20,6 +21,7 @@ export const FormLinksFieldInput = ({
|
|||||||
onChange,
|
onChange,
|
||||||
readonly,
|
readonly,
|
||||||
VariablePicker,
|
VariablePicker,
|
||||||
|
placeholder,
|
||||||
}: FormLinksFieldInputProps) => {
|
}: FormLinksFieldInputProps) => {
|
||||||
const handleChange =
|
const handleChange =
|
||||||
(field: keyof FieldLinksDraftValue) => (updatedLinksPart: string) => {
|
(field: keyof FieldLinksDraftValue) => (updatedLinksPart: string) => {
|
||||||
@ -40,7 +42,7 @@ export const FormLinksFieldInput = ({
|
|||||||
label="Primary Link Label"
|
label="Primary Link Label"
|
||||||
defaultValue={defaultValue?.primaryLinkLabel}
|
defaultValue={defaultValue?.primaryLinkLabel}
|
||||||
onChange={handleChange('primaryLinkLabel')}
|
onChange={handleChange('primaryLinkLabel')}
|
||||||
placeholder={'Primary Link Label'}
|
placeholder={placeholder ?? 'Primary Link Label'}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
/>
|
/>
|
||||||
@ -48,7 +50,7 @@ export const FormLinksFieldInput = ({
|
|||||||
label="Primary Link URL"
|
label="Primary Link URL"
|
||||||
defaultValue={defaultValue?.primaryLinkUrl}
|
defaultValue={defaultValue?.primaryLinkUrl}
|
||||||
onChange={handleChange('primaryLinkUrl')}
|
onChange={handleChange('primaryLinkUrl')}
|
||||||
placeholder={'Primary Link URL'}
|
placeholder={placeholder ?? 'Primary Link URL'}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
VariablePicker={VariablePicker}
|
VariablePicker={VariablePicker}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -10,11 +10,11 @@ import { InputLabel } from '@/ui/input/components/InputLabel';
|
|||||||
import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString';
|
import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useId, useState } from 'react';
|
import { useId, useState } from 'react';
|
||||||
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
import {
|
import {
|
||||||
canBeCastAsNumberOrNull,
|
canBeCastAsNumberOrNull,
|
||||||
castAsNumberOrNull,
|
castAsNumberOrNull,
|
||||||
} from '~/utils/cast-as-number-or-null';
|
} from '~/utils/cast-as-number-or-null';
|
||||||
import { isDefined } from 'twenty-shared/utils';
|
|
||||||
|
|
||||||
const StyledInput = styled(TextInput)`
|
const StyledInput = styled(TextInput)`
|
||||||
padding: ${({ theme }) => `${theme.spacing(1)} ${theme.spacing(2)}`};
|
padding: ${({ theme }) => `${theme.spacing(1)} ${theme.spacing(2)}`};
|
||||||
@ -23,13 +23,13 @@ const StyledInput = styled(TextInput)`
|
|||||||
type FormNumberFieldInputProps = {
|
type FormNumberFieldInputProps = {
|
||||||
label?: string;
|
label?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
placeholder: string;
|
|
||||||
defaultValue: number | string | undefined;
|
defaultValue: number | string | undefined;
|
||||||
onChange: (value: number | null | string) => void;
|
onChange: (value: number | null | string) => void;
|
||||||
onBlur?: () => void;
|
onBlur?: () => void;
|
||||||
VariablePicker?: VariablePickerComponent;
|
VariablePicker?: VariablePickerComponent;
|
||||||
hint?: string;
|
hint?: string;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FormNumberFieldInput = ({
|
export const FormNumberFieldInput = ({
|
||||||
@ -115,7 +115,7 @@ export const FormNumberFieldInput = ({
|
|||||||
{draftValue.type === 'static' ? (
|
{draftValue.type === 'static' ? (
|
||||||
<StyledInput
|
<StyledInput
|
||||||
inputId={inputId}
|
inputId={inputId}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder ?? 'Enter a number'}
|
||||||
value={draftValue.value}
|
value={draftValue.value}
|
||||||
copyButton={false}
|
copyButton={false}
|
||||||
hotkeyScope="record-create"
|
hotkeyScope="record-create"
|
||||||
|
|||||||
@ -6,16 +6,16 @@ import { useTextVariableEditor } from '@/object-record/record-field/form-types/h
|
|||||||
import { VariablePickerComponent } from '@/object-record/record-field/form-types/types/VariablePickerComponent';
|
import { VariablePickerComponent } from '@/object-record/record-field/form-types/types/VariablePickerComponent';
|
||||||
import { InputLabel } from '@/ui/input/components/InputLabel';
|
import { InputLabel } from '@/ui/input/components/InputLabel';
|
||||||
import { useId } from 'react';
|
import { useId } from 'react';
|
||||||
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
|
|
||||||
import { isDefined } from 'twenty-shared/utils';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
|
||||||
|
|
||||||
type FormRawJsonFieldInputProps = {
|
type FormRawJsonFieldInputProps = {
|
||||||
label?: string;
|
label?: string;
|
||||||
defaultValue: string | null | undefined;
|
defaultValue: string | null | undefined;
|
||||||
placeholder: string;
|
|
||||||
onChange: (value: string | null) => void;
|
onChange: (value: string | null) => void;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
VariablePicker?: VariablePickerComponent;
|
VariablePicker?: VariablePickerComponent;
|
||||||
|
placeholder?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FormRawJsonFieldInput = ({
|
export const FormRawJsonFieldInput = ({
|
||||||
@ -29,7 +29,7 @@ export const FormRawJsonFieldInput = ({
|
|||||||
const inputId = useId();
|
const inputId = useId();
|
||||||
|
|
||||||
const editor = useTextVariableEditor({
|
const editor = useTextVariableEditor({
|
||||||
placeholder,
|
placeholder: placeholder ?? 'Enter a JSON object',
|
||||||
multiline: true,
|
multiline: true,
|
||||||
readonly,
|
readonly,
|
||||||
defaultValue: defaultValue ?? undefined,
|
defaultValue: defaultValue ?? undefined,
|
||||||
|
|||||||
@ -16,11 +16,11 @@ type FormTextFieldInputProps = {
|
|||||||
error?: string;
|
error?: string;
|
||||||
hint?: string;
|
hint?: string;
|
||||||
defaultValue: string | undefined;
|
defaultValue: string | undefined;
|
||||||
placeholder: string;
|
|
||||||
onChange: (value: string) => void;
|
onChange: (value: string) => void;
|
||||||
onBlur?: () => void;
|
onBlur?: () => void;
|
||||||
multiline?: boolean;
|
multiline?: boolean;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
VariablePicker?: VariablePickerComponent;
|
VariablePicker?: VariablePickerComponent;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ export const FormTextFieldInput = ({
|
|||||||
const inputId = useId();
|
const inputId = useId();
|
||||||
|
|
||||||
const editor = useTextVariableEditor({
|
const editor = useTextVariableEditor({
|
||||||
placeholder,
|
placeholder: placeholder ?? 'Enter text',
|
||||||
multiline,
|
multiline,
|
||||||
readonly,
|
readonly,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
|
|||||||
@ -17,10 +17,10 @@ const StyledInput = styled(TextInput)`
|
|||||||
type FormUuidFieldInputProps = {
|
type FormUuidFieldInputProps = {
|
||||||
label?: string;
|
label?: string;
|
||||||
defaultValue: string | null | undefined;
|
defaultValue: string | null | undefined;
|
||||||
placeholder: string;
|
|
||||||
onChange: (value: string | null) => void;
|
onChange: (value: string | null) => void;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
VariablePicker?: VariablePickerComponent;
|
VariablePicker?: VariablePickerComponent;
|
||||||
|
placeholder?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FormUuidFieldInput = ({
|
export const FormUuidFieldInput = ({
|
||||||
@ -100,7 +100,7 @@ export const FormUuidFieldInput = ({
|
|||||||
{draftValue.type === 'static' ? (
|
{draftValue.type === 'static' ? (
|
||||||
<StyledInput
|
<StyledInput
|
||||||
inputId={inputId}
|
inputId={inputId}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder ?? 'Enter a UUID'}
|
||||||
value={draftValue.value}
|
value={draftValue.value}
|
||||||
copyButton={false}
|
copyButton={false}
|
||||||
hotkeyScope="record-create"
|
hotkeyScope="record-create"
|
||||||
|
|||||||
@ -18,9 +18,10 @@ import { useEffect, useState } from 'react';
|
|||||||
import { IconChevronDown, IconPlus, IconTrash, useIcons } from 'twenty-ui';
|
import { IconChevronDown, IconPlus, IconTrash, useIcons } from 'twenty-ui';
|
||||||
import { useDebouncedCallback } from 'use-debounce';
|
import { useDebouncedCallback } from 'use-debounce';
|
||||||
|
|
||||||
import { v4 } from 'uuid';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
import { FieldMetadataType } from 'twenty-shared/types';
|
import { FieldMetadataType } from 'twenty-shared/types';
|
||||||
import { isDefined } from 'twenty-shared/utils';
|
import { isDefined } from 'twenty-shared/utils';
|
||||||
|
import { v4 } from 'uuid';
|
||||||
|
|
||||||
export type WorkflowEditActionFormBuilderProps = {
|
export type WorkflowEditActionFormBuilderProps = {
|
||||||
action: WorkflowFormAction;
|
action: WorkflowFormAction;
|
||||||
@ -185,7 +186,12 @@ export const WorkflowEditActionFormBuilder = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<StyledFieldContainer>
|
<StyledFieldContainer>
|
||||||
<StyledPlaceholder>{field.placeholder}</StyledPlaceholder>
|
<StyledPlaceholder>
|
||||||
|
{isDefined(field.placeholder) &&
|
||||||
|
isNonEmptyString(field.placeholder)
|
||||||
|
? field.placeholder
|
||||||
|
: getDefaultFormFieldSettings(field.type).placeholder}
|
||||||
|
</StyledPlaceholder>
|
||||||
{!isFieldSelected(field.id) && (
|
{!isFieldSelected(field.id) && (
|
||||||
<IconChevronDown
|
<IconChevronDown
|
||||||
size={theme.icon.size.md}
|
size={theme.icon.size.md}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { WorkflowStepHeader } from '@/workflow/workflow-steps/components/Workflo
|
|||||||
import { useUpdateWorkflowRunStep } from '@/workflow/workflow-steps/hooks/useUpdateWorkflowRunStep';
|
import { useUpdateWorkflowRunStep } from '@/workflow/workflow-steps/hooks/useUpdateWorkflowRunStep';
|
||||||
import { useSubmitFormStep } from '@/workflow/workflow-steps/workflow-actions/form-action/hooks/useSubmitFormStep';
|
import { useSubmitFormStep } from '@/workflow/workflow-steps/workflow-actions/form-action/hooks/useSubmitFormStep';
|
||||||
import { WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';
|
import { WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';
|
||||||
|
import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';
|
||||||
import { getActionIcon } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIcon';
|
import { getActionIcon } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIcon';
|
||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
@ -129,6 +130,10 @@ export const WorkflowEditActionFormFiller = ({
|
|||||||
}}
|
}}
|
||||||
defaultValue={field.value ?? ''}
|
defaultValue={field.value ?? ''}
|
||||||
readonly={actionOptions.readonly}
|
readonly={actionOptions.readonly}
|
||||||
|
placeholder={
|
||||||
|
field.placeholder ??
|
||||||
|
getDefaultFormFieldSettings(field.type).placeholder
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</WorkflowStepBody>
|
</WorkflowStepBody>
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { FormFieldInputContainer } from '@/object-record/record-field/form-types/components/FormFieldInputContainer';
|
import { FormFieldInputContainer } from '@/object-record/record-field/form-types/components/FormFieldInputContainer';
|
||||||
import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput';
|
import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput';
|
||||||
import { InputLabel } from '@/ui/input/components/InputLabel';
|
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 styled from '@emotion/styled';
|
||||||
import { t } from '@lingui/core/macro';
|
import { FieldMetadataType } from 'twenty-shared/types';
|
||||||
|
|
||||||
type WorkflowFormFieldSettingsNumberProps = {
|
type WorkflowFormFieldSettingsNumberProps = {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -29,8 +30,10 @@ export const WorkflowFormFieldSettingsNumber = ({
|
|||||||
onChange={(newLabel: string | null) => {
|
onChange={(newLabel: string | null) => {
|
||||||
onChange('label', newLabel);
|
onChange('label', newLabel);
|
||||||
}}
|
}}
|
||||||
defaultValue={label ?? t`Number`}
|
defaultValue={label}
|
||||||
placeholder={t`Text`}
|
placeholder={
|
||||||
|
getDefaultFormFieldSettings(FieldMetadataType.NUMBER).label
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</FormFieldInputContainer>
|
</FormFieldInputContainer>
|
||||||
<FormFieldInputContainer>
|
<FormFieldInputContainer>
|
||||||
@ -39,8 +42,10 @@ export const WorkflowFormFieldSettingsNumber = ({
|
|||||||
onChange={(newPlaceholder: string | null) => {
|
onChange={(newPlaceholder: string | null) => {
|
||||||
onChange('placeholder', newPlaceholder);
|
onChange('placeholder', newPlaceholder);
|
||||||
}}
|
}}
|
||||||
defaultValue={placeholder ?? '1000'}
|
defaultValue={placeholder}
|
||||||
placeholder={'1000'}
|
placeholder={
|
||||||
|
getDefaultFormFieldSettings(FieldMetadataType.NUMBER).placeholder
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</FormFieldInputContainer>
|
</FormFieldInputContainer>
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import { FormFieldInputContainer } from '@/object-record/record-field/form-types/components/FormFieldInputContainer';
|
import { FormFieldInputContainer } from '@/object-record/record-field/form-types/components/FormFieldInputContainer';
|
||||||
import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput';
|
import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput';
|
||||||
import { InputLabel } from '@/ui/input/components/InputLabel';
|
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 styled from '@emotion/styled';
|
||||||
|
import { FieldMetadataType } from 'twenty-shared/types';
|
||||||
|
|
||||||
type WorkflowFormFieldSettingsTextProps = {
|
type WorkflowFormFieldSettingsTextProps = {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -29,7 +31,9 @@ export const WorkflowFormFieldSettingsText = ({
|
|||||||
onChange('label', newLabel);
|
onChange('label', newLabel);
|
||||||
}}
|
}}
|
||||||
defaultValue={label}
|
defaultValue={label}
|
||||||
placeholder={'Text'}
|
placeholder={
|
||||||
|
getDefaultFormFieldSettings(FieldMetadataType.TEXT).label
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</FormFieldInputContainer>
|
</FormFieldInputContainer>
|
||||||
<FormFieldInputContainer>
|
<FormFieldInputContainer>
|
||||||
@ -39,7 +43,9 @@ export const WorkflowFormFieldSettingsText = ({
|
|||||||
onChange('placeholder', newPlaceholder);
|
onChange('placeholder', newPlaceholder);
|
||||||
}}
|
}}
|
||||||
defaultValue={placeholder}
|
defaultValue={placeholder}
|
||||||
placeholder={'Enter your text'}
|
placeholder={
|
||||||
|
getDefaultFormFieldSettings(FieldMetadataType.TEXT).placeholder
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</FormFieldInputContainer>
|
</FormFieldInputContainer>
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
|
|||||||
@ -94,7 +94,7 @@ export const ReadonlyMode: Story = {
|
|||||||
const textField = await canvas.findByText('Text Field');
|
const textField = await canvas.findByText('Text Field');
|
||||||
expect(textField).toBeVisible();
|
expect(textField).toBeVisible();
|
||||||
|
|
||||||
const numberInput = await canvas.findByPlaceholderText('Number Field');
|
const numberInput = await canvas.findByPlaceholderText('Enter number');
|
||||||
expect(numberInput).toBeDisabled();
|
expect(numberInput).toBeDisabled();
|
||||||
|
|
||||||
const submitButton = await canvas.queryByText('Submit');
|
const submitButton = await canvas.queryByText('Submit');
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export const RecordShowPage = () => {
|
|||||||
objectRecordId: string;
|
objectRecordId: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { objectNameSingular, objectRecordId, headerIcon } = useRecordShowPage(
|
const { objectNameSingular, objectRecordId } = useRecordShowPage(
|
||||||
parameters.objectNameSingular ?? '',
|
parameters.objectNameSingular ?? '',
|
||||||
parameters.objectRecordId ?? '',
|
parameters.objectRecordId ?? '',
|
||||||
);
|
);
|
||||||
@ -55,7 +55,6 @@ export const RecordShowPage = () => {
|
|||||||
<RecordShowPageHeader
|
<RecordShowPageHeader
|
||||||
objectNameSingular={objectNameSingular}
|
objectNameSingular={objectNameSingular}
|
||||||
objectRecordId={objectRecordId}
|
objectRecordId={objectRecordId}
|
||||||
headerIcon={headerIcon}
|
|
||||||
>
|
>
|
||||||
<RecordShowActionMenu />
|
<RecordShowActionMenu />
|
||||||
</RecordShowPageHeader>
|
</RecordShowPageHeader>
|
||||||
|
|||||||
@ -13,7 +13,6 @@ export const RecordShowPageHeader = ({
|
|||||||
}: {
|
}: {
|
||||||
objectNameSingular: string;
|
objectNameSingular: string;
|
||||||
objectRecordId: string;
|
objectRecordId: string;
|
||||||
headerIcon: React.ComponentType;
|
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
}) => {
|
}) => {
|
||||||
const { viewName, navigateToIndexView, objectMetadataItem } =
|
const { viewName, navigateToIndexView, objectMetadataItem } =
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export const STANDARD_OBJECT_ICONS = {
|
|||||||
webhook: 'IconRobot',
|
webhook: 'IconRobot',
|
||||||
workflow: 'IconSettingsAutomation',
|
workflow: 'IconSettingsAutomation',
|
||||||
workflowEventListener: 'IconSettingsAutomation',
|
workflowEventListener: 'IconSettingsAutomation',
|
||||||
workflowRun: 'IconSettingsAutomation',
|
workflowRun: 'IconHistoryToggle',
|
||||||
workflowVersion: 'IconSettingsAutomation',
|
workflowVersion: 'IconVersions',
|
||||||
workspaceMember: 'IconUserCircle',
|
workspaceMember: 'IconUserCircle',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user