Fix workflow date fields (#19210)

Before: broken on forms, missing border right, no fullWidth, not
properly saved
<img width="220" height="160" alt="Capture d’écran 2026-03-31 à 17 10
47"
src="https://github.com/user-attachments/assets/4143fcb7-909f-42a3-b05e-39185395f657"
/> <img width="231" height="102" alt="Capture d’écran 2026-03-31 à 17
11 05"
src="https://github.com/user-attachments/assets/3989f6b8-ef8a-42a3-9ccc-35a9be1fb67f"
/>
<img width="230" height="75" alt="Capture d’écran 2026-03-31 à 17 12
15"
src="https://github.com/user-attachments/assets/67f5f93f-887f-4e3b-95c2-f5076f41fb21"
/>

After: save and validate on edition, fix design
<img width="231" height="132" alt="Capture d’écran 2026-03-31 à 17 15
08"
src="https://github.com/user-attachments/assets/d1aa0a64-499d-479d-8d5c-e5e104ad6464"
/>
<img width="231" height="75" alt="Capture d’écran 2026-03-31 à 17 15
33"
src="https://github.com/user-attachments/assets/8d668713-8466-4e81-8901-4b12b9271244"
/>
<img width="461" height="156" alt="Capture d’écran 2026-03-31 à 17 14
54"
src="https://github.com/user-attachments/assets/f9d33242-f1cc-48f7-9f63-322799e1f9b8"
/>

Simplifying FormDateInput using the existing DatePicker
This commit is contained in:
Thomas Trompette
2026-04-01 16:44:24 +02:00
committed by GitHub
parent a0c6727a61
commit 19dd4d6c1b
6 changed files with 153 additions and 306 deletions
@@ -14,8 +14,8 @@ import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/Workflo
import { WorkflowEditActionFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings';
import { type WorkflowFormActionField } from '@/workflow/workflow-steps/workflow-actions/form-action/types/WorkflowFormActionField';
import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';
import { styled } from '@linaria/react';
import { type OnDragEndResponder } from '@hello-pangea/dnd';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { isNonEmptyString } from '@sniptt/guards';
import { useContext, useEffect, useState } from 'react';
@@ -30,9 +30,9 @@ import {
IconTrash,
} from 'twenty-ui/display';
import { LightIconButton } from 'twenty-ui/input';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useDebouncedCallback } from 'use-debounce';
import { v4 } from 'uuid';
import { themeCssVariables, ThemeContext } from 'twenty-ui/theme-constants';
export type WorkflowEditActionFormBuilderProps = {
triggerType: WorkflowTriggerType | undefined;
@@ -98,9 +98,10 @@ const StyledFieldContainer = styled.div<{
cursor: ${({ readonly }) => (readonly ? 'default' : 'pointer')};
display: flex;
font-family: inherit;
height: 100%;
padding-left: ${themeCssVariables.spacing[2]};
padding-right: ${themeCssVariables.spacing[2]};
padding-right: ${themeCssVariables.spacing[2]};
width: 100%;
&:hover,
@@ -81,43 +81,6 @@ const mockAction: WorkflowFormAction = {
},
};
// TEMP_DISABLED_TEST: Commented out unused mock data
// const mockActionWithDuplicatedRecordFields: WorkflowFormAction = {
// id: 'form-action-1',
// type: 'FORM',
// name: 'Test Form',
// valid: true,
// settings: {
// input: [
// {
// id: 'field-1',
// name: 'record',
// label: 'Record',
// type: 'RECORD',
// placeholder: 'Select a record',
// settings: {
// objectName: 'company',
// },
// },
// {
// id: 'field-2',
// name: 'record',
// label: 'Record',
// type: 'RECORD',
// placeholder: 'Select a record',
// settings: {
// objectName: 'company',
// },
// },
// ],
// outputSchema: {},
// errorHandlingOptions: {
// retryOnFailure: { value: false },
// continueOnFailure: { value: false },
// },
// },
// };
export const Default: Story = {
args: {
action: mockAction,
@@ -158,45 +121,7 @@ export const ReadonlyMode: Story = {
const numberInput = await canvas.findByPlaceholderText('Enter number');
expect(numberInput).toBeDisabled();
const dateInput = await canvas.findByPlaceholderText('mm/dd/yyyy');
expect(dateInput).toBeDisabled();
const submitButton = canvas.queryByText('Submit');
expect(submitButton).not.toBeInTheDocument();
},
};
// TEMP_DISABLED_TEST: Temporarily commented out due to test failure
// export const CanHaveManyRecordFieldsForTheSameRecordType: Story = {
// args: {
// action: mockActionWithDuplicatedRecordFields,
// actionOptions: {
// readonly: false,
// },
// },
// play: async ({ canvasElement }) => {
// const canvas = within(canvasElement);
// const recordSelects = await waitFor(() => {
// const elements = canvas.getAllByText('Select a company');
// expect(elements.length).toBe(2);
// return elements;
// });
// for (const recordSelect of recordSelects) {
// expect(recordSelect).toBeVisible();
// await userEvent.click(recordSelect);
// await waitFor(() => {
// expect(
// within(document.body).getByText('Louis Duss'),
// ).toBeVisible();
// });
// await userEvent.click(canvasElement);
// }
// },
// };