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.

Added info tooltips to link edit modal

Steven Tey5994d7c41814
diff --git a/app/ui/home/pricing.tsx b/app/ui/home/pricing.tsx
index 2445c9f72f..44e300f82a 100644
--- a/app/ui/home/pricing.tsx
+++ b/app/ui/home/pricing.tsx
@@ -3,17 +3,13 @@
import Link from "next/link";
import { useMemo, useState } from "react";
import Confetti from "react-dom-confetti";
-import {
- CheckCircleFill,
- QuestionCircle,
- XCircleFill,
-} from "@/components/shared/icons";
+import { CheckCircleFill, XCircleFill } from "@/components/shared/icons";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
import Switch from "#/ui/switch";
import Tooltip from "#/ui/tooltip";
import { PLANS } from "#/lib/stripe/utils";
import { nFormatter } from "#/lib/utils";
-import { MinusCircle } from "lucide-react";
+import { HelpCircle, MinusCircle } from "lucide-react";
const pricingItems = [
{
@@ -194,7 +190,7 @@ const Pricing = () => {
</p>
</div>
<div className="flex h-20 items-center justify-center border-b border-t border-gray-200 bg-gray-50">
- <div className="flex items-center">
+ <div className="flex items-center space-x-1">
<p className="text-gray-600">
{plan === "Enterprise"
? "Unlimited link clicks"
@@ -202,9 +198,7 @@ const Pricing = () => {
</p>
{plan !== "Enterprise" && (
<Tooltip content="If you exceed your monthly usage, your existing links will still work, but you need to upgrade to view their stats/add more links.">
- <div className="flex h-4 w-8 justify-center">
- <QuestionCircle className="h-4 w-4 text-gray-600" />
- </div>
+ <HelpCircle className="h-4 w-4 text-gray-600" />
</Tooltip>
)}
</div>
@@ -225,7 +219,7 @@ const Pricing = () => {
)}
</div>
{footnote ? (
- <div className="flex items-center">
+ <div className="flex items-center space-x-1">
<p
className={
negative ? "text-gray-400" : "text-gray-600"
@@ -234,9 +228,7 @@ const Pricing = () => {
{text}
</p>
<Tooltip content={footnote}>
- <div className="flex h-4 w-8 justify-center">
- <QuestionCircle className="h-4 w-4 text-gray-600" />
- </div>
+ <HelpCircle className="h-4 w-4 text-gray-600" />
</Tooltip>
</div>
) : (
diff --git a/app/ui/modals/add-edit-link-modal/android-section.tsx b/app/ui/modals/add-edit-link-modal/android-section.tsx
index 2e9fcacc61..4cce148511 100644
--- a/app/ui/modals/add-edit-link-modal/android-section.tsx
+++ b/app/ui/modals/add-edit-link-modal/android-section.tsx
@@ -3,6 +3,8 @@ import { LinkProps } from "#/lib/types";
import Switch from "#/ui/switch";
import { motion } from "framer-motion";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function AndroidSection({
props,
@@ -31,7 +33,14 @@ export default function AndroidSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">Android Targeting</h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">
+ Android Targeting
+ </h2>
+ <Tooltip content="Redirect your Android users to a different link (e.g. Google Play Store link for your app).">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/app/ui/modals/add-edit-link-modal/expiration-section.tsx b/app/ui/modals/add-edit-link-modal/expiration-section.tsx
index 109b56b984..88b6bf39cc 100644
--- a/app/ui/modals/add-edit-link-modal/expiration-section.tsx
+++ b/app/ui/modals/add-edit-link-modal/expiration-section.tsx
@@ -3,6 +3,8 @@ import { LinkProps } from "#/lib/types";
import { getDateTimeLocal } from "#/lib/utils";
import Switch from "#/ui/switch";
import { motion } from "framer-motion";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function ExpirationSection({
props,
@@ -31,7 +33,12 @@ export default function ExpirationSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">Expiration Date</h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">Expiration Date</h2>
+ <Tooltip content="By setting an expiration date, your link will only be accessible until the specified date.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/app/ui/modals/add-edit-link-modal/ios-section.tsx b/app/ui/modals/add-edit-link-modal/ios-section.tsx
index d2729f55b0..122b23c937 100644
--- a/app/ui/modals/add-edit-link-modal/ios-section.tsx
+++ b/app/ui/modals/add-edit-link-modal/ios-section.tsx
@@ -3,6 +3,8 @@ import { LinkProps } from "#/lib/types";
import Switch from "#/ui/switch";
import { motion } from "framer-motion";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function IOSSection({
props,
@@ -31,7 +33,12 @@ export default function IOSSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">iOS Targeting</h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">iOS Targeting</h2>
+ <Tooltip content="Redirect your iOS users to a different link (e.g. App Store link for your app).">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/app/ui/modals/add-edit-link-modal/og-section.tsx b/app/ui/modals/add-edit-link-modal/og-section.tsx
index fa0eb3887e..80b2d5db82 100644
--- a/app/ui/modals/add-edit-link-modal/og-section.tsx
+++ b/app/ui/modals/add-edit-link-modal/og-section.tsx
@@ -12,6 +12,8 @@ import { LoadingCircle } from "#/ui/icons";
import { LinkProps } from "#/lib/types";
import Switch from "#/ui/switch";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function OGSection({
props,
@@ -65,9 +67,14 @@ export default function OGSection({
return (
<div className="grid gap-5 border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">
- Custom Social Media Cards
- </h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">
+ Custom Social Media Cards
+ </h2>
+ <Tooltip content="Customize the title, description, and thumbnail image that will be shown when you share this link on social media.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch
fn={() => setData((prev) => ({ ...prev, proxy: !proxy }))}
checked={proxy}
diff --git a/app/ui/modals/add-edit-link-modal/password-section.tsx b/app/ui/modals/add-edit-link-modal/password-section.tsx
index 4138c2fb28..eb50c891bc 100644
--- a/app/ui/modals/add-edit-link-modal/password-section.tsx
+++ b/app/ui/modals/add-edit-link-modal/password-section.tsx
@@ -4,6 +4,8 @@ import Switch from "#/ui/switch";
import { motion } from "framer-motion";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
import { Eye, EyeOff } from "@/components/shared/icons";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function PasswordSection({
props,
@@ -34,9 +36,14 @@ export default function PasswordSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">
- Password Protection
- </h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">
+ Password Protection
+ </h2>
+ <Tooltip content="Password protection allows you to restrict access to your link by encrypting it with a password. Only those who know the password will be able to access your link.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/app/ui/modals/add-edit-link-modal/utm-section.tsx b/app/ui/modals/add-edit-link-modal/utm-section.tsx
index e743dfba3f..85ee593f6a 100644
--- a/app/ui/modals/add-edit-link-modal/utm-section.tsx
+++ b/app/ui/modals/add-edit-link-modal/utm-section.tsx
@@ -9,6 +9,8 @@ import {
} from "#/lib/utils";
import Switch from "#/ui/switch";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function UTMSection({
props,
@@ -57,7 +59,12 @@ export default function UTMSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">UTM Builder</h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">UTM Builder</h2>
+ <Tooltip content="UTM parameters are tags that will be added to the end of the destination URL. When your link is clicked, the tags are detected and tracked by your analytics software.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/components/app/modals/add-edit-link-modal/android-section.tsx b/components/app/modals/add-edit-link-modal/android-section.tsx
index 2e9fcacc61..4cce148511 100644
--- a/components/app/modals/add-edit-link-modal/android-section.tsx
+++ b/components/app/modals/add-edit-link-modal/android-section.tsx
@@ -3,6 +3,8 @@ import { LinkProps } from "#/lib/types";
import Switch from "#/ui/switch";
import { motion } from "framer-motion";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function AndroidSection({
props,
@@ -31,7 +33,14 @@ export default function AndroidSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">Android Targeting</h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">
+ Android Targeting
+ </h2>
+ <Tooltip content="Redirect your Android users to a different link (e.g. Google Play Store link for your app).">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/components/app/modals/add-edit-link-modal/expiration-section.tsx b/components/app/modals/add-edit-link-modal/expiration-section.tsx
index e55b5daff8..a3035fd08c 100644
--- a/components/app/modals/add-edit-link-modal/expiration-section.tsx
+++ b/components/app/modals/add-edit-link-modal/expiration-section.tsx
@@ -4,6 +4,8 @@ import { getDateTimeLocal } from "#/lib/utils";
import Switch from "#/ui/switch";
import { motion } from "framer-motion";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function ExpirationSection({
props,
@@ -32,7 +34,12 @@ export default function ExpirationSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">Expiration Date</h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">Expiration Date</h2>
+ <Tooltip content="By setting an expiration date, your link will only be accessible until the specified date.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/components/app/modals/add-edit-link-modal/ios-section.tsx b/components/app/modals/add-edit-link-modal/ios-section.tsx
index d2729f55b0..122b23c937 100644
--- a/components/app/modals/add-edit-link-modal/ios-section.tsx
+++ b/components/app/modals/add-edit-link-modal/ios-section.tsx
@@ -3,6 +3,8 @@ import { LinkProps } from "#/lib/types";
import Switch from "#/ui/switch";
import { motion } from "framer-motion";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function IOSSection({
props,
@@ -31,7 +33,12 @@ export default function IOSSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">iOS Targeting</h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">iOS Targeting</h2>
+ <Tooltip content="Redirect your iOS users to a different link (e.g. App Store link for your app).">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/components/app/modals/add-edit-link-modal/og-section.tsx b/components/app/modals/add-edit-link-modal/og-section.tsx
index fa0eb3887e..80b2d5db82 100644
--- a/components/app/modals/add-edit-link-modal/og-section.tsx
+++ b/components/app/modals/add-edit-link-modal/og-section.tsx
@@ -12,6 +12,8 @@ import { LoadingCircle } from "#/ui/icons";
import { LinkProps } from "#/lib/types";
import Switch from "#/ui/switch";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function OGSection({
props,
@@ -65,9 +67,14 @@ export default function OGSection({
return (
<div className="grid gap-5 border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">
- Custom Social Media Cards
- </h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">
+ Custom Social Media Cards
+ </h2>
+ <Tooltip content="Customize the title, description, and thumbnail image that will be shown when you share this link on social media.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch
fn={() => setData((prev) => ({ ...prev, proxy: !proxy }))}
checked={proxy}
diff --git a/components/app/modals/add-edit-link-modal/password-section.tsx b/components/app/modals/add-edit-link-modal/password-section.tsx
index 4138c2fb28..eb50c891bc 100644
--- a/components/app/modals/add-edit-link-modal/password-section.tsx
+++ b/components/app/modals/add-edit-link-modal/password-section.tsx
@@ -4,6 +4,8 @@ import Switch from "#/ui/switch";
import { motion } from "framer-motion";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
import { Eye, EyeOff } from "@/components/shared/icons";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function PasswordSection({
props,
@@ -34,9 +36,14 @@ export default function PasswordSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">
- Password Protection
- </h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">
+ Password Protection
+ </h2>
+ <Tooltip content="Password protection allows you to restrict access to your link by encrypting it with a password. Only those who know the password will be able to access your link.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/components/app/modals/add-edit-link-modal/tags-section.tsx b/components/app/modals/add-edit-link-modal/tags-section.tsx
index b665954364..6d610dbc9e 100644
--- a/components/app/modals/add-edit-link-modal/tags-section.tsx
+++ b/components/app/modals/add-edit-link-modal/tags-section.tsx
@@ -16,6 +16,7 @@ import { toast } from "sonner";
import { mutate } from "swr";
import { LoadingCircle } from "#/ui/icons";
import { ChevronDown } from "@/components/shared/icons";
+import Tooltip from "#/ui/tooltip";
export default function TagsSection({
data,
@@ -108,7 +109,13 @@ export default function TagsSection({
<Command ref={commandRef} className="relative" loop>
<div className="group mt-1 rounded-md border border-gray-300 bg-white px-1 focus-within:border-gray-500 focus-within:ring-1 focus-within:ring-gray-500">
<div className="absolute inset-y-0 left-0 flex items-center justify-center pl-3 text-gray-400">
- {creatingTag ? <LoadingCircle /> : <Tag className="h-4 w-4" />}
+ {creatingTag ? (
+ <LoadingCircle />
+ ) : (
+ <Tooltip content="Tags are used to organize your links in your Dub dashboard. You can edit and customize your tags under the Tags filter section on the left sidebar.">
+ <Tag className="h-4 w-4" />
+ </Tooltip>
+ )}
</div>
<div className="flex h-9 px-8">
{selectedTag ? (
diff --git a/components/app/modals/add-edit-link-modal/utm-section.tsx b/components/app/modals/add-edit-link-modal/utm-section.tsx
index e743dfba3f..85ee593f6a 100644
--- a/components/app/modals/add-edit-link-modal/utm-section.tsx
+++ b/components/app/modals/add-edit-link-modal/utm-section.tsx
@@ -9,6 +9,8 @@ import {
} from "#/lib/utils";
import Switch from "#/ui/switch";
import { FADE_IN_ANIMATION_SETTINGS } from "#/lib/constants";
+import Tooltip from "#/ui/tooltip";
+import { HelpCircle } from "lucide-react";
export default function UTMSection({
props,
@@ -57,7 +59,12 @@ export default function UTMSection({
return (
<div className="border-b border-gray-200 pb-5">
<div className="flex items-center justify-between">
- <h2 className="text-sm font-medium text-gray-900">UTM Builder</h2>
+ <div className="flex items-center justify-between space-x-2">
+ <h2 className="text-sm font-medium text-gray-900">UTM Builder</h2>
+ <Tooltip content="UTM parameters are tags that will be added to the end of the destination URL. When your link is clicked, the tags are detected and tracked by your analytics software.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<Switch fn={() => setEnabled(!enabled)} checked={enabled} />
</div>
{enabled && (
diff --git a/components/app/modals/upgrade-plan-modal/pricing.tsx b/components/app/modals/upgrade-plan-modal/pricing.tsx
index 6b062bc8d3..5d3e75f43f 100644
--- a/components/app/modals/upgrade-plan-modal/pricing.tsx
+++ b/components/app/modals/upgrade-plan-modal/pricing.tsx
@@ -3,11 +3,7 @@
import Link from "next/link";
import { useMemo, useState } from "react";
import Confetti from "react-dom-confetti";
-import {
- CheckCircleFill,
- QuestionCircle,
- XCircleFill,
-} from "@/components/shared/icons";
+import { CheckCircleFill, XCircleFill } from "@/components/shared/icons";
import { LoadingDots } from "#/ui/icons";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
import Switch from "#/ui/switch";
@@ -16,7 +12,7 @@ import { getStripe } from "#/lib/stripe/client";
import { PLANS } from "#/lib/stripe/utils";
import { capitalize, nFormatter } from "#/lib/utils";
import useProject from "#/lib/swr/use-project";
-import { MinusCircle } from "lucide-react";
+import { HelpCircle, MinusCircle } from "lucide-react";
const pricingItems = [
{
@@ -199,16 +195,14 @@ const Pricing = ({ homePage }: { homePage?: boolean }) => {
</p>
</div>
<div className="flex h-20 items-center justify-center border-b border-t border-gray-200 bg-gray-50">
- <div className="flex items-center">
+ <div className="flex items-center space-x-1">
<p className="text-gray-600">
{plan === "Enterprise"
? "Unlimited link clicks"
: `Up to ${nFormatter(quota)} link clicks/mo`}
</p>
<Tooltip content="If you exceed your monthly usage, your existing links will still work, but you need to upgrade to view their stats/add more links.">
- <div className="flex h-4 w-8 justify-center">
- <QuestionCircle className="h-4 w-4 text-gray-600" />
- </div>
+ <HelpCircle className="h-4 w-4 text-gray-600" />
</Tooltip>
</div>
</div>
@@ -228,7 +222,7 @@ const Pricing = ({ homePage }: { homePage?: boolean }) => {
)}
</div>
{footnote ? (
- <div className="flex items-center">
+ <div className="flex items-center space-x-1">
<p
className={
negative ? "text-gray-400" : "text-gray-600"
@@ -237,9 +231,7 @@ const Pricing = ({ homePage }: { homePage?: boolean }) => {
{text}
</p>
<Tooltip content={footnote}>
- <div className="flex h-4 w-8 justify-center">
- <QuestionCircle className="h-4 w-4 text-gray-600" />
- </div>
+ <HelpCircle className="h-4 w-4 text-gray-600" />
</Tooltip>
</div>
) : (
diff --git a/components/app/projects/settings/plan-usage.tsx b/components/app/projects/settings/plan-usage.tsx
index 2d317691e3..fb6767d4ac 100644
--- a/components/app/projects/settings/plan-usage.tsx
+++ b/components/app/projects/settings/plan-usage.tsx
@@ -2,23 +2,26 @@ import { useRouter } from "next/router";
import { useEffect, useMemo, useState } from "react";
import { motion } from "framer-motion";
import { useUpgradePlanModal } from "@/components/app/modals/upgrade-plan-modal";
-import { Infinity, Divider, QuestionCircle } from "@/components/shared/icons";
+import { Infinity, Divider } from "@/components/shared/icons";
import { LoadingDots } from "#/ui/icons";
import Tooltip from "#/ui/tooltip";
-import { getFirstAndLastDay, nFormatter } from "#/lib/utils";
+import { fetcher, getFirstAndLastDay, nFormatter } from "#/lib/utils";
import useProject from "#/lib/swr/use-project";
-import useDomains from "#/lib/swr/use-domains";
import PlanBadge from "./plan-badge";
import { toast } from "sonner";
-import { mutate } from "swr";
+import useSWR, { mutate } from "swr";
import va from "@vercel/analytics";
+import { HelpCircle } from "lucide-react";
export default function PlanUsage() {
const router = useRouter();
const { slug, plan, usage, usageLimit, billingCycleStart } = useProject();
- const { domains } = useDomains();
+ const { data: links } = useSWR<number>(
+ `/api/links/_count?slug=${slug}`,
+ fetcher,
+ );
const [clicked, setClicked] = useState(false);
const [billingStart, billingEnd] = useMemo(() => {
@@ -82,12 +85,10 @@ export default function PlanUsage() {
<div className="border-b border-gray-200" />
<div className="grid grid-cols-1 divide-y divide-gray-200 sm:grid-cols-2 sm:divide-x sm:divide-y-0">
<div className="flex flex-col space-y-2 p-10">
- <div className="flex items-center">
+ <div className="flex items-center space-x-2">
<h3 className="font-medium">Total Link Clicks</h3>
<Tooltip content="Number of billable link clicks across all your projects.">
- <div className="flex h-4 w-8 justify-center">
- <QuestionCircle className="h-4 w-4 text-gray-600" />
- </div>
+ <HelpCircle className="h-4 w-4 text-gray-600" />
</Tooltip>
</div>
{usage !== undefined && usageLimit ? (
@@ -117,11 +118,16 @@ export default function PlanUsage() {
</div>
</div>
<div className="p-10">
- <h3 className="font-medium">Number of Domains</h3>
+ <div className="flex items-center space-x-2">
+ <h3 className="font-medium">Number of Links</h3>
+ <Tooltip content="Total number of short links in your project.">
+ <HelpCircle className="h-4 w-4 text-gray-600" />
+ </Tooltip>
+ </div>
<div className="mt-4 flex items-center">
- {domains ? (
+ {links || links === 0 ? (
<p className="text-2xl font-semibold text-black">
- {nFormatter(domains.length)}
+ {nFormatter(links)}
</p>
) : (
<div className="h-8 w-8 animate-pulse rounded-md bg-gray-200" />
diff --git a/components/shared/icons/index.tsx b/components/shared/icons/index.tsx
index 3eb06e4e1e..34548b7954 100644
--- a/components/shared/icons/index.tsx
+++ b/components/shared/icons/index.tsx
@@ -15,7 +15,6 @@ export { default as ChevronLeft } from "./chevron-left";
export { default as ChevronDown } from "./chevron-down";
export { default as ChevronUpDown } from "./chevron-up-down";
export { default as AlertCircleFill } from "./alert-circle-fill";
-export { default as QuestionCircle } from "./question-circle";
export { default as ExternalLink } from "./external-link";
export { default as XCircleFill } from "./x-circle-fill";
export { default as CheckCircleFill } from "./check-circle-fill";
diff --git a/components/shared/icons/question-circle.tsx b/components/shared/icons/question-circle.tsx
deleted file mode 100644
index d20d9ca150..0000000000
--- a/components/shared/icons/question-circle.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-export default function QuestionCircle({ className }: { className: string }) {
- return (
- <svg
- fill="none"
- shapeRendering="geometricPrecision"
- stroke="currentColor"
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="1.5"
- viewBox="0 0 24 24"
- width="24"
- height="24"
- className={className}
- >
- <path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z" />
- <path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3" />
- <circle cx="12" cy="17" r=".5" />
- </svg>
- );
-}