Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

BOUNTY_DESCRIPTION_MAX_LENGTH

Steven Tey04b831cea809
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
index ffd97bf7cf..1f8169db75 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty-sheet.tsx
@@ -1,4 +1,5 @@
import { isCurrencyAttribute } from "@/lib/api/workflows/utils";
+import { BOUNTY_DESCRIPTION_MAX_LENGTH } from "@/lib/partners/constants";
import { mutatePrefix } from "@/lib/swr/mutate";
import { useApiMutation } from "@/lib/swr/use-api-mutation";
import useProgram from "@/lib/swr/use-program";
@@ -33,7 +34,7 @@ import {
ToggleGroup,
useRouterStuff,
} from "@dub/ui";
-import { cn, formatDate } from "@dub/utils";
+import { cn, formatDate, nFormatter } from "@dub/utils";
import { Dispatch, SetStateAction, useMemo, useState } from "react";
import {
Controller,
@@ -384,8 +385,8 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
}
// Description validation
- if (description && description.length > 500) {
- return "Description must be 500 characters or less.";
+ if (description && description.length > BOUNTY_DESCRIPTION_MAX_LENGTH) {
+ return `Description must be ${BOUNTY_DESCRIPTION_MAX_LENGTH} characters or less.`;
}
return null;
@@ -800,7 +801,7 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
<textarea
id="description"
rows={3}
- maxLength={500}
+ maxLength={BOUNTY_DESCRIPTION_MAX_LENGTH}
className={cn(
"block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",
errors.description &&
@@ -814,7 +815,10 @@ function BountySheetContent({ setIsOpen, bounty }: BountySheetProps) {
/>
<div className="mt-1 text-left">
<span className="text-xs text-neutral-400">
- {description?.length || 0}/500
+ {description?.length || 0} /{" "}
+ {nFormatter(BOUNTY_DESCRIPTION_MAX_LENGTH, {
+ full: true,
+ })}
</span>
</div>
</div>
diff --git a/apps/web/lib/partners/constants.ts b/apps/web/lib/partners/constants.ts
index b77338c4cb..e27fd71464 100644
--- a/apps/web/lib/partners/constants.ts
+++ b/apps/web/lib/partners/constants.ts
@@ -3,6 +3,7 @@ import { PaymentMethodOption } from "../types";
export const PROGRAM_ONBOARDING_PARTNERS_LIMIT = 5;
export const PAYOUTS_SHEET_ITEMS_LIMIT = 10;
+export const BOUNTY_DESCRIPTION_MAX_LENGTH = 5000;
export const REFERRALS_EMBED_EARNINGS_LIMIT = 8;
export const CUSTOMER_PAGE_EVENTS_LIMIT = 8;
export const PAYOUT_FAILURE_FEE_CENTS = 1000; // 10 USD
diff --git a/apps/web/lib/zod/schemas/bounties.ts b/apps/web/lib/zod/schemas/bounties.ts
index 0373b713f1..37dd430f03 100644
--- a/apps/web/lib/zod/schemas/bounties.ts
+++ b/apps/web/lib/zod/schemas/bounties.ts
@@ -1,3 +1,4 @@
+import { BOUNTY_DESCRIPTION_MAX_LENGTH } from "@/lib/partners/constants";
import {
BountyPerformanceScope,
BountySubmissionRejectionReason,
@@ -49,7 +50,10 @@ export const createBountySchema = z.object({
description: z
.string()
.trim()
- .max(500, "Description must be less than 500 characters")
+ .max(
+ BOUNTY_DESCRIPTION_MAX_LENGTH,
+ `Description must be less than ${BOUNTY_DESCRIPTION_MAX_LENGTH} characters`,
+ )
.nullish(),
type: z.nativeEnum(BountyType),
startsAt: parseDateSchema.nullish(),