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.

Workspace and partner bounty updates (#3164)

Marcus Farrellab2e64ffcfc5
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx
index 223a05d8d2..2f0f692368 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx
@@ -1,4 +1,3 @@
-import { getBountyRewardDescription } from "@/lib/partners/get-bounty-reward-description";
import { PartnerBountyProps } from "@/lib/types";
import { BountyPerformance } from "@/ui/partners/bounties/bounty-performance";
import { BountyThumbnailImage } from "@/ui/partners/bounties/bounty-thumbnail-image";
@@ -9,7 +8,7 @@ import {
TimestampTooltip,
TooltipContent,
} from "@dub/ui";
-import { Calendar6, Gift } from "@dub/ui/icons";
+import { Calendar6 } from "@dub/ui/icons";
import { cn, formatDate, formatDateTimeSmart } from "@dub/utils";
import { useParams } from "next/navigation";
@@ -45,13 +44,13 @@ export function PartnerBountyCard({ bounty }: { bounty: PartnerBountyProps }) {
onClick={() => setShowClaimBountyModal(true)}
disabled={expiredBounty}
className={cn(
- "border-border-subtle group relative flex w-full cursor-pointer flex-col gap-5 overflow-hidden rounded-xl border bg-white p-5 text-left",
+ "border-border-subtle group relative flex w-full cursor-pointer flex-col gap-2.5 overflow-hidden rounded-xl border bg-white p-3 text-left",
expiredBounty
? "cursor-not-allowed"
: "hover:border-border-default transition-all hover:shadow-lg",
)}
>
- <div className="relative flex h-[132px] items-center justify-center rounded-lg bg-neutral-100 py-1.5">
+ <div className="relative flex h-[124px] items-center justify-center rounded-lg bg-neutral-100 py-3">
<div className="relative size-full">
<BountyThumbnailImage bounty={bounty} />
</div>
@@ -65,8 +64,8 @@ export function PartnerBountyCard({ bounty }: { bounty: PartnerBountyProps }) {
)}
</div>
- <div className="flex min-w-0 flex-col gap-1.5">
- <h3 className="text-content-emphasis truncate text-sm font-semibold">
+ <div className="flex min-w-0 flex-col gap-1.5 px-2 pb-1.5">
+ <h3 className="text-content-emphasis text-sm font-semibold sm:truncate">
{bounty.name}
</h3>
@@ -91,16 +90,9 @@ export function PartnerBountyCard({ bounty }: { bounty: PartnerBountyProps }) {
)}
</span>
</div>
-
- <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
- <Gift className="size-3.5 shrink-0" />
- <span className="truncate">
- {getBountyRewardDescription(bounty)}
- </span>
- </div>
</div>
- <div className="flex grow flex-col justify-end">
+ <div className="flex grow flex-col justify-end px-2 pb-1">
{renderSubmissionStatus({
bounty,
setShowClaimBountyModal,
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.tsx
index 4ef7e23520..1884c48ef5 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
@@ -6,15 +6,20 @@ import {
SubmissionsCountByStatus,
useBountySubmissionsCount,
} from "@/lib/swr/use-bounty-submissions-count";
+import useGroups from "@/lib/swr/use-groups";
import { usePartnersCountByGroupIds } from "@/lib/swr/use-partners-count-by-groupids";
+import useWorkspace from "@/lib/swr/use-workspace";
import { 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, Gift, Users, Users6 } from "@dub/ui/icons";
import { formatDate, nFormatter, pluralize } from "@dub/utils";
-import { CalendarDays, Gift, Users } from "lucide-react";
import { useMemo } from "react";
import { BountyActionButton } from "../bounty-action-button";
export function BountyInfo() {
const { bounty, loading } = useBounty();
+ const { isOwner } = useWorkspace();
const { submissionsCount } = useBountySubmissionsCount<
SubmissionsCountByStatus[]
@@ -34,9 +39,20 @@ export function BountyInfo() {
const { totalPartners, loading: totalPartnersForBountyLoading } =
usePartnersCountByGroupIds({
- groupIds: bounty?.groups.map((group) => group.id),
+ groupIds: bounty?.groups?.map((group) => group.id) ?? [],
});
+ const { groups } = useGroups();
+
+ const eligibleGroups = useMemo(() => {
+ if (!groups || !bounty || bounty.groups.length === 0) {
+ return [];
+ }
+ return bounty.groups
+ .map((bountyGroup) => groups.find((g) => g.id === bountyGroup.id))
+ .filter((g): g is NonNullable<typeof g> => g !== undefined);
+ }, [groups, bounty]);
+
if (loading) {
return <BountyInfoSkeleton />;
}
@@ -46,19 +62,22 @@ export function BountyInfo() {
}
return (
- <div className="flex flex-col items-center gap-3 sm:flex-row sm:items-start sm:gap-6">
- <div className="relative flex h-[100px] w-[100px] shrink-0 items-center justify-center rounded-lg bg-neutral-100 p-3">
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:gap-6">
+ <div className="relative flex h-[100px] w-full items-center justify-center rounded-lg bg-neutral-100 p-4 sm:h-[100px] sm:w-[100px] sm:shrink-0">
<BountyThumbnailImage bounty={bounty} />
+ <div className="absolute right-2 top-2 sm:hidden">
+ <BountyActionButton bounty={bounty} />
+ </div>
</div>
<div className="flex min-w-0 flex-1 flex-col gap-1.5">
- <h3 className="truncate text-base font-semibold leading-6 text-neutral-900">
+ <h3 className="break-words text-base font-semibold leading-6 text-neutral-900 sm:truncate">
{bounty.name}
</h3>
- <div className="flex items-center space-x-2">
- <CalendarDays className="size-4 shrink-0" />
- <span className="text-sm font-medium text-neutral-500">
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
+ <Calendar6 className="size-4 shrink-0" />
+ <span>
{formatDate(bounty.startsAt, { month: "short" })}
{" → "}
{bounty.endsAt
@@ -67,44 +86,55 @@ export function BountyInfo() {
</span>
</div>
- <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
- <Gift className="size-4 shrink-0" />
- <span className="text-ellipsis">
- {getBountyRewardDescription(bounty)}
- </span>
- </div>
+ {!isOwner && (
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
+ <Gift className="size-4 shrink-0" />
+ <span className="text-ellipsis">
+ {getBountyRewardDescription(bounty)}
+ </span>
+ </div>
+ )}
- <div className="flex items-center space-x-2">
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
<Users className="size-4 shrink-0" />
- <div className="text-sm text-neutral-500">
- {totalSubmissions === totalPartners ? (
- <>All</>
+ <div>
+ {totalPartnersForBountyLoading ? (
+ <span className="inline-block h-4 w-8 animate-pulse rounded bg-neutral-200 align-middle" />
+ ) : totalPartners === 0 ? (
+ <>
+ <span className="text-content-default">0</span>{" "}
+ {pluralize("partner", 0)}{" "}
+ {bounty.type === "performance" ? "completed" : "submitted"}
+ </>
+ ) : totalSubmissions === totalPartners ? (
+ <>
+ All{" "}
+ <span className="text-content-default">
+ {nFormatter(totalPartners, { full: true })}
+ </span>{" "}
+ {pluralize("partner", totalPartners)}{" "}
+ {bounty.type === "performance" ? "completed" : "submitted"}
+ </>
) : (
<>
- <span className="font-medium text-neutral-700">
+ <span className="text-content-default">
{nFormatter(totalSubmissions ?? 0, {
full: true,
})}
</span>{" "}
- of
- </>
- )}{" "}
- {totalPartnersForBountyLoading ? (
- <span className="inline-block h-4 w-8 animate-pulse rounded bg-neutral-200 align-middle" />
- ) : (
- <>
- <span className="font-medium text-neutral-700">
+ of{" "}
+ <span className="text-content-default">
{nFormatter(totalPartners, { full: true })}
- </span>
+ </span>{" "}
+ {pluralize("partner", totalPartners)}{" "}
+ {bounty.type === "performance" ? "completed" : "submitted"}
</>
- )}{" "}
- {pluralize("partner", totalSubmissions ?? totalPartners)}{" "}
- {bounty.type === "performance" ? "completed" : "submitted"}
+ )}
{readyForReviewSubmissions > 0 && (
<>
{" "}
(
- <span className="font-medium text-neutral-700">
+ <span className="text-content-default">
{nFormatter(readyForReviewSubmissions, { full: true })}
</span>{" "}
awaiting review)
@@ -112,9 +142,45 @@ export function BountyInfo() {
)}
</div>
</div>
+
+ {isOwner && (
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
+ <Users6 className="size-4 shrink-0" />
+ {bounty.groups.length === 0 ? (
+ <span>All groups</span>
+ ) : eligibleGroups.length === 1 ? (
+ <div className="flex items-center gap-1.5">
+ <GroupColorCircle group={eligibleGroups[0]} />
+ <span className="truncate">{eligibleGroups[0].name}</span>
+ </div>
+ ) : eligibleGroups.length > 1 ? (
+ <Tooltip
+ content={
+ <ScrollableTooltipContent>
+ {eligibleGroups.map((group) => (
+ <div key={group.id} className="flex items-center gap-2">
+ <GroupColorCircle group={group} />
+ <span className="font-regular text-sm text-neutral-700">
+ {group.name}
+ </span>
+ </div>
+ ))}
+ </ScrollableTooltipContent>
+ }
+ >
+ <div className="flex items-center gap-1.5">
+ <GroupColorCircle group={eligibleGroups[0]} />
+ <span className="truncate">
+ {eligibleGroups[0].name} +{eligibleGroups.length - 1}
+ </span>
+ </div>
+ </Tooltip>
+ ) : null}
+ </div>
+ )}
</div>
- <div className="flex items-start">
+ <div className="hidden items-start sm:flex">
<BountyActionButton bounty={bounty} />
</div>
</div>
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.tsx
index 005012c046..c62e0b629c 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
@@ -1,26 +1,40 @@
-import { getBountyRewardDescription } from "@/lib/partners/get-bounty-reward-description";
+import useGroups from "@/lib/swr/use-groups";
import { usePartnersCountByGroupIds } from "@/lib/swr/use-partners-count-by-groupids";
import useWorkspace from "@/lib/swr/use-workspace";
import { BountyListProps } from "@/lib/types";
import { BountyThumbnailImage } from "@/ui/partners/bounties/bounty-thumbnail-image";
-import { Calendar6, Gift, Users } from "@dub/ui/icons";
+import { GroupColorCircle } from "@/ui/partners/groups/group-color-circle";
+import { DynamicTooltipWrapper, ScrollableTooltipContent } from "@dub/ui";
+import { Calendar6, Users, Users6 } from "@dub/ui/icons";
import { formatDate, nFormatter, pluralize } from "@dub/utils";
import Link from "next/link";
+import { useMemo } from "react";
export function BountyCard({ bounty }: { bounty: BountyListProps }) {
- const { slug: workspaceSlug } = useWorkspace();
+ const { slug: workspaceSlug, isOwner } = useWorkspace();
const { totalPartners, loading } = usePartnersCountByGroupIds({
groupIds: bounty.groups.map((group) => group.id),
});
+ const { groups } = useGroups();
+
+ const eligibleGroups = useMemo(() => {
+ if (!groups || bounty.groups.length === 0) {
+ return [];
+ }
+ return bounty.groups
+ .map((bountyGroup) => groups.find((g) => g.id === bountyGroup.id))
+ .filter((g): g is NonNullable<typeof g> => g !== undefined);
+ }, [groups, bounty.groups]);
+
return (
- <div className="border-border-subtle hover:border-border-default relative cursor-pointer rounded-xl border bg-white p-5 transition-all hover:shadow-lg">
+ <div className="border-border-subtle hover:border-border-default relative cursor-pointer rounded-xl border bg-white p-2 transition-all hover:shadow-lg">
<Link
href={`/${workspaceSlug}/program/bounties/${bounty.id}`}
- className="flex flex-col gap-5"
+ className="flex flex-col gap-3.5"
>
- <div className="relative flex h-[132px] items-center justify-center rounded-lg bg-neutral-100 py-1.5">
+ <div className="relative flex h-[124px] items-center justify-center rounded-lg bg-neutral-100 py-3">
<div className="relative size-full">
<BountyThumbnailImage bounty={bounty} />
</div>
@@ -38,12 +52,12 @@ export function BountyCard({ bounty }: { bounty: BountyListProps }) {
</div>
</div>
- <div className="flex flex-col gap-1.5">
- <h3 className="text-content-emphasis truncate text-sm font-semibold">
+ <div className="flex flex-col gap-1.5 px-2 pb-1.5">
+ <h3 className="text-content-emphasis text-sm font-semibold md:truncate">
{bounty.name}
</h3>
- <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
<Calendar6 className="size-3.5" />
<span>
{formatDate(bounty.startsAt, { month: "short" })}
@@ -56,18 +70,26 @@ export function BountyCard({ bounty }: { bounty: BountyListProps }) {
</span>
</div>
- <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
- <Gift className="size-3.5 shrink-0" />
- <span className="truncate">
- {getBountyRewardDescription(bounty)}
- </span>
- </div>
-
- <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
<Users className="size-3.5" />
<div className="h-5">
- {bounty.submissionsCountData?.total === totalPartners ? (
- <>All</>
+ {loading ? (
+ <span className="inline-block h-5 w-8 animate-pulse rounded bg-neutral-200 align-middle" />
+ ) : totalPartners === 0 ? (
+ <>
+ <span className="text-content-default">0</span>{" "}
+ {pluralize("partner", 0)}{" "}
+ {bounty.type === "performance" ? "completed" : "submitted"}
+ </>
+ ) : bounty.submissionsCountData?.total === totalPartners ? (
+ <>
+ All{" "}
+ <span className="text-content-default">
+ {nFormatter(totalPartners, { full: true })}
+ </span>{" "}
+ {pluralize("partner", totalPartners)}{" "}
+ {bounty.type === "performance" ? "completed" : "submitted"}
+ </>
) : (
<>
<span className="text-content-default">
@@ -75,25 +97,59 @@ export function BountyCard({ bounty }: { bounty: BountyListProps }) {
full: true,
})}
</span>{" "}
- of
- </>
- )}{" "}
- {loading ? (
- <span className="inline-block h-4 w-8 animate-pulse rounded bg-neutral-200 align-middle" />
- ) : (
- <>
+ of{" "}
<span className="text-content-default">
{nFormatter(totalPartners, { full: true })}
</span>{" "}
+ {pluralize("partner", totalPartners)}{" "}
+ {bounty.type === "performance" ? "completed" : "submitted"}
</>
- )}{" "}
- {pluralize(
- "partner",
- bounty.submissionsCountData?.total || totalPartners,
- )}{" "}
- {bounty.type === "performance" ? "completed" : "submitted"}
+ )}
</div>
</div>
+
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
+ <Users6 className="size-3.5" />
+ {bounty.groups.length === 0 ? (
+ <span>All groups</span>
+ ) : eligibleGroups.length > 0 ? (
+ <DynamicTooltipWrapper
+ tooltipProps={
+ eligibleGroups.length > 1
+ ? {
+ content: (
+ <ScrollableTooltipContent>
+ {eligibleGroups.map((group) => (
+ <div
+ key={group.id}
+ className="flex items-center gap-2"
+ >
+ <GroupColorCircle group={group} />
+ <span className="font-regular text-sm text-neutral-700">
+ {group.name}
+ </span>
+ </div>
+ ))}
+ </ScrollableTooltipContent>
+ ),
+ }
+ : undefined
+ }
+ >
+ <div className="flex items-center gap-1.5">
+ <GroupColorCircle group={eligibleGroups[0]} />
+ <span className="truncate">
+ {eligibleGroups[0].name}{" "}
+ {eligibleGroups.length > 1
+ ? `+${eligibleGroups.length - 1}`
+ : ""}
+ </span>
+ </div>
+ </DynamicTooltipWrapper>
+ ) : (
+ <div className="h-5 w-32 animate-pulse rounded bg-neutral-200" />
+ )}
+ </div>
</div>
</Link>
</div>
@@ -118,18 +174,24 @@ function BountyEndedBadge({ endsAt }: { endsAt: Date }) {
export function BountyCardSkeleton() {
return (
- <div className="border-border-subtle rounded-xl border bg-white p-5">
- <div className="flex flex-col gap-5">
- <div className="flex h-[132px] animate-pulse items-center justify-center rounded-lg bg-neutral-100 px-32 py-4" />
- <div className="flex flex-col gap-1.5">
- <div className="h-5 w-48 animate-pulse rounded-md bg-neutral-200" />
- <div className="flex h-5 items-center space-x-2">
- <div className="size-4 animate-pulse rounded bg-neutral-200" />
- <div className="h-4 w-32 animate-pulse rounded bg-neutral-200" />
+ <div className="border-border-subtle rounded-xl border bg-white p-2">
+ <div className="flex flex-col gap-3.5">
+ <div className="relative flex h-[124px] items-center justify-center rounded-lg bg-neutral-100 py-3">
+ <div className="h-full w-full animate-pulse rounded bg-neutral-200" />
+ </div>
+ <div className="flex flex-col gap-1.5 px-2 pb-1.5">
+ <div className="h-5 w-48 animate-pulse rounded bg-neutral-200" />
+ <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-32 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-48 animate-pulse rounded bg-neutral-200" />
</div>
- <div className="flex h-5 items-center space-x-2">
- <div className="size-4 animate-pulse rounded bg-neutral-200" />
- <div className="h-4 w-48 animate-pulse rounded bg-neutral-200" />
+ <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" />
</div>
</div>
</div>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/confirm-create-bounty-modal.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/confirm-create-bounty-modal.tsx
index 771d174640..10b24ef56e 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/confirm-create-bounty-modal.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/confirm-create-bounty-modal.tsx
@@ -1,9 +1,11 @@
import { getBountyRewardDescription } from "@/lib/partners/get-bounty-reward-description";
import { getPlanCapabilities } from "@/lib/plan-capabilities";
+import useGroups from "@/lib/swr/use-groups";
import { usePartnersCountByGroupIds } from "@/lib/swr/use-partners-count-by-groupids";
import useWorkspace from "@/lib/swr/use-workspace";
import { BountyProps } from "@/lib/types";
import { BountyThumbnailImage } from "@/ui/partners/bounties/bounty-thumbnail-image";
+import { GroupColorCircle } from "@/ui/partners/groups/group-color-circle";
import {
Button,
Calendar6,
@@ -11,11 +13,19 @@ import {
DynamicTooltipWrapper,
Gift,
Modal,
+ ScrollableTooltipContent,
+ Tooltip,
TooltipContent,
} from "@dub/ui";
+import { Users6 } from "@dub/ui/icons";
import { formatDate, nFormatter, pluralize } from "@dub/utils";
import { cn } from "@dub/utils/src";
-import { Dispatch, SetStateAction, useState } from "react";
+import {
+ Dispatch,
+ SetStateAction,
+ useMemo,
+ useState,
+} from "react";
type ConfirmCreateBountyModalProps = {
bounty?: Pick<
@@ -40,7 +50,7 @@ function ConfirmCreateBountyModal({
showConfirmCreateBountyModal: boolean;
setShowConfirmCreateBountyModal: Dispatch<SetStateAction<boolean>>;
} & ConfirmCreateBountyModalProps) {
- const { plan, slug: workspaceSlug } = useWorkspace();
+ const { plan, slug: workspaceSlug, isOwner } = useWorkspace();
const { canSendEmailCampaigns } = getPlanCapabilities(plan);
const [isLoading, setIsLoading] = useState(false);
@@ -49,9 +59,20 @@ function ConfirmCreateBountyModal({
);
const { totalPartners, loading } = usePartnersCountByGroupIds({
- groupIds: bounty?.groups.map((group) => group.id),
+ groupIds: bounty?.groups?.map((group) => group.id) ?? [],
});
+ const { groups } = useGroups();
+
+ const eligibleGroups = useMemo(() => {
+ if (!groups || !bounty || bounty.groups.length === 0) {
+ return [];
+ }
+ return bounty.groups
+ .map((bountyGroup) => groups.find((g) => g.id === bountyGroup.id))
+ .filter((g): g is NonNullable<typeof g> => g !== undefined);
+ }, [groups, bounty?.groups]);
+
const handleConfirm = async () => {
setIsLoading(true);
try {
@@ -75,34 +96,76 @@ function ConfirmCreateBountyModal({
You are about to create this bounty for the selected partner groups.
</p>
- <div className="border-border-default mt-4 flex items-center gap-3 rounded-xl border p-2">
- <div className="relative flex size-[70px] shrink-0 items-center justify-center rounded-lg bg-neutral-100 p-2">
- <BountyThumbnailImage bounty={bounty} />
- </div>
-
- <div className="flex min-w-0 flex-col gap-1">
- <h3 className="text-content-emphasis truncate text-sm font-semibold">
- {bounty.name}
- </h3>
-
- <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
- <Calendar6 className="size-3.5" />
- <span>
- {formatDate(bounty.startsAt, { month: "short" })}
- {bounty.endsAt && (
- <>
- {" → "}
- {formatDate(bounty.endsAt, { month: "short" })}
- </>
- )}
- </span>
+ <div className="border-border-subtle mt-4 rounded-xl border bg-white p-2">
+ <div className="flex flex-col gap-3.5">
+ <div className="relative flex h-[124px] items-center justify-center rounded-lg bg-neutral-100 py-5">
+ <div className="relative size-full">
+ <BountyThumbnailImage bounty={bounty} />
+ </div>
</div>
- <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
- <Gift className="size-3.5 shrink-0" />
- <span className="truncate">
- {getBountyRewardDescription(bounty)}
- </span>
+ <div className="flex flex-col gap-1.5 px-2 pb-1.5">
+ <h3 className="text-content-emphasis truncate text-sm font-semibold">
+ {bounty.name}
+ </h3>
+
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
+ <Calendar6 className="size-3.5" />
+ <span>
+ {formatDate(bounty.startsAt, { month: "short" })}
+ {bounty.endsAt && (
+ <>
+ {" → "}
+ {formatDate(bounty.endsAt, { month: "short" })}
+ </>
+ )}
+ </span>
+ </div>
+
+ {!isOwner && (
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
+ <Gift className="size-3.5 shrink-0" />
+ <span className="truncate">
+ {getBountyRewardDescription(bounty)}
+ </span>
+ </div>
+ )}
+
+ {isOwner && (
+ <div className="text-content-subtle font-regular flex items-center gap-2 text-sm">
+ <Users6 className="size-3.5" />
+ {bounty.groups.length === 0 ? (
+ <span>All groups</span>
+ ) : eligibleGroups.length === 1 ? (
+ <div className="flex items-center gap-1.5">
+ <GroupColorCircle group={eligibleGroups[0]} />
+ <span className="truncate">{eligibleGroups[0].name}</span>
+ </div>
+ ) : eligibleGroups.length > 1 ? (
+ <Tooltip
+ content={
+ <ScrollableTooltipContent>
+ {eligibleGroups.map((group) => (
+ <div key={group.id} className="flex items-center gap-2">
+ <GroupColorCircle group={group} />
+ <span className="font-regular text-sm text-neutral-700">
+ {group.name}
+ </span>
+ </div>
+ ))}
+ </ScrollableTooltipContent>
+ }
+ >
+ <div className="flex items-center gap-1.5">
+ <GroupColorCircle group={eligibleGroups[0]} />
+ <span className="truncate">
+ {eligibleGroups[0].name} +{eligibleGroups.length - 1}
+ </span>
+ </div>
+ </Tooltip>
+ ) : null}
+ </div>
+ )}
</div>
</div>
</div>
diff --git a/apps/web/ui/partners/bounties/claim-bounty-modal.tsx b/apps/web/ui/partners/bounties/claim-bounty-modal.tsx
index 45f0f08141..95a1d8c36c 100644
--- a/apps/web/ui/partners/bounties/claim-bounty-modal.tsx
+++ b/apps/web/ui/partners/bounties/claim-bounty-modal.tsx
@@ -6,7 +6,6 @@ import {
BOUNTY_MAX_SUBMISSION_URLS,
REJECT_BOUNTY_SUBMISSION_REASONS,
} from "@/lib/constants/bounties";
-import { getBountyRewardDescription } from "@/lib/partners/get-bounty-reward-description";
import { mutatePrefix } from "@/lib/swr/mutate";
import useProgramEnrollment from "@/lib/swr/use-program-enrollment";
import { PartnerBountyProps } from "@/lib/types";
@@ -18,7 +17,6 @@ import {
Button,
Calendar6,
FileUpload,
- Gift,
LoadingSpinner,
Modal,
PROSE_STYLES,
@@ -300,13 +298,6 @@ function ClaimBountyModalContent({ bounty }: ClaimBountyModalProps) {
</span>
</div>
- <div className="text-content-subtle flex items-center gap-2 text-sm font-medium">
- <Gift className="size-3.5 shrink-0" />
- <span className="truncate">
- {getBountyRewardDescription(bounty)}
- </span>
- </div>
-
{submission ? (
<div className="mt-3 grid gap-2">
<div className="flex items-center gap-2">
diff --git a/packages/ui/src/tooltip.tsx b/packages/ui/src/tooltip.tsx
index cd7d49f60e..595db4aac4 100644
--- a/packages/ui/src/tooltip.tsx
+++ b/packages/ui/src/tooltip.tsx
@@ -4,10 +4,11 @@ import { cn } from "@dub/utils";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import { HelpCircle } from "lucide-react";
import Link from "next/link";
-import { ReactNode, useState } from "react";
+import { ReactNode, useEffect, useRef, useState } from "react";
import ReactMarkdown from "react-markdown";
import { Badge } from "./badge";
import { Button, ButtonProps, buttonVariants } from "./button";
+import { useScrollProgress } from "./hooks/use-scroll-progress";
import { PROSE_STYLES } from "./rich-text-area";
export function TooltipProvider({ children }: { children: ReactNode }) {
@@ -219,3 +220,59 @@ export function DynamicTooltipWrapper({
children
);
}
+
+export function ScrollableTooltipContent({
+ children,
+ maxHeight = "240px",
+ className,
+}: {
+ children: ReactNode;
+ maxHeight?: string;
+ className?: string;
+}) {
+ const scrollRef = useRef<HTMLDivElement>(null);
+ const { scrollProgress, updateScrollProgress } = useScrollProgress(
+ scrollRef,
+ {
+ direction: "vertical",
+ },
+ );
+
+ const [showTopGradient, setShowTopGradient] = useState(false);
+ const [showBottomGradient, setShowBottomGradient] = useState(false);
+
+ useEffect(() => {
+ const element = scrollRef.current;
+ if (!element) return;
+
+ const { scrollHeight, clientHeight } = element;
+ const canScroll = scrollHeight > clientHeight;
+
+ // Show top gradient if not at top and can scroll
+ setShowTopGradient(canScroll && scrollProgress > 0);
+ // Show bottom gradient if not at bottom and can scroll
+ setShowBottomGradient(canScroll && scrollProgress < 1);
+ }, [scrollProgress]);
+
+ return (
+ <div className="relative">
+ {showTopGradient && (
+ <div className="pointer-events-none absolute left-0 right-0 top-0 z-10 h-6 rounded-t-xl bg-gradient-to-b from-white to-transparent" />
+ )}
+ <div
+ ref={scrollRef}
+ onScroll={updateScrollProgress}
+ className={cn(
+ "flex flex-col gap-2 overflow-y-auto px-3 py-2",
+ className,
+ )}
+ style={{ maxHeight }}
+ >
+ {children}
+ </div>
+ {showBottomGradient && (
+ <div className="pointer-events-none absolute bottom-0 left-0 right-0 z-10 h-6 rounded-b-xl bg-gradient-to-t from-white to-transparent" />
+ )}
+ </div>
+ );
+}