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.

attention to detail

Steven Teya6633c891287
diff --git a/apps/web/ui/layout/sidebar/usage.tsx b/apps/web/ui/layout/sidebar/usage.tsx
index 8711f434ea..8f0eb63119 100644
--- a/apps/web/ui/layout/sidebar/usage.tsx
+++ b/apps/web/ui/layout/sidebar/usage.tsx
@@ -11,6 +11,7 @@ import {
INFINITY_NUMBER,
nFormatter,
} from "@dub/utils";
+import NumberFlow from "@number-flow/react";
import { AnimatePresence, motion } from "framer-motion";
import { ChevronRight } from "lucide-react";
import Link from "next/link";
@@ -199,8 +200,19 @@ function UsageRow({
{!loading ? (
<div className="flex items-center">
<span className="text-xs font-medium text-neutral-600">
- {label === "Sales" ? "$" : ""}
- {formatNumber(label === "Sales" ? usage / 100 : usage)} of{" "}
+ <NumberFlow
+ value={label === "Sales" ? usage / 100 : usage}
+ format={
+ label === "Sales"
+ ? {
+ style: "currency",
+ currency: "USD",
+ maximumFractionDigits: 0,
+ }
+ : undefined
+ }
+ />{" "}
+ of{" "}
<motion.span
className={cn(
"relative transition-colors duration-150",
@@ -267,6 +279,7 @@ function UsageRow({
)}
style={{
transform: `translateX(-${100 - Math.floor((usage / Math.max(0, usage, limit)) * 100)}%)`,
+ transition: "transform 0.25s ease-in-out",
}}
/>
</div>
diff --git a/apps/web/ui/modals/link-builder/index.tsx b/apps/web/ui/modals/link-builder/index.tsx
index 1c8fcf1cf5..68a51d8e5e 100644
--- a/apps/web/ui/modals/link-builder/index.tsx
+++ b/apps/web/ui/modals/link-builder/index.tsx
@@ -268,14 +268,10 @@ function LinkBuilderInner({
});
if (res.status === 200) {
- await Promise.all([
- mutatePrefix([
- "/api/links",
- // if updating root domain link, mutate domains as well
- ...(key === "_root" ? ["/api/domains"] : []),
- ]),
- // Mutate workspace to update usage stats
- mutate(`/api/workspaces/${slug}`),
+ await mutatePrefix([
+ "/api/links",
+ // if updating root domain link, mutate domains as well
+ ...(key === "_root" ? ["/api/domains"] : []),
]);
const data = await res.json();
posthog.capture(
@@ -295,6 +291,9 @@ function LinkBuilderInner({
draftControlsRef.current?.onSubmitSuccessful();
setShowLinkBuilder(false);
+
+ // Mutate workspace to update usage stats
+ mutate(`/api/workspaces/${slug}`);
} else {
const { error } = await res.json();