Forward query params from Team Profile page (#9057)

Co-authored-by: alannnc <alannnc@gmail.com>
gh-readonly-queue/main/pr-8967-3ae193e36238730c6777f06e66a5d26e789fa64f
Hariom Balhara 2023-05-23 13:48:51 +05:30 committed by GitHub
parent e20cb4a999
commit ec43f3f2c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import Link from "next/link";
import { useRouter } from "next/router";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@ -14,11 +15,14 @@ type TeamTypeWithSafeHtml = Omit<TeamType, "members"> & { members: MemberType[]
const Member = ({ member, teamName }: { member: MemberType; teamName: string | null }) => {
const { t } = useLocale();
const router = useRouter();
const isBioEmpty = !member.bio || !member.bio.replace("<p><br></p>", "").length;
// slug is a route parameter, we don't want to forward it to the next route
const { slug: _slug, ...queryParamsToForward } = router.query;
return (
<Link key={member.id} href={`/${member.username}`}>
<Link key={member.id} href={{ pathname: `/${member.username}`, query: queryParamsToForward }}>
<div className="sm:min-w-80 sm:max-w-80 bg-default hover:bg-muted border-subtle group flex min-h-full flex-col space-y-2 rounded-md border p-4 hover:cursor-pointer">
<Avatar
size="md"

View File

@ -56,6 +56,9 @@ function TeamPage({ team, isUnpublished, markdownStrippedBio }: TeamPageProps) {
);
}
// slug is a route parameter, we don't want to forward it to the next route
const { slug: _slug, ...queryParamsToForward } = router.query;
const EventTypes = () => (
<ul className="border-subtle rounded-md border">
{team.eventTypes.map((type, index) => (
@ -67,7 +70,10 @@ function TeamPage({ team, isUnpublished, markdownStrippedBio }: TeamPageProps) {
)}>
<div className="px-6 py-4 ">
<Link
href={`/team/${team.slug}/${type.slug}`}
href={{
pathname: `/team/${team.slug}/${type.slug}`,
query: queryParamsToForward,
}}
onClick={async () => {
sdkActionManager?.fire("eventTypeSelected", {
eventType: type,
@ -146,7 +152,13 @@ function TeamPage({ team, isUnpublished, markdownStrippedBio }: TeamPageProps) {
color="minimal"
EndIcon={ArrowRight}
className="dark:hover:bg-darkgray-200"
href={`/team/${team.slug}?members=1`}
href={{
pathname: `/team/${team.slug}`,
query: {
members: "1",
...queryParamsToForward,
},
}}
shallow={true}>
{t("book_a_team_member")}
</Button>