Files
cal.diy/apps/web/ee/pages/workflows/index.tsx
T
Omar Lópezandkodiakhq[bot] 9447f16b82 Migrates all tRPC code to a monorepo package (#3484)
* WIP

* WIP

* Type and migration fixes

* Adds missing default import

* Fixes import

* Fixes tRPC imports in App Store

* Migrate stripe helpers

* WIP

* Type fixes

* Type fix?

* Test fixes

* Adds missing stripe packages

* Moved queries to lib instead

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-22 11:27:06 -06:00

48 lines
1.4 KiB
TypeScript

import { useSession } from "next-auth/react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { Alert } from "@calcom/ui/Alert";
import LicenseRequired from "@ee/components/LicenseRequired";
import { NewWorkflowButton } from "@ee/components/workflows/NewWorkflowButton";
import WorkflowList from "@ee/components/workflows/WorkflowListPage";
import useMeQuery from "@lib/hooks/useMeQuery";
import Loader from "@components/Loader";
import Shell from "@components/Shell";
function WorkflowsPage() {
const { t } = useLocale();
const session = useSession();
const me = useMeQuery();
const isFreeUser = me.data?.plan === "FREE";
const { data, isLoading } = trpc.useQuery(["viewer.workflows.list"]);
return (
<Shell
heading={t("workflows")}
subtitle={t("workflows_to_automate_notifications")}
CTA={session.data?.hasValidLicense && !isFreeUser ? <NewWorkflowButton /> : <></>}>
<LicenseRequired>
{isLoading ? (
<Loader />
) : (
<>
{isFreeUser ? (
<Alert className="border " severity="warning" title={t("pro_feature_workflows")} />
) : (
<WorkflowList workflows={data?.workflows} />
)}
</>
)}
</LicenseRequired>
</Shell>
);
}
export default WorkflowsPage;