The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
consolidate under Library > Tags | UTM Templates
Steven Tey708913f319ec
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/header.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/header.tsxnew file mode 100644index 0000000000..76156ee24f--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/header.tsx@@ -0,0 +1,31 @@+"use client";++import useWorkspace from "@/lib/swr/use-workspace";+import { TabSelect } from "@dub/ui";+import { useRouter, useSelectedLayoutSegment } from "next/navigation";++export default function LibraryHeader() {+ const router = useRouter();+ const { slug } = useWorkspace();++ const selectedLayoutSegment = useSelectedLayoutSegment();+ const page = selectedLayoutSegment === null ? "" : selectedLayoutSegment;++ return (+ <div className="border-b border-gray-200">+ <h1 className="text-2xl font-semibold tracking-tight text-black">+ Library+ </h1>+ <TabSelect+ options={[+ { id: "tags", label: "Tags" },+ { id: "utm", label: "UTM Templates" },+ ]}+ selected={page}+ onSelect={(id) => {+ router.push(`/${slug}/settings/library/${id}`);+ }}+ />+ </div>+ );+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/layout.tsxnew file mode 100644index 0000000000..e7977cdf67--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/layout.tsx@@ -0,0 +1,11 @@+import { ReactNode } from "react";+import LibraryHeader from "./header";++export default function LibraryLayout({ children }: { children: ReactNode }) {+ return (+ <div className="grid gap-4">+ <LibraryHeader />+ {children}+ </div>+ );+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/page-client.tsxsimilarity index 72%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/page-client.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/page-client.tsxindex af5c036902..e7631d9ae1 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/page-client.tsx@@ -11,7 +11,6 @@ import { SearchBoxPersisted } from "@/ui/shared/search-box";import { PaginationControls } from "@dub/blocks";import { CardList, usePagination, useRouterStuff } from "@dub/ui";import { Tag } from "@dub/ui/src/icons";-import { InfoTooltip, TooltipContent } from "@dub/ui/src/tooltip";import { Dispatch, SetStateAction, createContext, useState } from "react";import { TagCard } from "./tag-card";import { TagCardPlaceholder } from "./tag-card-placeholder";@@ -53,36 +52,19 @@ export default function WorkspaceTagsClient() {return (<>- <div className="grid gap-5 pb-10">- <div className="flex flex-wrap justify-between gap-6">- <div className="flex items-center gap-x-2">- <h1 className="text-2xl font-semibold tracking-tight text-black">- Tags- </h1>- <InfoTooltip- content={- <TooltipContent- title="Learn more about how to use tags on Dub."- href="https://dub.co/help/article/how-to-use-tags"- target="_blank"- cta="Learn more"- />+ <div className="grid gap-4 pb-10">+ <div className="flex w-full flex-wrap items-center justify-between gap-3 gap-6 sm:w-auto">+ <SearchBoxPersisted+ loading={loading}+ onChangeDebounced={(t) => {+ if (t) {+ queryParams({ set: { search: t }, del: "page" });+ } else {+ queryParams({ del: "search" });}- />- </div>- <div className="flex w-full flex-wrap items-center gap-3 sm:w-auto">- <SearchBoxPersisted- loading={loading}- onChangeDebounced={(t) => {- if (t) {- queryParams({ set: { search: t }, del: "page" });- } else {- queryParams({ del: "search" });- }- }}- />- <AddTagButton />- </div>+ }}+ />+ <AddTagButton /></div>{workspaceId && <AddEditTagModal />}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/page.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/page.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/page.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/tag-card-placeholder.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/tag-card-placeholder.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/tag-card-placeholder.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/tag-card-placeholder.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/tag-card.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/tag-card.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tags/tag-card.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/tags/tag-card.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/page-client.tsxsimilarity index 84%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/page-client.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/page-client.tsxindex a6f11f832f..d05a832b5a 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/page-client.tsx@@ -40,16 +40,9 @@ export default function WorkspaceUtmTemplatesClient() {return (<>- <div className="grid gap-5">- <div className="flex flex-wrap justify-between gap-6">- <div className="flex items-center gap-x-2">- <h1 className="text-2xl font-semibold tracking-tight text-black">- UTM Templates- </h1>- </div>- <div className="flex w-full flex-wrap items-center gap-3 sm:w-auto">- <AddUtmTemplateButton />- </div>+ <div className="grid gap-4">+ <div className="flex justify-end gap-6">+ <AddUtmTemplateButton /></div>{workspaceId && <AddEditUtmTemplateModal />}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/page.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/page.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/page.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/template-card-placeholder.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/template-card-placeholder.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/template-card-placeholder.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/template-card-placeholder.tsxdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/template-card.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/template-card.tsxsimilarity index 100%rename from apps/web/app/app.dub.co/(dashboard)/[slug]/settings/utm-templates/template-card.tsxrename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/library/utm/template-card.tsxdiff --git a/apps/web/lib/middleware/app.ts b/apps/web/lib/middleware/app.tsindex b74b0b74f1..1c640fe342 100644--- a/apps/web/lib/middleware/app.ts+++ b/apps/web/lib/middleware/app.ts@@ -1,7 +1,7 @@import { parse } from "@/lib/middleware/utils";import { NextRequest, NextResponse } from "next/server";import NewLinkMiddleware from "./new-link";-import { APP_REDIRECTS } from "./utils/app-redirects";+import { appRedirect } from "./utils/app-redirect";import { getDefaultWorkspace } from "./utils/get-default-workspace";import { getOnboardingStep } from "./utils/get-onboarding-step";import { getUserViaToken } from "./utils/get-user-via-token";@@ -83,8 +83,8 @@ export default async function AppMiddleware(req: NextRequest) {isTopLevelSettingsRedirect(path)) {return WorkspacesMiddleware(req, user);- } else if (APP_REDIRECTS[path]) {- return NextResponse.redirect(new URL(APP_REDIRECTS[path], req.url));+ } else if (appRedirect(path)) {+ return NextResponse.redirect(new URL(appRedirect(path), req.url));}}diff --git a/apps/web/lib/middleware/utils/app-redirect.ts b/apps/web/lib/middleware/utils/app-redirect.tsnew file mode 100644index 0000000000..1bb38f59a5--- /dev/null+++ b/apps/web/lib/middleware/utils/app-redirect.ts@@ -0,0 +1,12 @@+const APP_REDIRECTS = {+ "/account": "/account/settings",+};++export const appRedirect = (path: string) => {+ if (path.endsWith("/settings/library") || path.endsWith("/settings/tags")) {+ return "/settings/library/tags";+ } else if (APP_REDIRECTS[path]) {+ return APP_REDIRECTS[path];+ }+ return null;+};diff --git a/apps/web/lib/middleware/utils/app-redirects.ts b/apps/web/lib/middleware/utils/app-redirects.tsdeleted file mode 100644index ce94ff35bc..0000000000--- a/apps/web/lib/middleware/utils/app-redirects.ts+++ /dev/null@@ -1,3 +0,0 @@-export const APP_REDIRECTS = {- "/account": "/account/settings",-};diff --git a/apps/web/ui/layout/settings-layout.tsx b/apps/web/ui/layout/settings-layout.tsxindex 870fd0e402..2df1ab018a 100644--- a/apps/web/ui/layout/settings-layout.tsx+++ b/apps/web/ui/layout/settings-layout.tsx@@ -6,8 +6,8 @@ export default function SettingsLayout({ children }: PropsWithChildren) {return (<PageContent><div className="relative min-h-[calc(100vh-16px)]">- <MaxWidthWrapper className="pb-10 pt-3">- <div className="grid gap-5">{children}</div>+ <MaxWidthWrapper className="grid gap-5 pb-10 pt-3">+ {children}</MaxWidthWrapper></div></PageContent>diff --git a/apps/web/ui/layout/sidebar/items.ts b/apps/web/ui/layout/sidebar/items.tsindex 5a33ac2c7b..2d4008c4d4 100644--- a/apps/web/ui/layout/sidebar/items.ts+++ b/apps/web/ui/layout/sidebar/items.ts@@ -1,20 +1,19 @@import { BetaFeatures } from "@/lib/types";import { Icon } from "@dub/ui";import {+ Books2,CircleInfo,ConnectedDots,CubeSettings,- DiamondTurnRight,Gear2,Gift,Globe,Key,Receipt2,ShieldCheck,- Tag,Users6,+ Webhook,} from "@dub/ui/src/icons";-import { Webhook } from "lucide-react";import { CursorRays } from "./icons/cursor-rays";import { Gear } from "./icons/gear";import { Hyperlink } from "./icons/hyperlink";@@ -83,14 +82,9 @@ export const ITEMS: Record<href: `/${slug}/settings/domains`,},{- name: "Tags",- icon: Tag,- href: `/${slug}/settings/tags`,- },- {- name: "UTM Templates",- icon: DiamondTurnRight,- href: `/${slug}/settings/utm-templates`,+ name: "Library",+ icon: Books2,+ href: `/${slug}/settings/library`,},{name: "Billing",diff --git a/apps/web/ui/modals/link-builder/webhook-select.tsx b/apps/web/ui/modals/link-builder/webhook-select.tsxindex 0e07ea0332..0885e76046 100644--- a/apps/web/ui/modals/link-builder/webhook-select.tsx+++ b/apps/web/ui/modals/link-builder/webhook-select.tsx@@ -1,6 +1,6 @@import useWebhooks from "@/lib/swr/use-webhooks";import useWorkspace from "@/lib/swr/use-workspace";-import { Button, Combobox, Globe, useKeyboardShortcut, Webhook } from "@dub/ui";+import { Button, Combobox, useKeyboardShortcut, Webhook } from "@dub/ui";import { cn } from "@dub/utils";import { useRouter } from "next/navigation";import { useMemo, useState } from "react";@@ -85,7 +85,7 @@ const NoWebhooksFound = () => {return (<div className="flex h-full flex-col items-center justify-center gap-2 px-2 py-4 text-center text-sm"><div className="flex items-center justify-center rounded-2xl border border-gray-200 bg-gray-50 p-3">- <Globe className="size-6 text-gray-700" />+ <Webhook className="size-6 text-gray-700" /></div><p className="mt-2 font-medium text-gray-950">No webhooks found</p><p className="mx-auto mt-1 w-full max-w-[180px] text-gray-700">diff --git a/packages/ui/src/icons/nucleo/books2.tsx b/packages/ui/src/icons/nucleo/books2.tsxnew file mode 100644index 0000000000..058bedb78b--- /dev/null+++ b/packages/ui/src/icons/nucleo/books2.tsx@@ -0,0 +1,94 @@+import { SVGProps } from "react";++export function Books2(props: SVGProps<SVGSVGElement>) {+ return (+ <svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" {...props}>+ <g fill="currentColor">+ <rect+ height="12.5"+ width="4"+ fill="none"+ rx="1"+ ry="1"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ x="5.75"+ y="2.75"+ />+ <rect+ height="10.5"+ width="3"+ fill="none"+ rx="1"+ ry="1"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ x="2.75"+ y="4.75"+ />+ <rect+ height="10.5"+ width="3.5"+ fill="none"+ rx="1"+ ry="1"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ transform="translate(-2.382 4.324) rotate(-17.344)"+ x="11.235"+ y="4.719"+ />+ <line+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ x1="10.934"+ x2="14.275"+ y1="9.272"+ y2="8.228"+ />+ <line+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ x1="5.75"+ x2="9.75"+ y1="7.25"+ y2="7.25"+ />+ <line+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ x1="2.75"+ x2="5.75"+ y1="8.75"+ y2="8.75"+ />+ <line+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ x1="1"+ x2="17"+ y1="15.25"+ y2="15.25"+ />+ </g>+ </svg>+ );+}diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.tsindex 822894470e..59056ec143 100644--- a/packages/ui/src/icons/nucleo/index.ts+++ b/packages/ui/src/icons/nucleo/index.ts@@ -7,6 +7,7 @@ export * from "./arrows-opposite-direction-y";export * from "./blog";export * from "./bolt";export * from "./book2";+export * from "./books2";export * from "./box-archive";export * from "./bullet-list";export * from "./cards";