Skip to content

Commit 88eea9c

Browse files
committed
fix: add series instruments to manage group page
1 parent 68c58ec commit 88eea9c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

apps/web/src/routes/_app/group/manage.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type ManageGroupFormProps = {
3030
initialValues: {
3131
accessibleFormInstrumentIds: Set<string>;
3232
accessibleInteractiveInstrumentIds: Set<string>;
33+
accessibleSeriesInstrumentIds: Set<string>;
3334
defaultIdentificationMethod?: SubjectIdentificationMethod;
3435
idValidationRegex?: null | string;
3536
minimumAge?: null | number;
@@ -68,6 +69,12 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
6869
label: t('group.manage.interactive'),
6970
options: availableInstrumentOptions.interactive,
7071
variant: 'listbox'
72+
},
73+
accessibleSeriesInstrumentIds: {
74+
kind: 'set',
75+
label: t('group.manage.series'),
76+
options: availableInstrumentOptions.series,
77+
variant: 'listbox'
7178
}
7279
},
7380
title: t('group.manage.accessibleInstruments')
@@ -190,6 +197,7 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
190197
.object({
191198
accessibleFormInstrumentIds: z.set(z.string()),
192199
accessibleInteractiveInstrumentIds: z.set(z.string()),
200+
accessibleSeriesInstrumentIds: z.set(z.string()),
193201
defaultIdentificationMethod: $SubjectIdentificationMethod.optional(),
194202
idValidationRegex: $RegexString.optional(),
195203
idValidationRegexErrorMessageEn: z.string().optional(),
@@ -214,7 +222,11 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
214222
})}
215223
onSubmit={(data) => {
216224
void onSubmit({
217-
accessibleInstrumentIds: [...data.accessibleFormInstrumentIds, ...data.accessibleInteractiveInstrumentIds],
225+
accessibleInstrumentIds: [
226+
...data.accessibleFormInstrumentIds,
227+
...data.accessibleInteractiveInstrumentIds,
228+
...data.accessibleSeriesInstrumentIds
229+
],
218230
settings: {
219231
defaultIdentificationMethod: data.defaultIdentificationMethod,
220232
idValidationRegex: data.idValidationRegex,
@@ -258,6 +270,7 @@ const RouteComponent = () => {
258270
const initialValues = {
259271
accessibleFormInstrumentIds: new Set<string>(),
260272
accessibleInteractiveInstrumentIds: new Set<string>(),
273+
accessibleSeriesInstrumentIds: new Set<string>(),
261274
defaultIdentificationMethod,
262275
idValidationRegex: settings?.idValidationRegex,
263276
idValidationRegexErrorMessageEn: settings?.idValidationRegexErrorMessage?.en,
@@ -277,6 +290,11 @@ const RouteComponent = () => {
277290
if (accessibleInstrumentIds?.includes(instrument.id)) {
278291
initialValues.accessibleInteractiveInstrumentIds.add(instrument.id);
279292
}
293+
} else if (instrument.kind === 'SERIES') {
294+
availableInstrumentOptions.series[instrument.id] = instrument.details.title;
295+
if (accessibleInstrumentIds?.includes(instrument.id)) {
296+
initialValues.accessibleSeriesInstrumentIds.add(instrument.id);
297+
}
280298
}
281299
}
282300
return { availableInstrumentOptions, initialValues };

apps/web/src/translations/group.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
"en": "Interactive Tasks",
2929
"fr": "Tâches interactives"
3030
},
31+
"series": {
32+
"en": "Series",
33+
"fr": "Séries"
34+
},
3135
"pageTitle": {
3236
"en": "Manage Group",
3337
"fr": "Gestion du groupe"

0 commit comments

Comments
 (0)