From cc498f0e33fb1f05e31e6688aeadf6d1d3df9f8d Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 10 Jun 2026 20:32:07 -0700 Subject: [PATCH] Properly paywall ui for labels --- src/components/CreateOrgLabelDialog.tsx | 10 +++++++++- src/components/EditOrgLabelDialog.tsx | 10 +++++++++- src/components/OrgLabelForm.tsx | 16 +++++++++++----- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/components/CreateOrgLabelDialog.tsx b/src/components/CreateOrgLabelDialog.tsx index 047e6289f..dfd883522 100644 --- a/src/components/CreateOrgLabelDialog.tsx +++ b/src/components/CreateOrgLabelDialog.tsx @@ -1,8 +1,10 @@ "use client"; import { useEnvContext } from "@app/hooks/useEnvContext"; +import { usePaidStatus } from "@app/hooks/usePaidStatus"; import { toast } from "@app/hooks/useToast"; import { createApiClient, formatAxiosError } from "@app/lib/api"; +import { tierMatrix } from "@server/lib/billing/tierMatrix"; import type { CreateOrEditLabelResponse } from "@server/routers/labels/types"; import type { AxiosResponse } from "axios"; import { useTranslations } from "next-intl"; @@ -18,6 +20,7 @@ import { CredenzaTitle } from "./Credenza"; import { OrgLabelForm } from "./OrgLabelForm"; +import { PaidFeaturesAlert } from "./PaidFeaturesAlert"; import { Button } from "./ui/button"; export type CreateOrgLabelDialogProps = { @@ -35,6 +38,8 @@ export function CreateOrgLabelDialog({ }: CreateOrgLabelDialogProps) { const t = useTranslations(); const api = createApiClient(useEnvContext()); + const { isPaidUser } = usePaidStatus(); + const canManageLabels = isPaidUser(tierMatrix.labels); const [isSubmitting, startTransition] = useTransition(); async function createOrgLabel(data: { name: string; color: string }) { @@ -79,8 +84,11 @@ export function CreateOrgLabelDialog({ + { + if (!canManageLabels) return; startTransition(async () => createOrgLabel(data)); }} /> @@ -98,7 +106,7 @@ export function CreateOrgLabelDialog({