Skip to content

Commit

Permalink
Merge pull request #1267 from Chia-Network/refactor/fix/1258-1259-126…
Browse files Browse the repository at this point in the history
…0-1261

Refactor/fix/1258 1259 1260 1261
  • Loading branch information
wwills2 authored May 23, 2024
2 parents 1c9c801 + 4683aad commit 90cf192
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/renderer/components/blocks/forms/UnitForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function removeNullFields(obj) {
}

const validationSchema = yup.object({
unitOwner: yup.string().required('Unit Owner is required'),
unitOwner: yup.string(),
unitBlockStart: yup.string().required('Unit Block Start is required'),
unitBlockEnd: yup.string().required('Unit Block End is required'),
unitCount: yup.number().required('Unit Count is required').positive('Unit Count must be positive'),
Expand All @@ -53,7 +53,7 @@ const validationSchema = yup.object({
.required('Vintage Year is required')
.min(1901, 'Vintage Year must be after 1900')
.max(2155, 'Vintage Year must be before 2156'),
unitRegistryLink: yup.string().url('Must be a valid URL'),
unitRegistryLink: yup.string().url('Must be a valid URL').required(),
marketplace: yup.string(),
marketplaceIdentifier: yup.string(),
marketplaceLink: yup.string().url('Must be a valid URL'),
Expand Down Expand Up @@ -147,7 +147,6 @@ const UnitForm = forwardRef<UnitFormRef, UnitFormProps>(({ readonly = false, dat
return <ComponentCenteredSpinner label="Loading Selected Project Data" />;
}


return (
<Formik innerRef={formikRef} initialValues={removeNullFields(unit || {})} validationSchema={validationSchema} onSubmit={() => {}}>
{() => (
Expand Down Expand Up @@ -185,7 +184,6 @@ const UnitForm = forwardRef<UnitFormRef, UnitFormProps>(({ readonly = false, dat
label="Unit Owner"
type="text"
readonly={readonly}
required={true}
initialValue={unit?.unitOwner || ''}
/>
<Field
Expand Down Expand Up @@ -228,8 +226,7 @@ const UnitForm = forwardRef<UnitFormRef, UnitFormProps>(({ readonly = false, dat
<Field
name="inCountryJurisdictionOfOwner"
label="In-Country Jurisdiction Of Owner"
type="picklist"
options={picklistOptions?.countries}
type="text"
readonly={readonly}
required={true}
initialValue={unit?.inCountryJurisdictionOfOwner || ''}
Expand Down Expand Up @@ -279,6 +276,7 @@ const UnitForm = forwardRef<UnitFormRef, UnitFormProps>(({ readonly = false, dat
type="link"
readonly={readonly}
initialValue={unit?.unitRegistryLink || ''}
required={true}
/>
</div>
</Card>
Expand Down
4 changes: 1 addition & 3 deletions src/renderer/components/blocks/modals/UpsertUnitModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ const UpsertUnitModal: React.FC<UpsertModalProps> = ({ onClose }: UpsertModalPro
return;
}

console.log('Form submission values:', values);

if (values) {
setUnitFormData({ ...unitFormData, ...values });
}
Expand Down Expand Up @@ -207,7 +205,7 @@ const UpsertUnitModal: React.FC<UpsertModalProps> = ({ onClose }: UpsertModalPro
{activeStep !== steps.length - 1 ? (
<FormattedMessage id="next" />
) : (
<FormattedMessage id={createUnitModalActive ? 'create-project' : 'edit-project'} />
<FormattedMessage id={createUnitModalActive ? 'create-unit' : 'edit-unit'} />
)}
</Button>
</div>
Expand Down

0 comments on commit 90cf192

Please sign in to comment.