The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Build a Help Center
Steven Teye82e6a9ea0f8
diff --git a/app/dub.sh/help/constants.tsx b/app/dub.sh/help/constants.tsxnew file mode 100644index 0000000000..cb9e423725--- /dev/null+++ b/app/dub.sh/help/constants.tsx@@ -0,0 +1,44 @@+import { Logo } from "@/components/shared/icons";+import { Globe, Link2, Settings, Webhook } from "lucide-react";++export const POPULAR_ARTICLES = [+ "what-is-dub",+ "how-to-add-custom-domain",+ "how-to-use-tags",+ "how-to-invite-teammates",+ "dub-api",+ "how-to-upgrade",+];++export const CATEGORIES = [+ {+ title: "Dub Overview",+ slug: "overview",+ description: "Learn about Dub and how it can help you.",+ icon: <Logo className="h-6 w-6 text-gray-500" />,+ },+ {+ title: "Getting Started",+ slug: "getting-started",+ description: "Learn how to get started with Dub.",+ icon: <Settings className="h-6 w-6 text-gray-500" />,+ },+ {+ title: "Link Management",+ slug: "link-management",+ description: "Learn how to manage your links on Dub.",+ icon: <Link2 className="h-6 w-6 text-gray-500" />,+ },+ {+ title: "Custom Domains",+ slug: "custom-domains",+ description: "Learn how to use custom domains with Dub.",+ icon: <Globe className="h-6 w-6 text-gray-500" />,+ },+ {+ title: "API",+ slug: "api",+ description: "Learn how to use the Dub API.",+ icon: <Webhook className="h-6 w-6 text-gray-500" />,+ },+];diff --git a/app/dub.sh/help/page.tsx b/app/dub.sh/help/page.tsxnew file mode 100644index 0000000000..24ded28310--- /dev/null+++ b/app/dub.sh/help/page.tsx@@ -0,0 +1,86 @@+import { constructMetadata } from "#/lib/utils";+import { ExpandingArrow } from "#/ui/icons";+import MaxWidthWrapper from "@/components/shared/max-width-wrapper";+import { allHelpPosts } from "contentlayer/generated";+import { Search } from "lucide-react";+import Link from "next/link";+import { CATEGORIES, POPULAR_ARTICLES } from "./constants";+import CategoryCard from "#/ui/help/category-card";++export const metadata = constructMetadata({+ title: "Help Center – Dub",+});++export default function HelpCenter() {+ const popularArticles = POPULAR_ARTICLES.map(+ (slug) => allHelpPosts.find((post) => post.slug === slug)!,+ );++ const categories = CATEGORIES.map((category) => ({+ ...category,+ postCount: allHelpPosts.filter((post) =>+ post.categories.includes(category.slug),+ ).length,+ }));++ return (+ <>+ <MaxWidthWrapper className="max-w-screen-lg">+ <div className="flex flex-col space-y-4 py-10">+ <h1 className="font-display text-xl font-bold text-gray-700 sm:text-3xl">+ 👋 How can we help today?+ </h1>+ <button className="group relative flex">+ <Search className="absolute inset-y-0 left-4 z-10 my-auto h-4 w-4 text-gray-500" />+ <div className="w-full rounded-xl border border-gray-200 bg-white p-3 pl-12 text-left text-gray-500 shadow-md transition ease-out group-active:border-gray-200 group-active:shadow-none">+ Search for articles...+ </div>+ </button>+ </div>+ </MaxWidthWrapper>++ <div className="relative">+ <div className="absolute top-28 h-full w-full border border-gray-200 bg-white/10 shadow-[inset_10px_-50px_94px_0_rgb(199,199,199,0.2)] backdrop-blur" />+ <MaxWidthWrapper className="max-w-screen-lg pb-20">+ <div className="relative mb-10 rounded-xl border border-gray-200 bg-white px-4 py-6">+ <h2 className="px-4 font-display text-2xl font-bold text-gray-700">+ Popular Articles+ </h2>+ <div className="mt-4 grid gap-2 md:grid-cols-2">+ {popularArticles.map((article) => (+ <Link+ href={`/help/${article.slug}`}+ key={article.slug}+ className="group flex items-center justify-between rounded-lg px-4 py-2.5 transition-colors hover:bg-purple-100 active:bg-purple-200"+ >+ <h3 className="font-medium text-gray-600 group-hover:text-purple-600">+ {article.title}+ </h3>+ <ExpandingArrow className="-ml-4 h-4 w-4 text-gray-400 group-hover:text-purple-600" />+ </Link>+ ))}+ </div>+ </div>+ <div className="grid gap-4 sm:grid-cols-2 md:grid-cols-3">+ {categories.map((category) => (+ <CategoryCard+ key={category.slug}+ href={`/help/${category.slug}`}+ name={category.title}+ description={category.description}+ icon={category.icon}+ pattern={{+ y: 16,+ squares: [+ [0, 1],+ [1, 3],+ ],+ }}+ />+ ))}+ </div>+ </MaxWidthWrapper>+ </div>+ </>+ );+}diff --git a/app/dub.sh/providers.tsx b/app/dub.sh/providers.tsxindex 85c1730b71..77da8c04c6 100644--- a/app/dub.sh/providers.tsx+++ b/app/dub.sh/providers.tsx@@ -1,5 +1,6 @@"use client";+import { SessionProvider } from "next-auth/react";import { useSelectedLayoutSegment } from "next/navigation";import { ReactNode } from "react";@@ -12,10 +13,10 @@ export default function MarketingProviders({}) {const segment = useSelectedLayoutSegment();return (- <>+ <SessionProvider>{/* Only show stats modal if it's on the home page */}{!segment && modal}{children}- </>+ </SessionProvider>);}diff --git a/app/ui/help/category-card.tsx b/app/ui/help/category-card.tsxnew file mode 100644index 0000000000..1e7b040951--- /dev/null+++ b/app/ui/help/category-card.tsx@@ -0,0 +1,143 @@+"use client";++import Link from "next/link";+import { motion, useMotionTemplate, useMotionValue } from "framer-motion";++import { useId } from "react";++function GridPattern({+ width,+ height,+ x,+ y,+ squares,+ ...props+}: {+ width: number;+ height: number;+ x: number | string;+ y?: number | string;+ squares?: [number, number][];+ className?: string;+}) {+ let patternId = useId();++ return (+ <svg aria-hidden="true" {...props}>+ <defs>+ <pattern+ id={patternId}+ width={width}+ height={height}+ patternUnits="userSpaceOnUse"+ x={x}+ y={y}+ >+ <path d={`M.5 ${height}V.5H${width}`} fill="none" />+ </pattern>+ </defs>+ <rect+ width="100%"+ height="100%"+ strokeWidth={0}+ fill={`url(#${patternId})`}+ />+ {squares && (+ <svg x={x} y={y} className="overflow-visible">+ {squares.map(([x, y]) => (+ <rect+ strokeWidth="0"+ key={`${x}-${y}`}+ width={width + 1}+ height={height + 1}+ x={x * width}+ y={y * height}+ />+ ))}+ </svg>+ )}+ </svg>+ );+}++function CardPattern({ mouseX, mouseY, ...gridProps }) {+ let maskImage = useMotionTemplate`radial-gradient(180px at ${mouseX}px ${mouseY}px, white, transparent)`;+ let style = { maskImage, WebkitMaskImage: maskImage };++ return (+ <div className="pointer-events-none">+ <div className="absolute inset-0 rounded-2xl transition duration-300 [mask-image:linear-gradient(white,transparent)] group-hover:opacity-50">+ <GridPattern+ width={72}+ height={56}+ x="50%"+ className="absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-black/[0.02] stroke-black/5"+ {...gridProps}+ />+ </div>+ <motion.div+ className="absolute inset-0 rounded-2xl bg-gradient-to-r from-[#e4dffb] via-[#edd7d7] to-[#d7ede4] opacity-0 transition duration-300 group-hover:opacity-100"+ style={style}+ />+ <motion.div+ className="absolute inset-0 rounded-2xl opacity-0 mix-blend-overlay transition duration-300 group-hover:opacity-100"+ style={style}+ >+ <GridPattern+ width={72}+ height={56}+ x="50%"+ className="absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-black/50 stroke-black/70"+ {...gridProps}+ />+ </motion.div>+ </div>+ );+}++export default function CategoryCard({+ href,+ name,+ description,+ icon,+ pattern,+}: {+ href: string;+ name: string;+ description: string;+ icon: React.ReactNode;+ pattern: {+ y: number;+ squares: [number, number][];+ };+}) {+ let mouseX = useMotionValue(0);+ let mouseY = useMotionValue(0);++ function onMouseMove({ currentTarget, clientX, clientY }) {+ let { left, top } = currentTarget.getBoundingClientRect();+ mouseX.set(clientX - left);+ mouseY.set(clientY - top);+ }++ return (+ <div+ key={href}+ onMouseMove={onMouseMove}+ className="group relative flex rounded-2xl bg-zinc-50 transition-shadow hover:shadow-md hover:shadow-zinc-900/5"+ >+ <CardPattern {...pattern} mouseX={mouseX} mouseY={mouseY} />+ <div className="absolute inset-0 rounded-2xl ring-1 ring-inset ring-zinc-200 group-hover:ring-zinc-900/10" />+ <div className="relative rounded-2xl px-4 pb-4 pt-16">+ {icon}+ <h3 className="mt-4 font-semibold leading-7 text-zinc-900">+ <Link href={href}>+ <span className="absolute inset-0 rounded-2xl" />+ {name}+ </Link>+ </h3>+ <p className="mt-1 text-sm text-zinc-600">{description}</p>+ </div>+ </div>+ );+}diff --git a/app/ui/home/background/index.tsx b/app/ui/home/background/index.tsxindex 2de8466bc7..50f1a34413 100644--- a/app/ui/home/background/index.tsx+++ b/app/ui/home/background/index.tsx@@ -2,8 +2,7 @@import { useSelectedLayoutSegment } from "next/navigation";import styles from "./background.module.css";--const showBackgroundSegments = new Set(["metatags", "pricing"]);+import { SHOW_BACKGROUND_SEGMENTS } from "#/lib/constants";export default function Background() {let segment;@@ -13,7 +12,7 @@ export default function Background() {// this is for /login and /signup which are still on /pages router}- return !segment || showBackgroundSegments.has(segment) ? (+ return !segment || SHOW_BACKGROUND_SEGMENTS.has(segment) ? (<div className={styles.main}><div className={styles.content} /></div>diff --git a/app/ui/home/footer.tsx b/app/ui/home/footer.tsxindex 97b0e882c0..8043de94d9 100644--- a/app/ui/home/footer.tsx+++ b/app/ui/home/footer.tsx@@ -9,7 +9,10 @@ import va from "@vercel/analytics";const navigation = {product: [{ name: "Pricing", href: "/pricing" }],company: [{ name: "Changelog", href: "/changelog" }],- resources: [{ name: "Metatags API", href: "/metatags" }],+ resources: [+ { name: "Help Center", href: "/help" },+ { name: "Metatags API", href: "/metatags" },+ ],legal: [{ name: "Privacy", href: "/privacy" },{ name: "Terms", href: "/terms" },@@ -103,7 +106,7 @@ export default function Footer() {</ul></div><div className="mt-10 md:mt-0">- <h3 className="text-sm font-semibold text-gray-600">Tools</h3>+ <h3 className="text-sm font-semibold text-gray-600">Company</h3><ul role="list" className="mt-4 space-y-4">{navigation.company.map((item) => (<li key={item.name}>@@ -128,7 +131,9 @@ export default function Footer() {</div><div className="md:grid md:grid-cols-2 md:gap-8"><div>- <h3 className="text-sm font-semibold text-gray-600">Company</h3>+ <h3 className="text-sm font-semibold text-gray-600">+ Resources+ </h3><ul role="list" className="mt-4 space-y-4">{navigation.resources.map((item) => (<li key={item.name}>diff --git a/app/ui/home/nav.tsx b/app/ui/home/nav.tsxindex a876549ee4..0c701e5103 100644--- a/app/ui/home/nav.tsx+++ b/app/ui/home/nav.tsx@@ -6,71 +6,102 @@ import { useParams, useSelectedLayoutSegment } from "next/navigation";import useScroll from "#/lib/hooks/use-scroll";import { cn } from "#/lib/utils";import MaxWidthWrapper from "@/components/shared/max-width-wrapper";-import { APP_DOMAIN } from "#/lib/constants";+import { APP_DOMAIN, SHOW_BACKGROUND_SEGMENTS } from "#/lib/constants";import va from "@vercel/analytics";+import { LogoType } from "../icons";-const navItems = ["pricing", "changelog"];--const transparentHeaderSegments = new Set(["metatags", "pricing"]);+const navItems = [+ {+ name: "Pricing",+ segment: "pricing",+ },+ {+ name: "Changelog",+ segment: "changelog",+ },+ {+ name: "Help Center",+ segment: "help",+ },+];export default function Nav() {const { domain = "dub.sh" } = useParams() as { domain: string };const scrolled = useScroll(80);- const segment = useSelectedLayoutSegment();+ const selectedLayout = useSelectedLayoutSegment();+ const helpCenter = selectedLayout === "help";return (<divclassName={cn(`sticky inset-x-0 top-0 z-30 w-full transition-all`, {"border-b border-gray-200 bg-white/75 backdrop-blur-lg": scrolled,"border-b border-gray-200 bg-white":- segment && !transparentHeaderSegments.has(segment),+ selectedLayout && !SHOW_BACKGROUND_SEGMENTS.has(selectedLayout),})}>- <MaxWidthWrapper>+ <MaxWidthWrapper+ {...(helpCenter && {+ className: "max-w-screen-lg",+ })}+ ><div className="flex h-14 items-center justify-between">- <Link- href={domain === "dub.sh" ? "/" : `https://dub.sh`}- {...(domain !== "dub.sh" && {- onClick: () => {- va.track("Referred from custom domain", {- domain,- medium: "logo",- });- },- })}- >- <Image- src="/_static/logotype.svg"- alt="Dub.sh logo"- width={834}- height={236}- className="w-24"- />- </Link>+ <div className="flex items-center space-x-3">+ <Link+ href={domain === "dub.sh" ? "/" : `https://dub.sh`}+ {...(domain !== "dub.sh" && {+ onClick: () => {+ va.track("Referred from custom domain", {+ domain,+ medium: "logo",+ });+ },+ })}+ >+ <LogoType />+ </Link>+ {helpCenter && (+ <div className="flex items-center">+ <div className="mr-3 h-5 border-l-2 border-gray-400" />+ <Link+ href="/help"+ className="font-display text-lg font-bold text-gray-700"+ >+ Help Center+ </Link>+ </div>+ )}+ </div>- <div className="hidden items-center space-x-6 sm:flex">- {navItems.map((item) => (- <Link- key={item}- href={- domain === "dub.sh" ? `/${item}` : `https://dub.sh/${item}`- }- {...(domain !== "dub.sh" && {- onClick: () => {- va.track("Referred from custom domain", {- domain,- medium: `navbar item (${item})`,- });- },- })}- className={`rounded-md text-sm font-medium capitalize ${- segment === item ? "text-black" : "text-gray-500"- } transition-colors ease-out hover:text-black`}- >- {item}- </Link>- ))}+ <div className="hidden items-center space-x-2 sm:flex">+ {!helpCenter &&+ navItems.map(({ name, segment }) => (+ <Link+ id={`nav-${segment}`}+ key={segment}+ href={+ domain === "dub.sh"+ ? `/${segment}`+ : `https://dub.sh/${segment}`+ }+ {...(domain !== "dub.sh" && {+ onClick: () => {+ va.track("Referred from custom domain", {+ domain,+ medium: `navbar item (${segment})`,+ });+ },+ })}+ className={cn(+ "z-10 rounded-full px-4 py-1.5 text-sm font-medium capitalize text-gray-500 transition-colors ease-out hover:text-black",+ {+ "text-black": selectedLayout === segment,+ },+ )}+ >+ {name}+ </Link>+ ))}<Linkhref={`${APP_DOMAIN}/login`}{...(domain !== "dub.sh" && {@@ -81,7 +112,7 @@ export default function Nav() {});},})}- className="rounded-md text-sm font-medium text-gray-500 transition-colors ease-out hover:text-black"+ className="rounded-full px-4 py-1.5 text-sm font-medium text-gray-500 transition-colors ease-out hover:text-black">Log in</Link>diff --git a/components/shared/icons/logo.tsx b/components/shared/icons/logo.tsxindex 9fb7eb2220..a95fbc2ed4 100644--- a/components/shared/icons/logo.tsx+++ b/components/shared/icons/logo.tsx@@ -1,11 +1,13 @@-export default function Logo({ className }: { className: string }) {+import { cn } from "#/lib/utils";++export default function Logo({ className }: { className?: string }) {return (<svgwidth="191"height="191"fill="currentColor"viewBox="0 0 191 191"- className={className}+ className={cn("h-5 w-5", className)}><g clipPath="url(#clip0_928_108)"><pathdiff --git a/components/shared/modal.tsx b/components/shared/modal.tsxindex ec86f9b96b..6d04a28dc8 100644--- a/components/shared/modal.tsx+++ b/components/shared/modal.tsx@@ -115,7 +115,7 @@ export default function Modal({<div className="-mr-1 h-1 w-6 rounded-full bg-gray-300 transition-all group-active:rotate-12" /><div className="h-1 w-6 rounded-full bg-gray-300 transition-all group-active:-rotate-12" /></div>- {children}+ <div className="pb-10">{children}</div></motion.div>{!mobileOnly && (<divdiff --git a/contentlayer.config.ts b/contentlayer.config.tsindex 5ef9fb35cf..8b331264b1 100644--- a/contentlayer.config.ts+++ b/contentlayer.config.ts@@ -3,6 +3,7 @@ import remarkGfm from "remark-gfm";import rehypePrettyCode from "rehype-pretty-code";import rehypeSlug from "rehype-slug";import rehypeAutolinkHeadings from "rehype-autolink-headings";+import { allHelpPosts } from "contentlayer/generated";const capitalize = (str: string) => {return str.charAt(0).toUpperCase() + str.slice(1);@@ -38,6 +39,39 @@ export const ChangelogPost = defineDocumentType(() => ({computedFields: computedFields("changelog"),}));+export const HelpPost = defineDocumentType(() => ({+ name: "HelpPost",+ filePathPattern: `**/help/*.mdx`,+ contentType: "mdx",+ fields: {+ title: {+ type: "string",+ required: true,+ },+ updatedAt: {+ type: "string",+ required: true,+ },+ summary: {+ type: "string",+ required: true,+ },+ author: {+ type: "string",+ required: true,+ },+ categories: {+ type: "list",+ of: {+ type: "string",+ },+ required: true,+ },+ },+ // @ts-ignore+ computedFields: computedFields("help"),+}));+export const LegalPost = defineDocumentType(() => ({name: "LegalPost",filePathPattern: `**/legal/*.mdx`,@@ -56,7 +90,7 @@ export const LegalPost = defineDocumentType(() => ({computedFields: computedFields("legal"),}));-const computedFields = (type: "changelog" | "legal") => ({+const computedFields = (type: "changelog" | "help" | "legal") => ({slug: {type: "string",resolve: (doc) => doc._raw.flattenedPath.replace(`${type}/`, ""),@@ -108,7 +142,7 @@ const computedFields = (type: "changelog" | "legal") => ({export default makeSource({contentDirPath: "posts",- documentTypes: [ChangelogPost, LegalPost],+ documentTypes: [ChangelogPost, LegalPost, HelpPost],mdx: {remarkPlugins: [remarkGfm],rehypePlugins: [diff --git a/lib/constants/index.ts b/lib/constants/index.tsindex 9364249681..89c42be71c 100644--- a/lib/constants/index.ts+++ b/lib/constants/index.ts@@ -83,6 +83,12 @@ export const DUB_LOGO =export const DUB_THUMBNAIL ="https://public.blob.vercel-storage.com/kmKY9FhOzDRAX28c/thumbnail-wU82A4LTeJMXrygW1ZR6O36k3edeJf.png";+export const SHOW_BACKGROUND_SEGMENTS = new Set([+ "metatags",+ "pricing",+ "help",+]);+export { default as COUNTRIES } from "./countries";export { default as ccTLDs } from "./cctlds";diff --git a/posts/help/dub-api.mdx b/posts/help/dub-api.mdxnew file mode 100644index 0000000000..127268e97b--- /dev/null+++ b/posts/help/dub-api.mdx@@ -0,0 +1,11 @@+---+title: Does Dub have an API?+updatedAt: 2023-07-18+summary: "Dub has an API that allows you to create, update, and delete links programmatically."+author: "steventey"+categories: ["api"]+---++No, Dub does not have an API yet, but it is planned for the future.++If you would like to be notified when the API is available, please [sign up for the waitlist](https://tally.so/r/wdN50V).diff --git a/posts/help/how-to-add-custom-domain.mdx b/posts/help/how-to-add-custom-domain.mdxnew file mode 100644index 0000000000..5f54da6910--- /dev/null+++ b/posts/help/how-to-add-custom-domain.mdx@@ -0,0 +1,9 @@+---+title: How to add a custom domain to Dub+updatedAt: 2023-07-18+summary: "Learn how to add a custom domain to Dub."+author: "steventey"+categories: ["custom-domains"]+---++Here's how to add a custom domain to Dub.diff --git a/posts/help/how-to-invite-teammates.mdx b/posts/help/how-to-invite-teammates.mdxnew file mode 100644index 0000000000..34181bdc31--- /dev/null+++ b/posts/help/how-to-invite-teammates.mdx@@ -0,0 +1,9 @@+---+title: How to invite teammates to Dub?+updatedAt: 2023-07-18+summary: "This article will show you how to invite teammates to Dub."+author: "steventey"+categories: ["overview"]+---++## Introductiondiff --git a/posts/help/how-to-upgrade.mdx b/posts/help/how-to-upgrade.mdxnew file mode 100644index 0000000000..22bb66c4f2--- /dev/null+++ b/posts/help/how-to-upgrade.mdx@@ -0,0 +1,9 @@+---+title: How to upgrade to Dub Pro?+updatedAt: 2023-07-18+summary: "How to upgrade to Dub Pro?"+author: "steventey"+categories: ["overview"]+---++## Introductiondiff --git a/posts/help/how-to-use-tags.mdx b/posts/help/how-to-use-tags.mdxnew file mode 100644index 0000000000..f4bb081dde--- /dev/null+++ b/posts/help/how-to-use-tags.mdx@@ -0,0 +1,9 @@+---+title: How to use Tags on Dub+updatedAt: 2023-07-18+summary: "A guide on how to use tags to better manage your links on Dub."+author: "steventey"+categories: ["link-management"]+---++Here's how to use tags to better manage your links on Dub.diff --git a/posts/help/what-is-dub.mdx b/posts/help/what-is-dub.mdxnew file mode 100644index 0000000000..59155ffbf6--- /dev/null+++ b/posts/help/what-is-dub.mdx@@ -0,0 +1,9 @@+---+title: What Is Dub?+updatedAt: 2023-07-18+summary: "An in-depth overview of Dub and its features."+author: "steventey"+categories: ["overview"]+---++Dub is the link management tool for modern marketing teams.