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.

remove trailingZeroDisplay

Steven Teyaba23b46fd77
diff --git a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
index 9107e636bb..9f6baa8300 100644
--- a/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
+++ b/apps/web/app/app.dub.co/(onboarding)/onboarding/(steps)/plan/plan-selector.tsx
@@ -79,7 +79,6 @@ function PlanCard({
format={{
style: "currency",
currency: "USD",
- trailingZeroDisplay: "stripIfInteger",
}}
/>
<span className="ml-1 text-sm font-medium">
diff --git a/apps/web/ui/analytics/events/events-tabs.tsx b/apps/web/ui/analytics/events/events-tabs.tsx
index 65f6cff257..bb5c1593b8 100644
--- a/apps/web/ui/analytics/events/events-tabs.tsx
+++ b/apps/web/ui/analytics/events/events-tabs.tsx
@@ -114,7 +114,6 @@ export default function EventsTabs({
? {
style: "currency",
currency: "USD",
- trailingZeroDisplay: "stripIfInteger",
}
: {
notation:
diff --git a/apps/web/ui/analytics/main.tsx b/apps/web/ui/analytics/main.tsx
index f5b3dbf479..fb61ff8b01 100644
--- a/apps/web/ui/analytics/main.tsx
+++ b/apps/web/ui/analytics/main.tsx
@@ -119,7 +119,6 @@ export default function Main() {
? {
style: "currency",
currency: "USD",
- trailingZeroDisplay: "stripIfInteger",
}
: {
notation:
diff --git a/packages/ui/src/counting-numbers.tsx b/packages/ui/src/counting-numbers.tsx
deleted file mode 100644
index 5064b03127..0000000000
--- a/packages/ui/src/counting-numbers.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import { nFormatter } from "@dub/utils";
-import { Slot } from "@radix-ui/react-slot";
-import React, {
- ElementType,
- ForwardedRef,
- ReactNode,
- useEffect,
- useState,
-} from "react";
-
-interface CountingNumbersProps {
- asChild?: boolean;
- className?: string;
- children: ReactNode;
- prefix?: ReactNode;
- duration?: number;
- as?: ElementType; // Allows defining the component as 'h1', 'h2', 'p', etc.
- variant?: "full" | "compact";
-}
-
-const CountingNumbers = React.forwardRef<HTMLSpanElement, CountingNumbersProps>(
- (
- {
- asChild,
- className,
- children,
- prefix,
- duration = 250,
- as: Component = "span",
- variant = "compact",
- ...props
- },
- ref: ForwardedRef<any>,
- ) => {
- const [displayValue, setDisplayValue] = useState(Number(children));
-
- useEffect(() => {
- if (isNaN(Number(children))) {
- console.warn("CountingNumbers expects a numeric value as children.");
- return;
- }
- const target = Number(children);
- const startValue = displayValue;
- const endValue = target;
- const startTime = performance.now();
-
- const tick = () => {
- const now = performance.now();
- const progress = Math.min((now - startTime) / duration, 1);
- const currentValue = startValue + (endValue - startValue) * progress;
- setDisplayValue(Math.round(currentValue));
-
- if (progress < 1) {
- requestAnimationFrame(tick);
- }
- };
-
- requestAnimationFrame(tick);
- }, [children, duration]); // Depend on children and duration for changes
-
- const Comp = asChild ? Slot : Component;
-
- return (
- <Comp ref={ref} className={className} {...props}>
- {prefix}
- {nFormatter(
- displayValue,
- variant === "full" ? { full: true } : undefined,
- )}
- </Comp>
- );
- },
-);
-
-CountingNumbers.displayName = "CountingNumbers";
-
-export { CountingNumbers };