diff --git a/packages/berlin/src/pages/Register.tsx b/packages/berlin/src/pages/Register.tsx index b7de4cf6..bbd8473c 100644 --- a/packages/berlin/src/pages/Register.tsx +++ b/packages/berlin/src/pages/Register.tsx @@ -15,6 +15,7 @@ import { fetchRegistrations, fetchUsersToGroups, GetRegistrationsResponseType, + GetUsersToGroupsResponse, postRegistration, putRegistration, type GetRegistrationDataResponse, @@ -50,7 +51,6 @@ function Register() { const [selectedRegistrationFormKey, setSelectedRegistrationFormKey] = useState< string | undefined >(); - const [selectedGroupId, setSelectedGroupId] = useState(); const { data: event } = useQuery({ queryKey: ['event', eventId], @@ -98,30 +98,24 @@ function Register() { const createRegistrationForms = ( registrations: GetRegistrationsResponseType | undefined | null, ) => { - // max 5 registrations - // when there are no registrations, return an array of 5 empty objects with id 'empty' - // the name should be the index of the array + 1 - const sortedRegistrationsByCreationDate = sortRegistrationsByCreationDate(registrations || []); const registrationForms: { key: string | 'create'; registrationId?: string; + groupId?: string; name: string; mode: 'edit' | 'create'; }[] = sortedRegistrationsByCreationDate.map((reg, idx) => { return { key: reg.id || '', registrationId: reg.id, + groupId: reg.groupId ?? undefined, name: `Proposal ${idx + 1}`, mode: 'edit', }; }); - if (registrationForms.length >= 5) { - return registrationForms; - } - registrationForms.push({ key: 'create', name: 'Create a new Proposal', @@ -175,23 +169,6 @@ function Register() { /> )} - - - + + ); +} + function FormField({ id, name, diff --git a/packages/berlin/src/pages/SecretGroupRegistration.tsx b/packages/berlin/src/pages/SecretGroupRegistration.tsx index 86ff5866..48158e6c 100644 --- a/packages/berlin/src/pages/SecretGroupRegistration.tsx +++ b/packages/berlin/src/pages/SecretGroupRegistration.tsx @@ -61,7 +61,6 @@ function SecretGroupRegistration() { mutationFn: postGroup, onSuccess: (body) => { if (body) { - queryClient.invalidateQueries({ queryKey: ['groups'] }); queryClient.invalidateQueries({ queryKey: ['users-to-groups', user?.id] }); toast.success(`Group ${groupName} created succesfully!`); toast.success(`Joined group ${groupName} succesfully!`);