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.

modular titleInfo + linkPageUrl

Steven Tey1b41edb79348
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/customers/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/customers/page.tsx
index 5f7a3e5e32..5b95f1f889 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/customers/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/customers/page.tsx
@@ -1,24 +1,16 @@
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { InfoTooltip, TooltipContent } from "@dub/ui";
import { CustomersPageClient } from "./page-client";
export default function CustomersPage() {
return (
<PageContent
title="Customers"
- titleInfo={
- <InfoTooltip
- content={
- <TooltipContent
- title="Get deeper, real-time insights about your customers' demographics, purchasing behavior, and lifetime value (LTV)."
- href="https://dub.co/help/article/customer-insights"
- target="_blank"
- cta="Learn more"
- />
- }
- />
- }
+ titleInfo={{
+ title:
+ "Get deeper, real-time insights about your customers' demographics, purchasing behavior, and lifetime value (LTV).",
+ href: "https://dub.co/help/article/customer-insights",
+ }}
>
<PageWidthWrapper>
<CustomersPageClient />
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/domains/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/domains/layout.tsx
index b92bef66cc..09b9589b0c 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/domains/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/domains/layout.tsx
@@ -1,6 +1,5 @@
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { InfoTooltip, TooltipContent } from "@dub/ui";
import { ReactNode } from "react";
import { DomainsHeader } from "../../settings/domains/header";
@@ -8,18 +7,11 @@ export default function DomainsLayout({ children }: { children: ReactNode }) {
return (
<PageContent
title="Domains"
- titleInfo={
- <InfoTooltip
- content={
- <TooltipContent
- title="Learn more about how to add, configure, and verify custom domains on Dub."
- href="https://dub.co/help/article/how-to-add-custom-domain"
- target="_blank"
- cta="Learn more"
- />
- }
- />
- }
+ titleInfo={{
+ title:
+ "Learn more about how to add, configure, and verify custom domains on Dub.",
+ href: "https://dub.co/help/article/how-to-add-custom-domain",
+ }}
>
<PageWidthWrapper>
<div className="grid gap-4">
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/folders/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/folders/page.tsx
index 9028912fcb..020b193053 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/folders/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/folders/page.tsx
@@ -1,24 +1,16 @@
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { InfoTooltip, TooltipContent } from "@dub/ui";
import { FoldersPageClient, FoldersPageControls } from "./page-client";
export default async function FoldersPage() {
return (
<PageContent
title="Folders"
- titleInfo={
- <InfoTooltip
- content={
- <TooltipContent
- title="Learn how to use folders to organize and manage access to your links with fine-grained role-based access controls."
- href="https://dub.co/help/article/link-folders"
- target="_blank"
- cta="Learn more"
- />
- }
- />
- }
+ titleInfo={{
+ title:
+ "Learn how to use folders to organize and manage access to your links with fine-grained role-based access controls.",
+ href: "https://dub.co/help/article/link-folders",
+ }}
controls={<FoldersPageControls />}
>
<PageWidthWrapper>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/tags/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/tags/page.tsx
index ee6d3cebe8..1da988fb1f 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/tags/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/tags/page.tsx
@@ -1,6 +1,5 @@
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { InfoTooltip, TooltipContent } from "@dub/ui";
import { Suspense } from "react";
import WorkspaceTagsClient, { TagsPageControls } from "./page-client";
@@ -8,18 +7,11 @@ export default function TagsPage() {
return (
<PageContent
title="Tags"
- titleInfo={
- <InfoTooltip
- content={
- <TooltipContent
- title="Learn how to use tags to organize your links and retrieve analytics for them."
- href="https://dub.co/help/article/how-to-use-tags"
- target="_blank"
- cta="Learn more"
- />
- }
- />
- }
+ titleInfo={{
+ title:
+ "Learn how to use tags to organize your links and retrieve analytics for them.",
+ href: "https://dub.co/help/article/how-to-use-tags",
+ }}
controls={<TagsPageControls />}
>
<PageWidthWrapper>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/tags/tag-card.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/tags/tag-card.tsx
index 695e6678f5..25cb89dc0b 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/tags/tag-card.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/tags/tag-card.tsx
@@ -88,8 +88,9 @@ export function TagCard({
const entry = useIntersectionObserver(ref);
const isInView = entry?.isIntersecting;
+ const linkPageUrl = `/${slug}/links?tagIds=${tag.id}`;
useEffect(() => {
- if (isInView) router.prefetch(`/${slug}/links?tagIds=${tag.id}`);
+ if (isInView) router.prefetch(linkPageUrl);
}, [isInView]);
return (
@@ -98,7 +99,11 @@ export function TagCard({
<CardList.Card
key={tag.id}
- onClick={() => router.push(`/${slug}/links?tagIds=${tag.id}`)}
+ onClick={(e) => {
+ if (e.metaKey || e.ctrlKey) window.open(linkPageUrl, "_blank");
+ else router.push(linkPageUrl);
+ }}
+ onAuxClick={() => window.open(linkPageUrl, "_blank")}
innerClassName={cn(
"flex items-center justify-between gap-5 sm:gap-8 md:gap-12 cursor-pointer text-sm transition-opacity",
processing && "opacity-50",
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/utm/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/utm/page.tsx
index adffa1d1f6..523371ed5f 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/utm/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/utm/page.tsx
@@ -1,6 +1,5 @@
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { InfoTooltip, TooltipContent } from "@dub/ui";
import { Suspense } from "react";
import WorkspaceUtmTemplatesClient, { UTMPageControls } from "./page-client";
@@ -8,18 +7,11 @@ export default function WorkspaceUtmTemplates() {
return (
<PageContent
title="UTM Templates"
- titleInfo={
- <InfoTooltip
- content={
- <TooltipContent
- title="Learn how to create UTM templates on Dub to streamline UTM campaign management across your team."
- href="https://dub.co/help/article/how-to-create-utm-templates"
- target="_blank"
- cta="Learn more"
- />
- }
- />
- }
+ titleInfo={{
+ title:
+ "Learn how to create UTM templates on Dub to streamline UTM campaign management across your team.",
+ href: "https://dub.co/help/article/how-to-create-utm-templates",
+ }}
controls={<UTMPageControls />}
>
<PageWidthWrapper>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/layout.tsx
index 7aa382598f..459c2aac1d 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/layout.tsx
@@ -1,6 +1,5 @@
import { PageContent } from "@/ui/layout/page-content";
import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { InfoTooltip, TooltipContent } from "@dub/ui";
import { ReactNode } from "react";
import { DomainsHeader } from "./header";
@@ -8,18 +7,11 @@ export default function DomainsLayout({ children }: { children: ReactNode }) {
return (
<PageContent
title="Domains"
- titleInfo={
- <InfoTooltip
- content={
- <TooltipContent
- title="Learn more about how to add, configure, and verify custom domains on Dub."
- href="https://dub.co/help/article/how-to-add-custom-domain"
- target="_blank"
- cta="Learn more"
- />
- }
- />
- }
+ titleInfo={{
+ title:
+ "Learn more about how to add, configure, and verify custom domains on Dub.",
+ href: "https://dub.co/help/article/how-to-add-custom-domain",
+ }}
>
<PageWidthWrapper>
<div className="grid gap-4">
diff --git a/apps/web/ui/layout/page-content/index.tsx b/apps/web/ui/layout/page-content/index.tsx
index 256de75ea0..dab13d7525 100644
--- a/apps/web/ui/layout/page-content/index.tsx
+++ b/apps/web/ui/layout/page-content/index.tsx
@@ -1,3 +1,4 @@
+import { InfoTooltip, TooltipContent } from "@dub/ui";
import { cn } from "@dub/utils";
import { ChevronLeft } from "lucide-react";
import Link from "next/link";
@@ -17,7 +18,7 @@ export function PageContent({
children,
}: PropsWithChildren<{
title?: ReactNode;
- titleInfo?: ReactNode;
+ titleInfo?: ReactNode | { title: string; href: string };
titleBackHref?: string;
controls?: ReactNode;
className?: string;
@@ -25,6 +26,26 @@ export function PageContent({
}>) {
const hasTitle = title !== undefined;
+ // Generate titleInfo from object if provided
+ const finalTitleInfo =
+ titleInfo &&
+ typeof titleInfo === "object" &&
+ "title" in titleInfo &&
+ "href" in titleInfo ? (
+ <InfoTooltip
+ content={
+ <TooltipContent
+ title={titleInfo.title}
+ href={titleInfo.href}
+ target="_blank"
+ cta="Learn more"
+ />
+ }
+ />
+ ) : (
+ titleInfo
+ );
+
return (
<div
className={cn(
@@ -50,7 +71,7 @@ export function PageContent({
<h1 className="text-content-emphasis text-lg font-semibold leading-7">
{title}
</h1>
- {titleInfo}
+ {finalTitleInfo}
</div>
)}
</div>
diff --git a/apps/web/ui/links/link-card.tsx b/apps/web/ui/links/link-card.tsx
index dd64eb2447..fb6636647c 100644
--- a/apps/web/ui/links/link-card.tsx
+++ b/apps/web/ui/links/link-card.tsx
@@ -4,7 +4,6 @@ import {
CardList,
ExpandingArrow,
useIntersectionObserver,
- useMediaQuery,
useRouterStuff,
} from "@dub/ui";
import Link from "next/link";
@@ -49,7 +48,6 @@ export const LinkCard = memo(({ link }: { link: ResponseLink }) => {
const LinkCardInner = memo(({ link }: { link: ResponseLink }) => {
const { variant, loading } = useContext(CardList.Context);
- const { isMobile } = useMediaQuery();
const ref = useRef<HTMLDivElement>(null);
const router = useRouter();
@@ -87,17 +85,11 @@ const LinkCardInner = memo(({ link }: { link: ResponseLink }) => {
<>
<CardList.Card
key={link.id}
- onClick={
- !isMobile
- ? (e) => {
- if (e.metaKey || e.ctrlKey) window.open(editUrl, "_blank");
- else router.push(editUrl);
- }
- : undefined
- }
- onAuxClick={
- !isMobile ? () => window.open(editUrl, "_blank") : undefined
- }
+ onClick={(e) => {
+ if (e.metaKey || e.ctrlKey) window.open(editUrl, "_blank");
+ else router.push(editUrl);
+ }}
+ onAuxClick={() => window.open(editUrl, "_blank")}
outerClassName="overflow-hidden"
innerClassName="p-0"
{...(variant === "loose" &&