The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Show circle progress in the partner bounties list view (#4686)
Rafie9b3fb713ab3
diff --git a/apps/web/ui/partners/bounties/bounty-performance.tsx b/apps/web/ui/partners/bounties/bounty-performance.tsxindex 85f14aace8..98bae0bf0d 100644--- a/apps/web/ui/partners/bounties/bounty-performance.tsx+++ b/apps/web/ui/partners/bounties/bounty-performance.tsx@@ -4,6 +4,7 @@ import { PartnerBountyProps } from "@/lib/types";import { cn, currencyFormatter, nFormatter } from "@dub/utils";import {BountyProgressBarRow,+ BountyProgressVariant,EmphasisNumber,} from "./bounty-progress-bar-row";@@ -11,12 +12,12 @@ export function PerformanceBountyProgress({bounty,labelClassName,wrapperClassName,- hideBar,+ variant,}: {bounty: PartnerBountyProps;labelClassName?: string;wrapperClassName?: string;- hideBar?: boolean;+ variant?: BountyProgressVariant;}) {const performanceCondition = bounty.performanceCondition;@@ -49,7 +50,7 @@ export function PerformanceBountyProgress({progress={percent}labelClassName={labelClassName}wrapperClassName={wrapperClassName}- hideBar={hideBar}+ variant={variant}><EmphasisNumber>{formattedValue}</EmphasisNumber> of{" "}<EmphasisNumber>{formattedTarget}</EmphasisNumber> {metricLabel} generated@@ -62,13 +63,13 @@ export function SubmissionBountyProgress({labelClassName,wrapperClassName,className,- hideBar,+ variant,}: {bounty: PartnerBountyProps;labelClassName?: string;wrapperClassName?: string;className?: string;- hideBar?: boolean;+ variant?: BountyProgressVariant;}) {const submittedCount = bounty.submissions.filter(({ status }) => status !== "draft",@@ -88,7 +89,7 @@ export function SubmissionBountyProgress({progress={submittedPercent}labelClassName={labelClassName}wrapperClassName={wrapperClassName}- hideBar={hideBar}+ variant={variant}><EmphasisNumber>{submittedCount}</EmphasisNumber> of{" "}<EmphasisNumber>{maxSubmissions}</EmphasisNumber> submitted@@ -97,7 +98,7 @@ export function SubmissionBountyProgress({progress={approvedPercent}labelClassName={labelClassName}wrapperClassName={wrapperClassName}- hideBar={hideBar}+ variant={variant}><EmphasisNumber>{approvedCount}</EmphasisNumber> approved</BountyProgressBarRow>diff --git a/apps/web/ui/partners/bounties/bounty-progress-bar-row.tsx b/apps/web/ui/partners/bounties/bounty-progress-bar-row.tsxindex 7ddcf32b21..3e4e1e3806 100644--- a/apps/web/ui/partners/bounties/bounty-progress-bar-row.tsx+++ b/apps/web/ui/partners/bounties/bounty-progress-bar-row.tsx@@ -1,3 +1,4 @@+import { ProgressCircle } from "@dub/ui";import { cn } from "@dub/utils";import { ReactNode } from "react";@@ -9,22 +10,47 @@ export function EmphasisNumber({ children }: { children: ReactNode }) {);}+export type BountyProgressVariant = "bar" | "circle";+export function BountyProgressBarRow({progress,children,labelClassName,wrapperClassName,- hideBar = false,+ variant = "bar",}: {progress: number;children: ReactNode;labelClassName?: string;wrapperClassName?: string;- hideBar?: boolean;+ // the compact list view shows a circle before the label instead of a bar above it+ variant?: BountyProgressVariant;}) {const percent = Math.min(Math.max(progress, 0), 100);const isComplete = percent >= 100;+ const label = (+ <p+ className={cn("text-content-subtle text-xs font-medium", labelClassName)}+ >+ {children}+ </p>+ );++ if (variant === "circle") {+ return (+ <div+ className={cn(+ "flex min-w-0 flex-1 items-center",+ wrapperClassName ?? "gap-1.5",+ )}+ >+ <ProgressCircle progress={percent / 100} />+ {label}+ </div>+ );+ }+return (<divclassName={cn(@@ -32,25 +58,16 @@ export function BountyProgressBarRow({wrapperClassName ?? "gap-2",)}>- {!hideBar && (- <div className="bg-bg-emphasis h-1 w-full overflow-hidden rounded-full">- <div- className={cn(- "h-full rounded-full",- isComplete ? "bg-green-600" : "bg-amber-600",- )}- style={{ width: `${percent}%` }}- />- </div>- )}- <p- className={cn(- "text-content-subtle text-xs font-medium",- labelClassName,- )}- >- {children}- </p>+ <div className="bg-bg-emphasis h-1 w-full overflow-hidden rounded-full">+ <div+ className={cn(+ "h-full rounded-full",+ isComplete ? "bg-green-600" : "bg-amber-600",+ )}+ style={{ width: `${percent}%` }}+ />+ </div>+ {label}</div>);}diff --git a/apps/web/ui/partners/bounties/partner-bounties-table.tsx b/apps/web/ui/partners/bounties/partner-bounties-table.tsxindex 83e97d5f7c..831a0142d0 100644--- a/apps/web/ui/partners/bounties/partner-bounties-table.tsx+++ b/apps/web/ui/partners/bounties/partner-bounties-table.tsx@@ -96,12 +96,12 @@ const COLUMNS: ColumnDef<PartnerBountyRow>[] = [minSize: 240,cell: ({ row }) =>row.original.type === "performance" ? (- <PerformanceBountyProgress bounty={row.original} hideBar />+ <PerformanceBountyProgress bounty={row.original} variant="circle" />) : (<SubmissionBountyProgressbounty={row.original}className="flex-row"- hideBar+ variant="circle"/>),},