Update label render condition

This commit is contained in:
Prajwal Kulkarni
2024-02-07 21:31:51 +05:30
parent c08768a330
commit 4855882ae6
2 changed files with 6 additions and 6 deletions

View File

@ -244,6 +244,7 @@ export const SinglePlayerClient = () => {
recipients={uploadedFile ? [placeholderRecipient] : []}
fields={fields}
onSubmit={onFieldsSubmit}
isSinglePlayerMode={true}
/>
</fieldset>

View File

@ -53,6 +53,7 @@ export type AddFieldsFormProps = {
recipients: Recipient[];
fields: Field[];
onSubmit: (_data: TAddFieldsFormSchema) => void;
isSinglePlayerMode?: boolean;
};
export const AddFieldsFormPartial = ({
@ -61,10 +62,12 @@ export const AddFieldsFormPartial = ({
recipients,
fields,
onSubmit,
isSinglePlayerMode = false,
}: AddFieldsFormProps) => {
const { isWithinPageBounds, getFieldPosition, getPage } = useDocumentElement();
const { currentStep, totalSteps, previousStep } = useStep();
const canRenderBackButtonAsRemove =
currentStep === 1 && typeof documentFlow.onBackStep === 'function' && isSinglePlayerMode;
const {
control,
handleSubmit,
@ -568,11 +571,7 @@ export const AddFieldsFormPartial = ({
remove();
documentFlow.onBackStep?.();
}}
goBackLabel={
currentStep === 1 && typeof documentFlow.onBackStep === 'function'
? 'Remove'
: undefined
}
goBackLabel={canRenderBackButtonAsRemove ? 'Remove' : undefined}
onGoNextClick={() => void onFormSubmit()}
/>
</DocumentFlowFormContainerFooter>