2021-08-13 19:46:42 +00:00
|
|
|
import { ArrowRightIcon } from "@heroicons/react/outline";
|
2021-09-14 08:45:28 +00:00
|
|
|
import { ArrowLeftIcon } from "@heroicons/react/solid";
|
2021-09-22 19:52:38 +00:00
|
|
|
import classnames from "classnames";
|
|
|
|
import Link from "next/link";
|
2021-12-09 23:51:30 +00:00
|
|
|
import { TeamPageProps } from "pages/team/[slug]";
|
2021-09-22 19:52:38 +00:00
|
|
|
import React from "react";
|
|
|
|
|
2022-05-30 07:57:48 +00:00
|
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
2022-03-16 23:36:43 +00:00
|
|
|
import Button from "@calcom/ui/Button";
|
|
|
|
|
2021-10-08 11:43:48 +00:00
|
|
|
import { useLocale } from "@lib/hooks/useLocale";
|
|
|
|
|
2021-09-22 19:52:38 +00:00
|
|
|
import Avatar from "@components/ui/Avatar";
|
2021-08-13 19:46:42 +00:00
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
type TeamType = TeamPageProps["team"];
|
|
|
|
type MembersType = TeamType["members"];
|
|
|
|
type MemberType = MembersType[number];
|
|
|
|
|
|
|
|
const Team = ({ team }: TeamPageProps) => {
|
2021-10-12 13:11:33 +00:00
|
|
|
const { t } = useLocale();
|
2021-10-08 11:43:48 +00:00
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
const Member = ({ member }: { member: MemberType }) => {
|
2021-08-13 19:46:42 +00:00
|
|
|
const classes = classnames(
|
|
|
|
"group",
|
|
|
|
"relative",
|
|
|
|
"flex flex-col",
|
|
|
|
"space-y-4",
|
|
|
|
"p-4",
|
2021-12-17 00:12:06 +00:00
|
|
|
"min-w-full sm:min-w-64 sm:max-w-64",
|
2022-03-24 13:15:24 +00:00
|
|
|
"bg-white dark:bg-neutral-800 dark:border-neutral-700 dark:bg-opacity-8",
|
2021-08-13 19:46:42 +00:00
|
|
|
"border border-neutral-200",
|
|
|
|
"hover:cursor-pointer",
|
2021-11-04 14:30:37 +00:00
|
|
|
"hover:border-brand dark:border-neutral-700 dark:hover:border-neutral-600",
|
2021-08-13 19:46:42 +00:00
|
|
|
"rounded-sm",
|
|
|
|
"hover:shadow-md"
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
2021-12-09 23:51:30 +00:00
|
|
|
<Link key={member.id} href={`/${member.username}`}>
|
2021-08-13 19:46:42 +00:00
|
|
|
<div className={classes}>
|
|
|
|
<ArrowRightIcon
|
|
|
|
className={classnames(
|
|
|
|
"text-black dark:text-white",
|
|
|
|
"absolute top-4 right-4",
|
|
|
|
"h-4 w-4",
|
|
|
|
"transition-opacity",
|
2022-02-09 00:05:13 +00:00
|
|
|
"opacity-0 group-hover:block group-hover:opacity-100"
|
2021-08-13 19:46:42 +00:00
|
|
|
)}
|
|
|
|
/>
|
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
<div>
|
2021-12-17 00:12:06 +00:00
|
|
|
<Avatar
|
|
|
|
alt={member.name || ""}
|
2022-05-30 07:57:48 +00:00
|
|
|
imageSrc={WEBAPP_URL + "/" + member.username + "/avatar.png"}
|
2022-02-09 00:05:13 +00:00
|
|
|
className="-mt-4 h-12 w-12"
|
2021-12-17 00:12:06 +00:00
|
|
|
/>
|
2022-05-27 10:38:50 +00:00
|
|
|
<section className="line-clamp-4 mt-2 w-full space-y-1">
|
2022-05-30 09:36:23 +00:00
|
|
|
<p className="font-medium text-neutral-900 dark:text-white">{member.name}</p>
|
|
|
|
<p className="text-sm font-normal text-neutral-500 dark:text-white">
|
2021-12-17 00:12:06 +00:00
|
|
|
{member.bio || t("user_from_team", { user: member.name, team: team.name })}
|
2022-05-30 09:36:23 +00:00
|
|
|
</p>
|
2021-09-14 08:45:28 +00:00
|
|
|
</section>
|
|
|
|
</div>
|
2021-08-13 19:46:42 +00:00
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
const Members = ({ members }: { members: MembersType }) => {
|
2021-08-13 19:46:42 +00:00
|
|
|
if (!members || members.length === 0) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-02-09 00:05:13 +00:00
|
|
|
<section className="lg:min-w-lg mx-auto flex min-w-full max-w-5xl flex-wrap justify-center gap-x-6 gap-y-6">
|
2021-08-13 19:46:42 +00:00
|
|
|
{members.map((member) => {
|
2021-12-09 23:51:30 +00:00
|
|
|
return member.username !== null && <Member key={member.id} member={member} />;
|
2021-08-13 19:46:42 +00:00
|
|
|
})}
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
2021-09-14 08:45:28 +00:00
|
|
|
<div>
|
2021-08-13 19:46:42 +00:00
|
|
|
<Members members={team.members} />
|
2021-09-30 09:24:02 +00:00
|
|
|
{team.eventTypes.length > 0 && (
|
2021-12-09 23:51:30 +00:00
|
|
|
<aside className="mt-8 text-center dark:text-white">
|
2021-09-14 13:27:41 +00:00
|
|
|
<Button color="secondary" href={`/team/${team.slug}`} shallow={true} StartIcon={ArrowLeftIcon}>
|
2021-10-08 11:43:48 +00:00
|
|
|
{t("go_back")}
|
2021-09-14 13:27:41 +00:00
|
|
|
</Button>
|
2021-09-14 08:45:28 +00:00
|
|
|
</aside>
|
|
|
|
)}
|
|
|
|
</div>
|
2021-08-13 19:46:42 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Team;
|