Skip to content

Commit 1feaf24

Browse files
committed
refactor: pass group form props as data
1 parent b63769e commit 1feaf24

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

apps/web/src/features/group/components/ManageGroupForm.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,21 @@ export type AvailableInstrumentOptions = {
1414
};
1515

1616
export type ManageGroupFormProps = {
17-
availableInstrumentOptions: AvailableInstrumentOptions;
18-
initialValues: {
19-
accessibleFormInstrumentIds: Set<string>;
20-
accessibleInteractiveInstrumentIds: Set<string>;
21-
defaultIdentificationMethod?: SubjectIdentificationMethod;
22-
idValidationRegex?: null | string;
17+
data: {
18+
availableInstrumentOptions: AvailableInstrumentOptions;
19+
initialValues: {
20+
accessibleFormInstrumentIds: Set<string>;
21+
accessibleInteractiveInstrumentIds: Set<string>;
22+
defaultIdentificationMethod?: SubjectIdentificationMethod;
23+
idValidationRegex?: null | string;
24+
};
2325
};
2426
onSubmit: (data: Partial<UpdateGroupData>) => Promisable<any>;
2527
readOnly: boolean;
2628
};
2729

28-
export const ManageGroupForm = ({
29-
availableInstrumentOptions,
30-
initialValues,
31-
onSubmit,
32-
readOnly
33-
}: ManageGroupFormProps) => {
30+
export const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) => {
31+
const { availableInstrumentOptions, initialValues } = data;
3432
const { t } = useTranslation();
3533

3634
let description = t('group.manage.accessibleInstrumentsDesc');

apps/web/src/features/group/pages/ManageGroupPage.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ export const ManageGroupPage = () => {
7171
</PageHeader>
7272

7373
<ManageGroupForm
74-
availableInstrumentOptions={availableInstrumentOptions}
75-
initialValues={initialValues}
74+
data={{
75+
availableInstrumentOptions,
76+
initialValues
77+
}}
7678
readOnly={Boolean(setupState.data?.isDemo && import.meta.env.PROD)}
7779
onSubmit={async (data) => {
7880
const updatedGroup = await updateGroupMutation.mutateAsync(data);

0 commit comments

Comments
 (0)