feat(drive-integration): Replace Add Entry wizard with single-screen form [INTEG-4524]#11110
feat(drive-integration): Replace Add Entry wizard with single-screen form [INTEG-4524]#11110JuliRossi wants to merge 4 commits into
Conversation
This update refactors the EditModal component to utilize the new AddEntryForm for adding entries, simplifying the entry addition process. The AddEntryWizard has been removed, and the related state management has been adjusted accordingly. The AddEntryForm now handles the entry creation logic, including content type selection and field mapping, enhancing the user experience. Additionally, the AddEntryForm is integrated with the existing modal controls for better navigation and state management.
… type has no reference fields Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Back now wipes the entire form state (setAddEntryFormState(null)). In the wizard, Back preserved what you'd filled in. If a user is 4 fields deep and misclicks Back, they start over. Quick "is this intentional?" comment. If yes, fine, just leave it; if no, it needs a fix. |
Franco Banfi (FBanfi)
left a comment
There was a problem hiding this comment.
Looks good to me! Leaving the approval on my side!
| export interface AddEntryFormState { | ||
| contentTypeId: string; | ||
| isReference: boolean | null; | ||
| referenceEntryId: string; | ||
| referenceFieldId: string; | ||
| selectedFieldIds: string[]; | ||
| } | ||
|
|
||
| export const INITIAL_ADD_ENTRY_FORM_STATE: AddEntryFormState = { | ||
| contentTypeId: '', | ||
| isReference: null, | ||
| referenceEntryId: '', | ||
| referenceFieldId: '', | ||
| selectedFieldIds: [], | ||
| }; | ||
|
|
||
| export interface ExistingEntryOption { | ||
| tempId: string; | ||
| label: string; | ||
| } | ||
|
|
||
| const getReferenceFieldOptions = ( | ||
| contentTypes: WorkflowContentType[], | ||
| contentTypeId: string | ||
| ): EditModalFieldOption[] => { | ||
| const contentType = contentTypes.find((ct) => ct.sys.id === contentTypeId); | ||
| if (!contentType) return []; | ||
| const referenceFields = (contentType.fields ?? []).filter(isEntryReferenceField); | ||
| return buildFieldOptionsForContentType({ | ||
| ...contentType, | ||
| fields: referenceFields, | ||
| }); | ||
| }; | ||
|
|
||
| /** Returns true when the form lacks enough input to save. */ | ||
| export const isAddEntrySaveDisabled = ( | ||
| state: AddEntryFormState, | ||
| contentTypes: WorkflowContentType[] | ||
| ): boolean => { | ||
| if (!state.contentTypeId) return true; | ||
| if (state.isReference === null) return true; | ||
| if (state.isReference) { | ||
| const referenceFieldOptions = getReferenceFieldOptions(contentTypes, state.contentTypeId); | ||
| if (referenceFieldOptions.length === 0) return true; | ||
| if (!state.referenceEntryId) return true; | ||
| if (referenceFieldOptions.length > 1 && !state.referenceFieldId) return true; | ||
| } | ||
| return state.selectedFieldIds.length === 0; | ||
| }; | ||
|
|
||
| /** Maps form state to the payload expected by onAddEntry. */ | ||
| export const toAddEntryFormParams = ( | ||
| state: AddEntryFormState, | ||
| contentTypes: WorkflowContentType[] | ||
| ): AddEntryFormParams => { | ||
| const referenceFieldOptions = getReferenceFieldOptions(contentTypes, state.contentTypeId); | ||
| return { | ||
| contentTypeId: state.contentTypeId, | ||
| isReference: state.isReference ?? false, | ||
| referenceEntryId: state.isReference ? state.referenceEntryId || null : null, | ||
| referenceFieldId: state.isReference | ||
| ? state.referenceFieldId || referenceFieldOptions[0]?.id || null | ||
| : null, | ||
| fieldIds: state.selectedFieldIds, | ||
| }; | ||
| }; |
There was a problem hiding this comment.
Nit: we could make a utils file and move all this logic there to clean a bit the component.
There was a problem hiding this comment.
Will do it on a different PR so it doesn't colide with #11111
…ryForm Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Since the form is now a single screen, Back is effectively a cancel, there's no previous step to return to. The state wipe is intentional. Also you can't go 4 fields deep, since it only allows you to add an entry at a time. |
… a cancel action, not step navigation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
AddEntryWizardwith a single-screenAddEntryForm(content type, Yes/No reference radios, conditional entry/field selects, field multiselect).EditModalfooter to Back + Save (no Next) while the add-entry form is open.Grabacion.de.pantalla.2026-07-22.a.las.10.18.36.a.m.mov
Update: When a parent does not have a reference field, it doesn't appear in the multiselect or lets you select radio button
Grabacion.de.pantalla.2026-07-22.a.las.10.32.18.a.m.mov
Test plan
Made with Cursor