import { useState, useMemo } from "react";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { APP_NAME } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { Alert, Button, ButtonGroup, Label } from "@calcom/ui";
import { FiUsers, FiRefreshCcw, FiUserPlus, FiMail, FiVideo, FiEyeOff } from "@calcom/ui/components/icon";
import { UpgradeTip } from "../../../tips";
import SkeletonLoaderTeamList from "./SkeletonloaderTeamList";
import TeamList from "./TeamList";
export function TeamsListing() {
const { t } = useLocale();
const [errorMessage, setErrorMessage] = useState("");
const { data, isLoading } = trpc.viewer.teams.list.useQuery(undefined, {
onError: (e) => {
setErrorMessage(e.message);
},
});
const teams = useMemo(() => data?.filter((m) => m.accepted) || [], [data]);
const invites = useMemo(() => data?.filter((m) => !m.accepted) || [], [data]);
const features = [
{
icon: ,
title: t("collective_scheduling"),
description: t("make_it_easy_to_book"),
},
{
icon: ,
title: t("round_robin"),
description: t("find_the_best_person"),
},
{
icon: ,
title: t("fixed_round_robin"),
description: t("add_one_fixed_attendee"),
},
{
icon: ,
title: t("sms_attendee_action"),
description: t("make_it_easy_to_book"),
},
{
icon: ,
title: "Cal Video" + " " + t("recordings_title"),
description: t("upgrade_to_access_recordings_description"),
},
{
icon: ,
title: t("disable_cal_branding", { appName: APP_NAME }),
description: t("disable_cal_branding_description", { appName: APP_NAME }),
},
];
if (isLoading) {
return ;
}
return (
<>
{!!errorMessage && }
}>
<>
{invites.length > 0 && (
)}
{teams.length > 0 && }
>
>
);
}