Skip to content

feat(drive-integration): Replace Add Entry wizard with single-screen form [INTEG-4524]#11110

Open
JuliRossi wants to merge 4 commits into
masterfrom
INTEG-4524-add-entry-form-ui
Open

feat(drive-integration): Replace Add Entry wizard with single-screen form [INTEG-4524]#11110
JuliRossi wants to merge 4 commits into
masterfrom
INTEG-4524-add-entry-form-ui

Conversation

@JuliRossi

@JuliRossi JuliRossi commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace multi-step AddEntryWizard with a single-screen AddEntryForm (content type, Yes/No reference radios, conditional entry/field selects, field multiselect).
  • Simplify EditModal footer to Back + Save (no Next) while the add-entry form is open.
  • Disable Yes when the selected new content type has no Entry reference fields (pre–child-reference semantics).

Note: This PR does not change who owns the reference link. The new entry still holds __ref and edges are still from=new → to=existing. Child-of-parent linking lands in the follow-up PR stacked on this branch.

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

  • Open Add entry from Edit content mapping → single form (no wizard steps / no Next)
  • Before content type: only content type select is shown
  • After content type: radios + field multiselect appear together
  • Yes → entry select (+ reference field select when the new CT has >1 ref fields)
  • No → no entry/ref-field selects; field multiselect remains
  • Content type with no Entry ref fields → Yes disabled, No still works
  • Save creates entry and maps selected fields

Made with Cursor

JuliRossi and others added 2 commits July 20, 2026 15:19
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>
@JuliRossi
JuliRossi requested review from a team as code owners July 21, 2026 19:51
@JuliRossi JuliRossi changed the title refactor(drive-integration): replace Add Entry wizard with single-screen form [INTEG-4524] feat(drive-integration): Replace Add Entry wizard with single-screen form [INTEG-4524] Jul 22, 2026
@david-shibley-contentful

Copy link
Copy Markdown
Contributor

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.

@FBanfi Franco Banfi (FBanfi) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Leaving the approval on my side!

Comment on lines +7 to +72
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,
};
};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we could make a utils file and move all this logic there to clean a bit the component.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@JuliRossi

Copy link
Copy Markdown
Collaborator Author

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.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants