2022-11-10 20:23:56 +00:00
|
|
|
import { useState } from "react";
|
|
|
|
|
|
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
2023-01-15 17:54:52 +00:00
|
|
|
import { APP_NAME } from "@calcom/lib/constants";
|
2022-11-10 20:23:56 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2023-01-23 23:08:01 +00:00
|
|
|
import { Alert, Button, ButtonGroup } from "@calcom/ui";
|
|
|
|
import { FiUsers, FiRefreshCcw, FiUserPlus, FiMail, FiVideo, FiEyeOff } from "@calcom/ui/components/icon";
|
2022-11-10 20:23:56 +00:00
|
|
|
|
2023-01-23 09:58:41 +00:00
|
|
|
import { UpgradeTip } from "../../../tips";
|
2022-11-10 20:23:56 +00:00
|
|
|
import SkeletonLoaderTeamList from "./SkeletonloaderTeamList";
|
|
|
|
import TeamList from "./TeamList";
|
|
|
|
|
|
|
|
export function TeamsListing() {
|
|
|
|
const { t } = useLocale();
|
|
|
|
const [errorMessage, setErrorMessage] = useState("");
|
|
|
|
|
2022-11-10 23:40:01 +00:00
|
|
|
const { data, isLoading } = trpc.viewer.teams.list.useQuery(undefined, {
|
2022-11-10 20:23:56 +00:00
|
|
|
onError: (e) => {
|
|
|
|
setErrorMessage(e.message);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const teams = data?.filter((m) => m.accepted) || [];
|
|
|
|
|
2022-12-05 22:20:33 +00:00
|
|
|
const features = [
|
|
|
|
{
|
2023-01-23 23:08:01 +00:00
|
|
|
icon: <FiUsers className="h-5 w-5 text-red-500" />,
|
2022-12-05 22:20:33 +00:00
|
|
|
title: t("collective_scheduling"),
|
|
|
|
description: t("make_it_easy_to_book"),
|
|
|
|
},
|
|
|
|
{
|
2023-01-23 23:08:01 +00:00
|
|
|
icon: <FiRefreshCcw className="h-5 w-5 text-blue-500" />,
|
2022-12-05 22:20:33 +00:00
|
|
|
title: t("round_robin"),
|
|
|
|
description: t("find_the_best_person"),
|
|
|
|
},
|
|
|
|
{
|
2023-01-23 23:08:01 +00:00
|
|
|
icon: <FiUserPlus className="h-5 w-5 text-green-500" />,
|
2022-12-05 22:20:33 +00:00
|
|
|
title: t("fixed_round_robin"),
|
|
|
|
description: t("add_one_fixed_attendee"),
|
|
|
|
},
|
2023-01-15 17:54:52 +00:00
|
|
|
{
|
2023-01-23 23:08:01 +00:00
|
|
|
icon: <FiMail className="h-5 w-5 text-orange-500" />,
|
2023-01-15 17:54:52 +00:00
|
|
|
title: t("sms_attendee_action"),
|
|
|
|
description: t("make_it_easy_to_book"),
|
|
|
|
},
|
|
|
|
{
|
2023-01-23 23:08:01 +00:00
|
|
|
icon: <FiVideo className="h-5 w-5 text-purple-500" />,
|
2023-01-15 17:54:52 +00:00
|
|
|
title: "Cal Video" + " " + t("recordings_title"),
|
|
|
|
description: t("upgrade_to_access_recordings_description"),
|
|
|
|
},
|
|
|
|
{
|
2023-01-23 23:08:01 +00:00
|
|
|
icon: <FiEyeOff className="h-5 w-5 text-indigo-500" />,
|
2023-01-15 17:54:52 +00:00
|
|
|
title: t("disable_cal_branding", { appName: APP_NAME }),
|
|
|
|
description: t("disable_cal_branding_description", { appName: APP_NAME }),
|
|
|
|
},
|
2022-12-05 22:20:33 +00:00
|
|
|
];
|
|
|
|
|
2022-11-10 20:23:56 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{!!errorMessage && <Alert severity="error" title={errorMessage} />}
|
2023-01-23 09:58:41 +00:00
|
|
|
<UpgradeTip
|
|
|
|
title="calcom_is_better_with_team"
|
|
|
|
description="add_your_team_members"
|
|
|
|
features={features}
|
|
|
|
background="/team-banner-background.jpg"
|
|
|
|
isParentLoading={isLoading && <SkeletonLoaderTeamList />}
|
|
|
|
buttons={
|
|
|
|
<div className="space-y-2 rtl:space-x-reverse sm:space-x-2">
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button color="primary" href={`${WEBAPP_URL}/settings/teams/new`}>
|
|
|
|
{t("create_team")}
|
|
|
|
</Button>
|
|
|
|
<Button color="secondary" href="https://go.cal.com/teams-video" target="_blank">
|
|
|
|
{t("learn_more")}
|
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
</div>
|
|
|
|
}>
|
|
|
|
<TeamList teams={teams} />
|
|
|
|
</UpgradeTip>
|
2022-11-10 20:23:56 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|