2021-09-22 19:52:38 +00:00
|
|
|
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";
|
2022-07-27 02:24:00 +00:00
|
|
|
import { Icon } from "@calcom/ui/Icon";
|
2022-09-02 21:16:36 +00:00
|
|
|
import { Avatar } from "@calcom/ui/v2";
|
2022-03-16 23:36:43 +00:00
|
|
|
|
2021-10-08 11:43:48 +00:00
|
|
|
import { useLocale } from "@lib/hooks/useLocale";
|
|
|
|
|
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
|
|
|
return (
|
2021-12-09 23:51:30 +00:00
|
|
|
<Link key={member.id} href={`/${member.username}`}>
|
2022-09-02 21:16:36 +00:00
|
|
|
<div className="sm:min-w-80 sm:max-w-80 dark:bg-darkgray-200 dark:hover:bg-darkgray-300 group flex h-full flex-col space-y-2 rounded-md bg-white p-4 hover:cursor-pointer hover:bg-gray-50 ">
|
|
|
|
<Avatar
|
|
|
|
size="md"
|
|
|
|
alt={member.name || ""}
|
|
|
|
imageSrc={WEBAPP_URL + "/" + member.username + "/avatar.png"}
|
2021-08-13 19:46:42 +00:00
|
|
|
/>
|
2022-09-02 21:16:36 +00:00
|
|
|
<section className="line-clamp-4 mt-2 w-full space-y-1">
|
|
|
|
<p className="font-medium text-neutral-900 dark:text-white">{member.name}</p>
|
|
|
|
<p className="line-clamp-3 overflow-ellipsis text-sm font-normal text-neutral-500 dark:text-white">
|
|
|
|
{member.bio || t("user_from_team", { user: member.name, team: team.name })}
|
|
|
|
</p>
|
|
|
|
</section>
|
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-14 08:45:28 +00:00
|
|
|
</div>
|
2021-08-13 19:46:42 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Team;
|