Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

564 make public group select title more general #565

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions packages/berlin/src/pages/PublicGroupRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ function PublicGroupRegistration() {
const [searchParams] = useSearchParams();
const groupCategoryNameParam = searchParams.get('groupCategory');

const capitalizedParam =
groupCategoryNameParam &&
groupCategoryNameParam?.slice(0, 1).toUpperCase() + groupCategoryNameParam?.slice(1);

const {
control,
getValues,
Expand Down Expand Up @@ -79,7 +75,7 @@ function PublicGroupRegistration() {
return;
}
queryClient.invalidateQueries({ queryKey: ['user', user?.id, 'users-to-groups'] });
toast.success(`Joined ${groupCategoryNameParam} group successfully!`);
toast.success(`Joined group successfully!`);
},
onError: () => {
toast.error('Something went wrong.');
Expand All @@ -99,7 +95,7 @@ function PublicGroupRegistration() {
}

queryClient.invalidateQueries({ queryKey: ['user', user?.id, 'users-to-groups'] });
toast.success(`Updated ${groupCategoryNameParam} group successfully!`);
toast.success(`Updated group successfully!`);
},
onError: () => {
toast.error('Something went wrong.');
Expand Down Expand Up @@ -133,15 +129,11 @@ function PublicGroupRegistration() {
name="group"
control={control}
rules={{
required: `${capitalizedParam} group is required`,
required: `Group is required`,
}}
render={({ field }) => (
<Select
placeholder={
prevUserToGroup
? prevUserToGroup.group.name
: `Select your ${groupCategoryNameParam} group`
}
placeholder={prevUserToGroup ? prevUserToGroup.group.name : `Select your group`}
options={selectData}
value={field.value}
errors={[errors.group?.message ?? '']}
Expand All @@ -151,7 +143,7 @@ function PublicGroupRegistration() {
/>
)}
/>
<Button type="submit">Join {groupCategoryNameParam} group</Button>
<Button type="submit">Join group</Button>
</Form>
</FlexColumn>
);
Expand Down
Loading