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
|
|
|
|
2022-05-30 07:57:48 +00:00
|
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
2022-11-23 02:55:25 +00:00
|
|
|
import { Avatar } from "@calcom/ui";
|
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];
|
|
|
|
|
2022-09-29 16:34:01 +00:00
|
|
|
const Member = ({ member, teamName }: { member: MemberType; teamName: string | null }) => {
|
2021-10-12 13:11:33 +00:00
|
|
|
const { t } = useLocale();
|
2021-10-08 11:43:48 +00:00
|
|
|
|
2022-09-29 16:34:01 +00:00
|
|
|
return (
|
|
|
|
<Link key={member.id} href={`/${member.username}`}>
|
|
|
|
<div className="sm:min-w-80 sm:max-w-80 dark:bg-darkgray-200 dark:hover:bg-darkgray-300 group flex min-h-full w-[90%] 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"}
|
|
|
|
/>
|
|
|
|
<section className="line-clamp-4 mt-2 w-full space-y-1">
|
2023-01-12 16:57:43 +00:00
|
|
|
<p className="font-medium text-gray-900 dark:text-white">{member.name}</p>
|
|
|
|
<p className="line-clamp-3 overflow-ellipsis text-sm font-normal text-gray-500 dark:text-white">
|
2022-09-29 16:34:01 +00:00
|
|
|
{member.bio || t("user_from_team", { user: member.name, team: teamName })}
|
|
|
|
</p>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const Members = ({ members, teamName }: { members: MembersType; teamName: string | null }) => {
|
|
|
|
if (!members || members.length === 0) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-08-13 19:46:42 +00:00
|
|
|
|
2022-09-29 16:34:01 +00:00
|
|
|
return (
|
|
|
|
<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">
|
|
|
|
{members.map((member) => {
|
|
|
|
return member.username !== null && <Member key={member.id} member={member} teamName={teamName} />;
|
|
|
|
})}
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const Team = ({ team }: TeamPageProps) => {
|
2021-08-13 19:46:42 +00:00
|
|
|
return (
|
2021-09-14 08:45:28 +00:00
|
|
|
<div>
|
2022-09-29 16:34:01 +00:00
|
|
|
<Members members={team.members} teamName={team.name} />
|
2021-09-14 08:45:28 +00:00
|
|
|
</div>
|
2021-08-13 19:46:42 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Team;
|