Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add a flag for first stage of form #1183

Merged
merged 11 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/form-components/FormTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function FormTemplate({ currentUser, request, alert }: Props) {

const showFormButtons = formStage !== 0 || formData.usesTeam || formData.projectLead;
const isLastStage = formStage === schemas.length - 1;
const isFirstStage = formStage === 0;
const schema = schemas[formStage] || {};

const throttleUpdate = useCallback(
Expand Down Expand Up @@ -387,10 +388,12 @@ function FormTemplate({ currentUser, request, alert }: Props) {
const backButton = isApplied ? <CancelConfirmModal onConfirm={handleBackClick} /> : null;
const buttonTexts = { continue: '', back: '' };
const hasDigitalCredential = formData.devIdps?.includes('digitalcredential');

if (isLastStage) {
buttonTexts.continue = isApplied ? 'Update' : 'Submit';
buttonTexts.back = isApplied ? 'Cancel' : 'Save and Close';
} else if (isFirstStage && isNew) {
buttonTexts.continue = 'Next';
buttonTexts.back = isApplied ? 'Cancel' : 'Close';
} else {
buttonTexts.continue = 'Next';
buttonTexts.back = isApplied ? 'Cancel' : 'Save and Close';
Expand Down
Loading