/teams improvements (#6831)

Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
Peer RichelsenandAlex van Andel authored and GitHub committed 2023-02-01 20:41:47 +00:00
1 parent 7ee5967075
commit ef78db7856
5 files changed
+138 -37

No files matched your search

@@ -1,7 +1,9 @@
import { useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { RouterOutputs, trpc } from "@calcom/trpc/react";
import { showToast } from "@calcom/ui";
import { Card, showToast } from "@calcom/ui";
import { FiUserPlus, FiUsers, FiUnlock, FiEdit } from "@calcom/ui/components/icon";
import TeamListItem from "./TeamListItem";
@@ -12,6 +14,8 @@ interface Props {
export default function TeamList(props: Props) {
const utils = trpc.useContext();
const { t } = useLocale();
const [hideDropdown, setHideDropdown] = useState(false);
function selectAction(action: string, teamId: number) {
@@ -47,6 +51,72 @@ export default function TeamList(props: Props) {
setHideDropdown={setHideDropdown}
/>
))}
{/* only show recommended steps when there is only one team */}
{props.teams.length === 1 && (
<>
{props.teams.map(
(team, i) =>
i === 0 && (
<div className="bg-gray-100 p-6">
<h3 className="mb-4 text-sm font-semibold text-gray-900">{t("recommended_next_steps")}</h3>
<div className="grid-col-1 grid gap-2 md:grid-cols-3">
<Card
icon={<FiUserPlus className="h-5 w-5 text-green-700" />}
variant="basic"
title={t("invite_team_member")}
description="Meetings are better with the right team members there. Invite them now."
actionButton={{
href: "/settings/teams/" + team.id + "/members",
child: t("invite"),
}}
/>
{/* @TODO: uncomment once managed event types is live
<Card
icon={<FiUnlock className="h-5 w-5 text-blue-700" />}
variant="basic"
title={t("create_a_managed_event")}
description={t("meetings_are_better_with_the_right")}
actionButton={{
href:
"/event-types?dialog=new-eventtype&eventPage=team%2F" +
team.slug +
"&teamId=" +
team.id +
"&managed=true",
child: t("create"),
}}
/> */}
<Card
icon={<FiUsers className="h-5 w-5 text-orange-700" />}
variant="basic"
title={t("collective_or_roundrobin")}
description={t("book_your_team_members")}
actionButton={{
href:
"/event-types?dialog=new-eventtype&eventPage=team%2F" +
team.slug +
"&teamId=" +
team.id,
child: t("create"),
}}
/>
<Card
icon={<FiEdit className="h-5 w-5 text-purple-700" />}
variant="basic"
title={t("appearance")}
description={t("appearance_subtitle")}
actionButton={{
href: "/settings/teams/" + team.id + "/appearance",
child: t("edit"),
}}
/>
</div>
</div>
)
)}
</>
)}
</ul>
);
}
@@ -68,6 +68,8 @@ export function TeamsListing() {
<UpgradeTip
title="calcom_is_better_with_team"
description="add_your_team_members"
emptyTitle="no_teams"
emptyDescription="no_teams_description"
features={features}
background="/team-banner-background.jpg"
buttons={
+13 -2
View File
@@ -1,4 +1,3 @@
import { useMemo } from "react";
import type { ReactNode } from "react";
import { classNames } from "@calcom/lib";
@@ -11,6 +10,8 @@ import { FiUsers } from "@calcom/ui/components/icon";
export function UpgradeTip({
dark,
title,
emptyTitle,
emptyDescription,
description,
background,
features,
@@ -21,6 +22,9 @@ export function UpgradeTip({
dark?: boolean;
title: string;
description: string;
/* overwrite EmptyScreen text */
emptyTitle?: string;
emptyDescription?: string;
background: string;
features: Array<{ icon: JSX.Element; title: string; description: string }>;
buttons?: JSX.Element;
@@ -36,7 +40,14 @@ export function UpgradeTip({
if (isParentLoading || isLoading) return <>{isParentLoading}</>;
if (!isCalcom)
return <EmptyScreen Icon={FiUsers} headline={title} description={description} buttonRaw={buttons} />;
return (
<EmptyScreen
Icon={FiUsers}
headline={emptyTitle ? t(emptyTitle) : t(title)}
description={emptyDescription ? t(emptyDescription) : t(description)}
buttonRaw={buttons}
/>
);
return (
<>