Skip to content

Commit 93181af

Browse files
committed
more cleanup
1 parent 1389485 commit 93181af

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

apps/web/app/api/embed/referrals/links/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DubApiError, ErrorCodes } from "@/lib/api/errors";
22
import { createLink, processLink } from "@/lib/api/links";
3-
import { PARTNER_LINKS_LIMIT } from "@/lib/api/partners/constants";
43
import { parseRequestBody } from "@/lib/api/utils";
4+
import { PARTNER_LINKS_LIMIT } from "@/lib/embed/constants";
55
import { withReferralsEmbedToken } from "@/lib/embed/referrals/auth";
66
import { createPartnerLinkSchema } from "@/lib/zod/schemas/partners";
77
import { ReferralsEmbedLinkSchema } from "@/lib/zod/schemas/referrals-embed";

apps/web/app/api/partner-profile/programs/[programId]/links/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { DubApiError, ErrorCodes } from "@/lib/api/errors";
22
import { createLink, processLink } from "@/lib/api/links";
3-
import { PARTNER_LINKS_LIMIT } from "@/lib/api/partners/constants";
43
import { getProgramEnrollmentOrThrow } from "@/lib/api/programs/get-program-enrollment-or-throw";
54
import { parseRequestBody } from "@/lib/api/utils";
65
import { withPartnerProfile } from "@/lib/auth/partner";
6+
import { PARTNER_LINKS_LIMIT } from "@/lib/embed/constants";
77
import { PartnerProfileLinkSchema } from "@/lib/zod/schemas/partner-profile";
88
import { createPartnerLinkSchema } from "@/lib/zod/schemas/partners";
99
import { getApexDomain } from "@dub/utils";

apps/web/app/app.dub.co/embed/referrals/links-list.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { PARTNER_LINKS_LIMIT } from "@/lib/embed/constants";
12
import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";
23
import { Button, CopyButton, Table, Users, useTable } from "@dub/ui";
34
import { Pen2, Plus2 } from "@dub/ui/icons";
@@ -16,6 +17,8 @@ export function ReferralsEmbedLinksList({
1617
onCreateLink,
1718
onEditLink,
1819
}: Props) {
20+
const linksLimitReached = links.length >= PARTNER_LINKS_LIMIT;
21+
1922
const { table, ...tableProps } = useTable({
2023
data: links,
2124
columns: [
@@ -63,6 +66,8 @@ export function ReferralsEmbedLinksList({
6366
className="h-7 w-7 p-1.5"
6467
icon={<Plus2 className="text-white" />}
6568
onClick={onCreateLink}
69+
disabled={linksLimitReached}
70+
disabledTooltip={`You have reached the limit of ${PARTNER_LINKS_LIMIT} referral links.`}
6671
/>
6772
),
6873
minSize: 60,

apps/web/lib/api/partners/constants.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/web/lib/embed/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ export const REFERRALS_EMBED_PUBLIC_TOKEN_COOKIE_NAME =
99
// Analytics embed token
1010
export const ANALYTICS_EMBED_PUBLIC_TOKEN_COOKIE_NAME =
1111
"dub_analytics_embed_token";
12+
13+
export const PARTNER_LINKS_LIMIT = 5;

0 commit comments

Comments
 (0)