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

Dynamic group booking fix to accept "+" in URL and updated Head SEO for dynamic booking #2414

Merged
merged 3 commits into from Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 11 additions & 4 deletions apps/web/pages/[user].tsx
Expand Up @@ -43,6 +43,11 @@ export default function User(props: inferSSRProps<typeof getServerSideProps>) {
const router = useRouter();
const isSingleUser = props.users.length === 1;
const isDynamicGroup = props.users.length > 1;
const dynamicNames = isDynamicGroup
? props.users.map((user) => {
return user.name || "";
})
: [];
const dynamicUsernames = isDynamicGroup
? props.users.map((user) => {
return user.username || "";
Expand Down Expand Up @@ -106,10 +111,12 @@ export default function User(props: inferSSRProps<typeof getServerSideProps>) {
<>
<Theme />
<HeadSeo
title={nameOrUsername}
description={(user.bio as string) || ""}
name={nameOrUsername}
username={(user.username as string) || ""}
title={isDynamicGroup ? dynamicNames.join(", ") : nameOrUsername}
description={
isDynamicGroup ? `Book events with ${dynamicUsernames.join(", ")}` : (user.bio as string) || ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should make it A, B and C?

}
name={isDynamicGroup ? dynamicNames.join(", ") : nameOrUsername}
username={isDynamicGroup ? dynamicUsernames.join(", ") : (user.username as string) || ""}
// avatar={user.avatar || undefined}
/>
<div className="h-screen dark:bg-neutral-900">
Expand Down
2 changes: 2 additions & 0 deletions packages/lib/defaultEvents.ts
Expand Up @@ -141,6 +141,8 @@ export const getUsernameSlugLink = ({ users, slug }: UsernameSlugLinkProps): str
export const getUsernameList = (users: string): string[] => {
return users
.toLowerCase()
.replace(" ", "+")
.replace("%20", "+")
.split("+")
.filter((el) => {
return el.length != 0;
Expand Down