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.

fix #669 and a few other small issues

Steven Tey10ec117a1727
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index bacf16461d..1ecdcb6ea4 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -17,7 +17,7 @@ export default function RootLayout({
<html lang="en" className={cn(satoshi.variable, inter.variable)}>
<body>
<TooltipProvider>
- <Toaster closeButton />
+ <Toaster className="pointer-events-auto" />
{children}
<Analytics />
<SpeedInsights />
diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.ts
index bd7fb50f41..c5d21a86e6 100644
--- a/apps/web/lib/api/links/process-link.ts
+++ b/apps/web/lib/api/links/process-link.ts
@@ -67,10 +67,23 @@ export async function processLink({
(!createdAt || new Date(createdAt) > new Date("2024-01-19"))
) {
if (proxy || password || rewrite || expiresAt || ios || android || geo) {
+ const proFeaturesString = [
+ proxy && "custom social media cards",
+ password && "password protection",
+ rewrite && "link cloaking",
+ expiresAt && "link expiration",
+ ios && "iOS targeting",
+ android && "Android targeting",
+ geo && "geo targeting",
+ ]
+ .filter(Boolean)
+ .join(", ")
+ // final one should be "and" instead of comma
+ .replace(/, ([^,]*)$/, " and $1");
+
return {
link: payload,
- error:
- "You can only use custom social media cards, password-protection, link cloaking, link expiration, device and geo targeting on a Pro plan and above. Upgrade to Pro to use these features.",
+ error: `You can only use ${proFeaturesString} on a Pro plan and above. Upgrade to Pro to use these features.`,
code: "forbidden",
};
}
diff --git a/apps/web/ui/modals/add-edit-link-modal/android-section.tsx b/apps/web/ui/modals/add-edit-link-modal/android-section.tsx
index 37c2e7ab34..f2982a1b88 100644
--- a/apps/web/ui/modals/add-edit-link-modal/android-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/android-section.tsx
@@ -1,14 +1,8 @@
-import useWorkspace from "@/lib/swr/use-workspace";
import { LinkProps } from "@/lib/types";
-import {
- InfoTooltip,
- SimpleTooltipContent,
- Switch,
- TooltipContent,
- useRouterStuff,
-} from "@dub/ui";
+import { BadgeTooltip, SimpleTooltipContent, Switch } from "@dub/ui";
import { FADE_IN_ANIMATION_SETTINGS } from "@dub/utils";
import { motion } from "framer-motion";
+import { Crown } from "lucide-react";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
export default function AndroidSection({
@@ -20,8 +14,6 @@ export default function AndroidSection({
data: LinkProps;
setData: Dispatch<SetStateAction<LinkProps>>;
}) {
- const { plan } = useWorkspace();
- const { queryParams } = useRouterStuff();
const { android } = data;
const [enabled, setEnabled] = useState(!!android);
useEffect(() => {
@@ -44,7 +36,7 @@ export default function AndroidSection({
<h2 className="text-sm font-medium text-gray-900">
Android Targeting
</h2>
- <InfoTooltip
+ <BadgeTooltip
content={
<SimpleTooltipContent
title="Redirect your Android users to a different link."
@@ -52,35 +44,14 @@ export default function AndroidSection({
href="https://dub.co/help/article/device-targeting"
/>
}
- />
+ >
+ <div className="flex items-center space-x-1">
+ <Crown size={12} />
+ <p>PRO</p>
+ </div>
+ </BadgeTooltip>
</div>
- <Switch
- fn={() => setEnabled(!enabled)}
- checked={enabled}
- // Android targeting is only available on Dub's Pro plan
- {...((!plan || plan === "free") && !enabled
- ? {
- disabledTooltip: (
- <TooltipContent
- title={`Android targeting is only available on ${process.env.NEXT_PUBLIC_APP_NAME}'s Pro plan. Upgrade to Pro to use this feature.`}
- cta="Upgrade to Pro"
- {...(plan === "free"
- ? {
- onClick: () =>
- queryParams({
- set: {
- upgrade: "pro",
- },
- }),
- }
- : {
- href: "https://dub.co/pricing",
- })}
- />
- ),
- }
- : {})}
- />
+ <Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
<motion.div
diff --git a/apps/web/ui/modals/add-edit-link-modal/cloaking-section.tsx b/apps/web/ui/modals/add-edit-link-modal/cloaking-section.tsx
index fa0cf6618b..b0fb46a6dc 100644
--- a/apps/web/ui/modals/add-edit-link-modal/cloaking-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/cloaking-section.tsx
@@ -1,16 +1,18 @@
-import useWorkspace from "@/lib/swr/use-workspace";
import { LinkProps } from "@/lib/types";
import { AlertCircleFill, CheckCircleFill } from "@/ui/shared/icons";
import {
- InfoTooltip,
+ BadgeTooltip,
LoadingSpinner,
SimpleTooltipContent,
Switch,
- TooltipContent,
- useRouterStuff,
} from "@dub/ui";
-import { FADE_IN_ANIMATION_SETTINGS, fetcher } from "@dub/utils";
+import {
+ FADE_IN_ANIMATION_SETTINGS,
+ fetcher,
+ getUrlFromString,
+} from "@dub/utils";
import { motion } from "framer-motion";
+import { Crown } from "lucide-react";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import useSWR from "swr";
@@ -21,9 +23,6 @@ export default function CloakingSection({
data: LinkProps;
setData: Dispatch<SetStateAction<LinkProps>>;
}) {
- const { plan } = useWorkspace();
- const { queryParams } = useRouterStuff();
-
const { rewrite } = data;
const [enabled, setEnabled] = useState(rewrite);
useEffect(() => {
@@ -44,7 +43,7 @@ export default function CloakingSection({
<div className="flex items-center justify-between">
<div className="flex items-center justify-between space-x-2">
<h2 className="text-sm font-medium text-gray-900">Link Cloaking</h2>
- <InfoTooltip
+ <BadgeTooltip
content={
<SimpleTooltipContent
title="Mask your destination URL so your users only see the short link in the browser address bar."
@@ -52,44 +51,29 @@ export default function CloakingSection({
href="https://dub.co/help/article/link-cloaking"
/>
}
- />
+ >
+ <div className="flex items-center space-x-1">
+ <Crown size={12} />
+ <p>PRO</p>
+ </div>
+ </BadgeTooltip>
</div>
- <Switch
- fn={() => setEnabled(!enabled)}
- checked={enabled}
- // link cloaking is only available on Dub's Pro plan
- {...((!plan || plan === "free") && !enabled
- ? {
- disabledTooltip: (
- <TooltipContent
- title={`Link cloaking is only available on ${process.env.NEXT_PUBLIC_APP_NAME}'s Pro plan. Upgrade to Pro to use this feature.`}
- cta="Upgrade to Pro"
- {...(plan === "free"
- ? {
- onClick: () =>
- queryParams({
- set: {
- upgrade: "pro",
- },
- }),
- }
- : {
- href: "https://dub.co/pricing",
- })}
- />
- ),
- }
- : {})}
- />
+ <Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
<motion.div className="mt-3 grid gap-2" {...FADE_IN_ANIMATION_SETTINGS}>
<div className="relative mt-1 flex aspect-[1200/630] w-full cursor-pointer items-center justify-center overflow-hidden rounded-md border border-gray-300 bg-white shadow-sm transition-all hover:bg-gray-50">
- <iframe src={data.url} className="absolute z-10 h-full w-full" />
+ <iframe
+ src={getUrlFromString(data.url)}
+ className="absolute z-10 h-full w-full"
+ />
<LoadingSpinner />
</div>
- <IframeIndicator url={data.url} domain={data.domain} />
+ <IframeIndicator
+ url={getUrlFromString(data.url)}
+ domain={data.domain}
+ />
</motion.div>
)}
</div>
diff --git a/apps/web/ui/modals/add-edit-link-modal/expiration-section.tsx b/apps/web/ui/modals/add-edit-link-modal/expiration-section.tsx
index a8e50e11d2..e436da6505 100644
--- a/apps/web/ui/modals/add-edit-link-modal/expiration-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/expiration-section.tsx
@@ -1,13 +1,11 @@
-import useWorkspace from "@/lib/swr/use-workspace";
import { LinkProps } from "@/lib/types";
import {
+ BadgeTooltip,
ExpandingArrow,
InfoTooltip,
SimpleTooltipContent,
Switch,
- useRouterStuff,
} from "@dub/ui";
-import { TooltipContent } from "@dub/ui/src/tooltip";
import {
FADE_IN_ANIMATION_SETTINGS,
formatDateTime,
@@ -15,6 +13,7 @@ import {
parseDateTime,
} from "@dub/utils";
import { motion } from "framer-motion";
+import { Crown } from "lucide-react";
import { Dispatch, SetStateAction, useEffect, useRef, useState } from "react";
export default function ExpirationSection({
@@ -26,8 +25,6 @@ export default function ExpirationSection({
data: LinkProps;
setData: Dispatch<SetStateAction<LinkProps>>;
}) {
- const { plan } = useWorkspace();
- const { queryParams } = useRouterStuff();
const inputRef = useRef<HTMLInputElement>(null);
const { expiresAt, expiredUrl } = data;
@@ -51,7 +48,7 @@ export default function ExpirationSection({
<div className="flex items-center justify-between">
<div className="flex items-center justify-between space-x-2">
<h2 className="text-sm font-medium text-gray-900">Link Expiration</h2>
- <InfoTooltip
+ <BadgeTooltip
content={
<SimpleTooltipContent
title="Set an expiration date for your links – after which it won't be accessible."
@@ -59,35 +56,14 @@ export default function ExpirationSection({
href="https://dub.co/help/article/link-expiration"
/>
}
- />
+ >
+ <div className="flex items-center space-x-1">
+ <Crown size={12} />
+ <p>PRO</p>
+ </div>
+ </BadgeTooltip>
</div>
- <Switch
- fn={() => setEnabled(!enabled)}
- checked={enabled}
- // expiration date is only available on Dub's Pro plan
- {...((!plan || plan === "free") && !enabled
- ? {
- disabledTooltip: (
- <TooltipContent
- title={`Expiration date is only available on ${process.env.NEXT_PUBLIC_APP_NAME}'s Pro plan. Upgrade to Pro to use this feature.`}
- cta="Upgrade to Pro"
- {...(plan === "free"
- ? {
- onClick: () =>
- queryParams({
- set: {
- upgrade: "pro",
- },
- }),
- }
- : {
- href: "https://dub.co/pricing",
- })}
- />
- ),
- }
- : {})}
- />
+ <Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
<motion.div className="mt-3" {...FADE_IN_ANIMATION_SETTINGS}>
diff --git a/apps/web/ui/modals/add-edit-link-modal/geo-section.tsx b/apps/web/ui/modals/add-edit-link-modal/geo-section.tsx
index 581cba13bf..6b1832080e 100644
--- a/apps/web/ui/modals/add-edit-link-modal/geo-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/geo-section.tsx
@@ -1,15 +1,8 @@
-import useWorkspace from "@/lib/swr/use-workspace";
import { LinkProps } from "@/lib/types";
-import {
- InfoTooltip,
- SimpleTooltipContent,
- Switch,
- TooltipContent,
- useRouterStuff,
-} from "@dub/ui";
+import { BadgeTooltip, SimpleTooltipContent, Switch } from "@dub/ui";
import { COUNTRIES, FADE_IN_ANIMATION_SETTINGS } from "@dub/utils";
import { motion } from "framer-motion";
-import { Trash } from "lucide-react";
+import { Crown, Trash } from "lucide-react";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
export default function GeoSection({
@@ -21,8 +14,6 @@ export default function GeoSection({
data: LinkProps;
setData: Dispatch<SetStateAction<LinkProps>>;
}) {
- const { plan } = useWorkspace();
- const { queryParams } = useRouterStuff();
const { geo } = data;
const [enabled, setEnabled] = useState(!!geo);
@@ -53,7 +44,7 @@ export default function GeoSection({
<div className="flex items-center justify-between">
<div className="flex items-center justify-between space-x-2">
<h2 className="text-sm font-medium text-gray-900">Geo Targeting</h2>
- <InfoTooltip
+ <BadgeTooltip
content={
<SimpleTooltipContent
title="Redirect your users to different links based on their location."
@@ -61,35 +52,14 @@ export default function GeoSection({
href="https://dub.co/help/article/geo-targeting"
/>
}
- />
+ >
+ <div className="flex items-center space-x-1">
+ <Crown size={12} />
+ <p>PRO</p>
+ </div>
+ </BadgeTooltip>
</div>
- <Switch
- fn={() => setEnabled(!enabled)}
- checked={enabled}
- // geo targeting is only available on Dub's Pro plan
- {...((!plan || plan === "free") && !enabled
- ? {
- disabledTooltip: (
- <TooltipContent
- title={`Geo targeting is only available on ${process.env.NEXT_PUBLIC_APP_NAME}'s Pro plan. Upgrade to Pro to use this feature.`}
- cta="Upgrade to Pro"
- {...(plan === "free"
- ? {
- onClick: () =>
- queryParams({
- set: {
- upgrade: "pro",
- },
- }),
- }
- : {
- href: "https://dub.co/pricing",
- })}
- />
- ),
- }
- : {})}
- />
+ <Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
<motion.div className="mt-3 grid gap-2" {...FADE_IN_ANIMATION_SETTINGS}>
diff --git a/apps/web/ui/modals/add-edit-link-modal/index.tsx b/apps/web/ui/modals/add-edit-link-modal/index.tsx
index 4931c6d5cf..65c55b1f5c 100644
--- a/apps/web/ui/modals/add-edit-link-modal/index.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/index.tsx
@@ -29,6 +29,8 @@ import {
punycode,
truncate,
} from "@dub/utils";
+import { Crown, TriangleAlert } from "lucide-react";
+import Link from "next/link";
import {
useParams,
usePathname,
@@ -59,7 +61,6 @@ import PasswordSection from "./password-section";
import Preview from "./preview";
import TagsSection from "./tags-section";
import UTMSection from "./utm-section";
-import { TriangleAlert } from "lucide-react";
function AddEditLinkModal({
showAddEditLinkModal,
@@ -201,9 +202,7 @@ function AddEditLinkModal({
// set timeout to prevent flickering
setTimeout(() => setGeneratingMetatags(false), 200);
});
- } catch (e) {
- console.log("not a valid url");
- }
+ } catch (_) {}
} else {
setGeneratingMetatags(false);
}
@@ -398,7 +397,36 @@ function AddEditLinkModal({
} else {
const { error } = await res.json();
if (error) {
- toast.error(error.message);
+ if (error.message.includes("Upgrade to Pro")) {
+ toast.custom(() => (
+ <div className="flex flex-col space-y-3 rounded-lg bg-white p-6 shadow-lg">
+ <div className="flex items-center space-x-1.5">
+ <Crown className="h-5 w-5 text-black" />{" "}
+ <p className="font-semibold">
+ You've discovered a Pro feature!
+ </p>
+ </div>
+ <p className="text-sm text-gray-600">
+ {error.message}
+ </p>
+ <Link
+ href={
+ queryParams({
+ set: {
+ upgrade: "pro",
+ },
+ getNewPath: true,
+ }) as string
+ }
+ className="w-full rounded-md border border-black bg-black px-3 py-1.5 text-center text-sm text-white transition-all hover:bg-white hover:text-black"
+ >
+ Upgrade to Pro
+ </Link>
+ </div>
+ ));
+ } else {
+ toast.error(error.message);
+ }
const message = error.message.toLowerCase();
if (message.includes("key") || message.includes("domain")) {
setKeyError(error.message);
diff --git a/apps/web/ui/modals/add-edit-link-modal/ios-section.tsx b/apps/web/ui/modals/add-edit-link-modal/ios-section.tsx
index 76805405ad..7d61c17ee3 100644
--- a/apps/web/ui/modals/add-edit-link-modal/ios-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/ios-section.tsx
@@ -1,14 +1,8 @@
-import useWorkspace from "@/lib/swr/use-workspace";
import { LinkProps } from "@/lib/types";
-import {
- InfoTooltip,
- SimpleTooltipContent,
- Switch,
- TooltipContent,
- useRouterStuff,
-} from "@dub/ui";
+import { BadgeTooltip, SimpleTooltipContent, Switch } from "@dub/ui";
import { FADE_IN_ANIMATION_SETTINGS } from "@dub/utils";
import { motion } from "framer-motion";
+import { Crown } from "lucide-react";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
export default function IOSSection({
@@ -20,8 +14,6 @@ export default function IOSSection({
data: LinkProps;
setData: Dispatch<SetStateAction<LinkProps>>;
}) {
- const { plan } = useWorkspace();
- const { queryParams } = useRouterStuff();
const { ios } = data;
const [enabled, setEnabled] = useState(!!ios);
useEffect(() => {
@@ -42,7 +34,7 @@ export default function IOSSection({
<div className="flex items-center justify-between">
<div className="flex items-center justify-between space-x-2">
<h2 className="text-sm font-medium text-gray-900">iOS Targeting</h2>
- <InfoTooltip
+ <BadgeTooltip
content={
<SimpleTooltipContent
title="Redirect your iOS users to a different link."
@@ -50,35 +42,14 @@ export default function IOSSection({
href="https://dub.co/help/article/device-targeting"
/>
}
- />
+ >
+ <div className="flex items-center space-x-1">
+ <Crown size={12} />
+ <p>PRO</p>
+ </div>
+ </BadgeTooltip>
</div>
- <Switch
- fn={() => setEnabled(!enabled)}
- checked={enabled}
- // iOS targeting is only available on Dub's Pro plan
- {...((!plan || plan === "free") && !enabled
- ? {
- disabledTooltip: (
- <TooltipContent
- title={`iOS targeting is only available on ${process.env.NEXT_PUBLIC_APP_NAME}'s Pro plan. Upgrade to Pro to use this feature.`}
- cta="Upgrade to Pro"
- {...(plan === "free"
- ? {
- onClick: () =>
- queryParams({
- set: {
- upgrade: "pro",
- },
- }),
- }
- : {
- href: "https://dub.co/pricing",
- })}
- />
- ),
- }
- : {})}
- />
+ <Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
<motion.div
diff --git a/apps/web/ui/modals/add-edit-link-modal/og-section.tsx b/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
index f324da44cf..faf2ceef81 100644
--- a/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
@@ -1,21 +1,18 @@
import { resizeImage } from "@/lib/images";
-import useWorkspace from "@/lib/swr/use-workspace";
import { LinkProps } from "@/lib/types";
import { UploadCloud } from "@/ui/shared/icons";
import {
- InfoTooltip,
+ BadgeTooltip,
LoadingCircle,
LoadingSpinner,
Popover,
SimpleTooltipContent,
Switch,
Unsplash,
- useRouterStuff,
} from "@dub/ui";
-import { TooltipContent } from "@dub/ui/src/tooltip";
import { FADE_IN_ANIMATION_SETTINGS } from "@dub/utils";
import { motion } from "framer-motion";
-import { Link2 } from "lucide-react";
+import { Crown, Link2 } from "lucide-react";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import TextareaAutosize from "react-textarea-autosize";
import UnsplashSearch from "./unsplash-search";
@@ -31,9 +28,6 @@ export default function OGSection({
setData: Dispatch<SetStateAction<LinkProps>>;
generatingMetatags: boolean;
}) {
- const { plan } = useWorkspace();
- const { queryParams } = useRouterStuff();
-
const { title, description, image, proxy } = data;
const [resizing, setResizing] = useState(false);
@@ -82,7 +76,7 @@ export default function OGSection({
<h2 className="text-sm font-medium text-gray-900">
Custom Social Media Cards
</h2>
- <InfoTooltip
+ <BadgeTooltip
content={
<SimpleTooltipContent
title="Customize how your links look when shared on social media."
@@ -90,34 +84,16 @@ export default function OGSection({
href="https://dub.co/help/article/custom-social-media-cards"
/>
}
- />
+ >
+ <div className="flex items-center space-x-1">
+ <Crown size={12} />
+ <p>PRO</p>
+ </div>
+ </BadgeTooltip>
</div>
<Switch
fn={() => setData((prev) => ({ ...prev, proxy: !proxy }))}
checked={proxy}
- // custom social media cards is only available on Dub's Pro plan
- {...((!plan || plan === "free") && !proxy
- ? {
- disabledTooltip: (
- <TooltipContent
- title={`Custom Social Media Cards is only available on ${process.env.NEXT_PUBLIC_APP_NAME}'s Pro plan. Upgrade to Pro to use this feature.`}
- cta="Upgrade to Pro"
- {...(plan === "free"
- ? {
- onClick: () =>
- queryParams({
- set: {
- upgrade: "pro",
- },
- }),
- }
- : {
- href: "https://dub.co/pricing",
- })}
- />
- ),
- }
- : {})}
/>
</div>
diff --git a/apps/web/ui/modals/add-edit-link-modal/password-section.tsx b/apps/web/ui/modals/add-edit-link-modal/password-section.tsx
index 330bef36ec..d07c65baad 100644
--- a/apps/web/ui/modals/add-edit-link-modal/password-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/password-section.tsx
@@ -1,15 +1,9 @@
-import useWorkspace from "@/lib/swr/use-workspace";
import { LinkProps } from "@/lib/types";
import { Eye, EyeOff } from "@/ui/shared/icons";
-import {
- InfoTooltip,
- SimpleTooltipContent,
- Switch,
- useRouterStuff,
-} from "@dub/ui";
-import { TooltipContent } from "@dub/ui/src/tooltip";
+import { BadgeTooltip, SimpleTooltipContent, Switch } from "@dub/ui";
import { FADE_IN_ANIMATION_SETTINGS } from "@dub/utils";
import { motion } from "framer-motion";
+import { Crown } from "lucide-react";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
export default function PasswordSection({
@@ -21,9 +15,6 @@ export default function PasswordSection({
data: LinkProps;
setData: Dispatch<SetStateAction<LinkProps>>;
}) {
- const { plan } = useWorkspace();
- const { queryParams } = useRouterStuff();
-
const { password } = data;
const [enabled, setEnabled] = useState(!!password);
useEffect(() => {
@@ -48,7 +39,7 @@ export default function PasswordSection({
<h2 className="text-sm font-medium text-gray-900">
Password Protection
</h2>
- <InfoTooltip
+ <BadgeTooltip
content={
<SimpleTooltipContent
title="Restrict access to your short links by encrypting it with a password."
@@ -56,35 +47,14 @@ export default function PasswordSection({
href="https://dub.co/help/article/password-protected-links"
/>
}
- />
+ >
+ <div className="flex items-center space-x-1">
+ <Crown size={12} />
+ <p>PRO</p>
+ </div>
+ </BadgeTooltip>
</div>
- <Switch
- fn={() => setEnabled(!enabled)}
- checked={enabled}
- // password protection is only available on Dub's Pro plan
- {...((!plan || plan === "free") && !enabled
- ? {
- disabledTooltip: (
- <TooltipContent
- title={`Password protection is only available on ${process.env.NEXT_PUBLIC_APP_NAME}'s Pro plan. Upgrade to Pro to use this feature.`}
- cta="Upgrade to Pro"
- {...(plan === "free"
- ? {
- onClick: () =>
- queryParams({
- set: {
- upgrade: "pro",
- },
- }),
- }
- : {
- href: "https://dub.co/pricing",
- })}
- />
- ),
- }
- : {})}
- />
+ <Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
<motion.div
diff --git a/packages/ui/src/tooltip.tsx b/packages/ui/src/tooltip.tsx
index efe30c6cb6..4e2fe4ebd9 100644
--- a/packages/ui/src/tooltip.tsx
+++ b/packages/ui/src/tooltip.tsx
@@ -180,13 +180,9 @@ export function NumberTooltip({
);
}
-export function BadgeTooltip({
- children,
- content,
- side = "bottom",
-}: TooltipProps) {
+export function BadgeTooltip({ children, content, ...props }: TooltipProps) {
return (
- <Tooltip content={content} side={side}>
+ <Tooltip content={content} {...props}>
<div className="flex cursor-pointer items-center">
<Badge
variant="gray"