The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Disallow lifetime stats for relative bounties and clean up bounty card copy
Kiran K402940058390
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsxindex c22bfdd196..96a9742e50 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx@@ -8,7 +8,7 @@ import { BountyRewardDescription } from "@/ui/partners/bounties/bounty-reward-deimport { BountyThumbnailImage } from "@/ui/partners/bounties/bounty-thumbnail-image";import { GroupColorCircle } from "@/ui/partners/groups/group-color-circle";import { ScrollableTooltipContent, Tooltip } from "@dub/ui";-import { Calendar6, Users, Users6 } from "@dub/ui/icons";+import { Calendar6, Users6 } from "@dub/ui/icons";import { useMemo } from "react";import { BountyActionButton } from "../bounty-action-button";@@ -35,7 +35,7 @@ export function BountyInfo() {return null;}- const { dateRangeLabel, partnerAudienceLabel } = getProgramBountyMeta(bounty);+ const { dateRangeLabel } = getProgramBountyMeta(bounty);return (<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:gap-6">@@ -60,11 +60,6 @@ export function BountyInfo() {<BountyRewardDescription bounty={bounty} className="font-regular" />- <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">- <Users className="size-4 shrink-0" />- <span>{partnerAudienceLabel}</span>- </div>-{isOwner && (<div className="text-content-subtle font-regular flex items-center gap-2 text-sm"><Users6 className="size-4 shrink-0" />diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/bounty-duration.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/bounty-duration.tsxindex 86ffdbec76..16cb51ef77 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/bounty-duration.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/bounty-duration.tsx@@ -42,7 +42,7 @@ const START_OPTIONS = [value: p,label: DURATION_LABELS[p].start,})),- { value: "onPartnerJoin", label: "when a new partner joins" },+ { value: "onPartnerJoin", label: "When a new partner joins" },{ value: "custom", label: "custom" },] satisfies PresetOption<StartPreset>[];diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/bounty-logic.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/bounty-logic.tsxindex 1e73ca4e69..dd471405e8 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/bounty-logic.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/bounty-logic.tsx@@ -12,6 +12,7 @@ import {} from "@/ui/shared/inline-badge-popover";import { Trophy } from "@dub/ui/icons";import { cn, currencyFormatter, nFormatter } from "@dub/utils";+import { BountyStartMode } from "@prisma/client";import { Controller } from "react-hook-form";import { BountyAmountInput } from "./bounty-amount-input";import { useBountyFormContext } from "./bounty-form-context";@@ -24,11 +25,14 @@ const PERFORMANCE_SCOPE_DESCRIPTIONS = {export function BountyLogic({ className }: { className?: string }) {const { control, watch } = useBountyFormContext();- const [attribute, value] = watch([+ const [attribute, value, startMode] = watch(["performanceCondition.attribute","performanceCondition.value",+ "startMode",]);+ const isRelative = startMode === BountyStartMode.relative;+return (<div className={cn("flex w-full items-center gap-1.5", className)}><div className="flex size-7 shrink-0 items-center justify-center rounded-md bg-neutral-100">@@ -56,9 +60,12 @@ export function BountyLogic({ className }: { className?: string }) {description: PERFORMANCE_SCOPE_DESCRIPTIONS.new,},{- text: "lifetime",+ text: isRelative+ ? "lifetime (not available)"+ : "lifetime",value: "lifetime",description: PERFORMANCE_SCOPE_DESCRIPTIONS.lifetime,+ disabled: isRelative,},]}/>diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/confirm-create-bounty-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/confirm-create-bounty-modal.tsxindex ac9fe46961..996641ef3c 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/confirm-create-bounty-modal.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/confirm-create-bounty-modal.tsx@@ -18,7 +18,7 @@ import {Tooltip,TooltipContent,} from "@dub/ui";-import { Users, Users6 } from "@dub/ui/icons";+import { Users6 } from "@dub/ui/icons";import { nFormatter, pluralize } from "@dub/utils";import { cn } from "@dub/utils/src";import { BountyStartMode } from "@prisma/client";@@ -94,7 +94,7 @@ function ConfirmCreateBountyModal({}};- const { dateRangeLabel, partnerAudienceLabel } = getProgramBountyMeta(bounty);+ const { dateRangeLabel } = getProgramBountyMeta(bounty);return (<Modal@@ -136,11 +136,6 @@ function ConfirmCreateBountyModal({</div>)}- <div className="text-content-subtle flex items-center gap-2 text-sm font-normal">- <Users className="size-3.5" />- <span>{partnerAudienceLabel}</span>- </div>-{isOwner && (<div className="text-content-subtle font-regular flex items-center gap-2 text-sm"><Users6 className="size-3.5" />diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/use-add-edit-bounty-form.ts b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/use-add-edit-bounty-form.tsindex b2c68149c4..b4c9dd73e9 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/use-add-edit-bounty-form.ts+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/add-edit-bounty/use-add-edit-bounty-form.ts@@ -248,6 +248,13 @@ export function useAddEditBountyForm({shouldValidate: true,});+ if (nextStartMode === BountyStartMode.relative) {+ setValue("performanceScope", "new", {+ shouldDirty: true,+ shouldValidate: true,+ });+ }+setHasEndDate(Boolean(nextEndsAt) ||(nextStartMode === BountyStartMode.relative &&diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsxindex 8eafdfaf2e..10df67a7c5 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx@@ -11,7 +11,7 @@ import { BountyRewardDescription } from "@/ui/partners/bounties/bounty-reward-deimport { BountyThumbnailImage } from "@/ui/partners/bounties/bounty-thumbnail-image";import { GroupColorCircle } from "@/ui/partners/groups/group-color-circle";import { DynamicTooltipWrapper, ScrollableTooltipContent } from "@dub/ui";-import { Calendar6, Users, Users6 } from "@dub/ui/icons";+import { Calendar6, Users6 } from "@dub/ui/icons";import { formatDate, nFormatter, pluralize } from "@dub/utils";import Link from "next/link";import { useMemo } from "react";@@ -25,7 +25,7 @@ export function BountyCard({ bounty }: { bounty: BountyListProps }) {const { groups } = useGroups();- const { dateRangeLabel, partnerAudienceLabel } = getProgramBountyMeta(bounty);+ const { dateRangeLabel } = getProgramBountyMeta(bounty);const eligibleGroups = useMemo(() => {if (!groups || bounty.groups.length === 0) {@@ -81,11 +81,6 @@ export function BountyCard({ bounty }: { bounty: BountyListProps }) {onTooltipClick={(e) => e.preventDefault()}/>- <div className="text-content-subtle flex items-center gap-2 text-sm font-normal">- <Users className="size-3.5" />- <span>{partnerAudienceLabel}</span>- </div>-<div className="text-content-subtle flex items-center gap-2 text-sm font-normal"><Users6 className="size-3.5" />{bounty.groups.length === 0 ? (@@ -186,10 +181,6 @@ export function BountyCardSkeleton() {<div className="size-3.5 shrink-0 animate-pulse rounded bg-neutral-200" /><div className="h-5 w-24 animate-pulse rounded bg-neutral-200" /></div>- <div className="flex h-5 items-center gap-2">- <div className="size-3.5 shrink-0 animate-pulse rounded bg-neutral-200" />- <div className="h-5 w-28 animate-pulse rounded bg-neutral-200" />- </div><div className="flex h-5 items-center gap-2"><div className="size-3.5 shrink-0 animate-pulse rounded bg-neutral-200" /><div className="h-5 w-40 animate-pulse rounded bg-neutral-200" />diff --git a/apps/web/lib/bounty/api/validate-bounty.ts b/apps/web/lib/bounty/api/validate-bounty.tsindex 1136f88e6e..94250fbce0 100644--- a/apps/web/lib/bounty/api/validate-bounty.ts+++ b/apps/web/lib/bounty/api/validate-bounty.ts@@ -106,6 +106,17 @@ export function validateBounty({});}+ if (+ startMode === BountyStartMode.relative &&+ performanceScope === "lifetime"+ ) {+ throw new DubApiError({+ code: "bad_request",+ message:+ "Lifetime stats are not supported when the bounty starts when a partner joins.",+ });+ }+// submission bounty checksif (type === "submission") {if (submissionFrequency && maxSubmissions == null) {diff --git a/apps/web/lib/bounty/bounty-period.ts b/apps/web/lib/bounty/bounty-period.tsindex c6b859bbc3..1c71b80a98 100644--- a/apps/web/lib/bounty/bounty-period.ts+++ b/apps/web/lib/bounty/bounty-period.ts@@ -120,9 +120,9 @@ export function getProgramBountyMeta({ENDS_AFTER_DAYS_LABELS[endsAfterDays] ?? `${endsAfterDays} days`;dateRangeLabel = `${durationLabel} after joining`;} else if (endsAt) {- dateRangeLabel = `when a new partner joins → ${formatDate(endsAt, { month: "short" })}`;+ dateRangeLabel = `When a new partner joins → ${formatDate(endsAt, { month: "short" })}`;} else {- dateRangeLabel = "when a new partner joins";+ dateRangeLabel = "When a new partner joins";}} else {const startLabel = formatDate(startsAt, { month: "short" });@@ -133,6 +133,5 @@ export function getProgramBountyMeta({return {dateRangeLabel,- partnerAudienceLabel: isRelative ? "New partners only" : "All partners",};}diff --git a/apps/web/ui/shared/inline-badge-popover.tsx b/apps/web/ui/shared/inline-badge-popover.tsxindex 2e3749a52d..0633732ea9 100644--- a/apps/web/ui/shared/inline-badge-popover.tsx+++ b/apps/web/ui/shared/inline-badge-popover.tsx@@ -105,6 +105,7 @@ export type InlineBadgePopoverMenuItem<T> = {value: T;onSelect?: () => void;preventClose?: boolean;+ disabled?: boolean;};export function InlineBadgePopoverMenu<T extends any>({@@ -206,11 +207,14 @@ export function InlineBadgePopoverMenu<T extends any>({value,onSelect: itemOnSelect,preventClose,+ disabled,}) => (<Command.Itemkey={String(value)}value={`${text} ${description ?? ""} ${value}`}+ disabled={disabled}onSelect={() => {+ if (disabled) return;itemOnSelect?.();onSelect?.(value);!isMultiSelect && !preventClose && setIsOpen(false);@@ -218,6 +222,8 @@ export function InlineBadgePopoverMenu<T extends any>({className={cn("flex cursor-pointer justify-between rounded-md px-1.5 py-1 transition-colors duration-150 data-[selected=true]:bg-neutral-100",description ? "items-start gap-2 py-1.5" : "items-center",+ disabled &&+ "cursor-not-allowed opacity-50 data-[selected=true]:bg-transparent",)}><div