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.

Add progress circles to submissions table

Tim Wilsonb2268929f676
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
index 5401421221..e8286a6dbc 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
@@ -10,6 +10,7 @@ import { PartnerRowItem } from "@/ui/partners/partner-row-item";
import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";
import { UserRowItem } from "@/ui/users/user-row-item";
import {
+ ProgressCircle,
StatusBadge,
Table,
usePagination,
@@ -244,9 +245,12 @@ export function BountySubmissionsTable() {
: nFormatter(target);
return (
- <span className="text-sm font-medium leading-5 text-neutral-600">
- {formattedValue} / {formattedTarget}
- </span>
+ <div className="flex items-center gap-2">
+ <ProgressCircle progress={value / target} />
+ <span className="min-w-0 text-sm font-medium leading-5 text-neutral-600">
+ {formattedValue} / {formattedTarget}
+ </span>
+ </div>
);
},
},
diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx
index f18175dc21..bb6141189a 100644
--- a/packages/ui/src/index.tsx
+++ b/packages/ui/src/index.tsx
@@ -29,6 +29,7 @@ export * from "./modal";
export * from "./number-stepper";
export * from "./pagination-controls";
export * from "./popover";
+export * from "./progress-circle";
export * from "./radio-group";
export * from "./sheet";
export * from "./shimmer-dots";
diff --git a/packages/ui/src/progress-circle.tsx b/packages/ui/src/progress-circle.tsx
new file mode 100644
index 0000000000..792a2da741
--- /dev/null
+++ b/packages/ui/src/progress-circle.tsx
@@ -0,0 +1,52 @@
+import { cn } from "@dub/utils";
+
+export function ProgressCircle({
+ progress: progressProp,
+ strokeWidth = 16,
+ className,
+}: {
+ progress: number;
+ strokeWidth?: number;
+ className?: string;
+}) {
+ const progress = Math.min(Math.max(progressProp, 0), 1);
+
+ const radius = (100 - strokeWidth) / 2;
+ const circumference = radius * Math.PI * 2;
+ const dash = progress * circumference;
+
+ return (
+ <svg
+ width="100"
+ height="100"
+ viewBox="0 0 100 100"
+ className={cn("size-3 shrink-0 text-green-600", className)}
+ >
+ <circle
+ cx="50"
+ cy="50"
+ r={radius}
+ stroke="#ddd"
+ strokeWidth={`${strokeWidth}px`}
+ fill="none"
+ strokeLinecap="round"
+ />
+ {progress > 0 && (
+ <circle
+ cx="50"
+ cy="50"
+ r={radius}
+ stroke="currentColor"
+ strokeWidth={`${strokeWidth}px`}
+ fill="none"
+ strokeLinecap="round"
+ strokeDasharray={`${dash} ${circumference - dash}`}
+ style={{
+ transformOrigin: "50px 50px",
+ transform: `rotate(-90deg)`,
+ }}
+ />
+ )}
+ </svg>
+ );
+}