The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
small updates to domain modal
Steven Tey9f3f3414f025
diff --git a/apps/web/prisma/schema.prisma b/apps/web/prisma/schema.prismaindex 3da2306f2c..7306923a37 100644--- a/apps/web/prisma/schema.prisma+++ b/apps/web/prisma/schema.prisma@@ -94,7 +94,7 @@ model Project {linksUsage Int @default(0)linksLimit Int @default(25)domainsLimit Int @default(1)- tagsLimit Int @default(10)+ tagsLimit Int @default(5)usersLimit Int @default(1)monitoringId String? @unique // cron job ID for monitoringdiff --git a/apps/web/ui/layout/nav-tabs.tsx b/apps/web/ui/layout/nav-tabs.tsxindex d945d01028..e665f5f2c8 100644--- a/apps/web/ui/layout/nav-tabs.tsx+++ b/apps/web/ui/layout/nav-tabs.tsx@@ -8,38 +8,25 @@ import { ModalContext } from "@/ui/modals/provider";import { Badge } from "@dub/ui";import { motion } from "framer-motion";import Link from "next/link";-import { useParams, usePathname, useSearchParams } from "next/navigation";+import { useParams, usePathname } from "next/navigation";import { useContext, useMemo } from "react";export default function NavTabs() {const pathname = usePathname();const { slug } = useParams() as { slug?: string };- const searchParams = useSearchParams();const { loading, error } = useProject();- const tabs = useMemo(() => {- if (slug) {- return [- { name: "Links", href: `/${slug}` },- { name: "Analytics", href: `/${slug}/analytics` },- { name: "Domains", href: `/${slug}/domains` },- { name: "Settings", href: `/${slug}/settings` },- ];- }- if (pathname === "/analytics") {- return [{ name: "← Back to all links", href: "/links" }];- }- return [- { name: "Projects", href: "/" },- { name: "Links", href: "/links" },- { name: "Settings", href: "/settings" },- ];- }, [pathname, slug, searchParams]);+ const tabs = [+ { name: "Links", href: `/${slug}` },+ { name: "Analytics", href: `/${slug}/analytics` },+ { name: "Domains", href: `/${slug}/domains` },+ { name: "Settings", href: `/${slug}/settings` },+ ];const { verified, loading: loadingDomains } = useDomains();const { data: count } = useLinksCount();- if (error) return null;+ if (!slug || error) return null;return (<div className="scrollbar-hide mb-[-3px] flex h-12 items-center justify-start space-x-2 overflow-x-auto">diff --git a/apps/web/ui/layout/project-select.tsx b/apps/web/ui/layout/project-select.tsxindex a8b22a583f..02c13ce2bc 100644--- a/apps/web/ui/layout/project-select.tsx+++ b/apps/web/ui/layout/project-select.tsx@@ -135,30 +135,7 @@ function ProjectList({return (<div className="relative mt-1 max-h-72 w-full space-y-0.5 overflow-auto rounded-md bg-white p-2 text-base sm:w-60 sm:text-sm sm:shadow-lg">- <div className="p-2 text-xs text-gray-500">Personal Account</div>- <Link- key="personal"- className={`relative flex w-full items-center space-x-2 rounded-md px-2 py-1.5 hover:bg-gray-100 active:bg-gray-200 ${- selected.slug === "/" ? "font-medium" : ""- } transition-all duration-75`}- href="/links"- onClick={() => setOpenPopover(false)}- >- <Avatar user={session?.user} className="h-7 w-7" />- <span- className={`block truncate pr-8 text-sm ${- selected.slug === "/" ? "font-medium" : "font-normal"- }`}- >- {session?.user?.name || session?.user?.email}- </span>- {selected.slug === "/" ? (- <span className="absolute inset-y-0 right-0 flex items-center pr-3 text-black">- <Tick className="h-5 w-5" aria-hidden="true" />- </span>- ) : null}- </Link>- <div className="p-2 text-xs text-gray-500">Custom Projects</div>+ <div className="p-2 text-xs text-gray-500">My Projects</div>{projects.map(({ id, name, slug, logo, primaryDomain }) => (<Linkkey={slug}diff --git a/apps/web/ui/modals/add-edit-domain-modal.tsx b/apps/web/ui/modals/add-edit-domain-modal.tsxindex 3e0094358a..1ab863267f 100644--- a/apps/web/ui/modals/add-edit-domain-modal.tsx+++ b/apps/web/ui/modals/add-edit-domain-modal.tsx@@ -13,11 +13,13 @@ import {useRouterStuff,} from "@dub/ui";import {+ FADE_IN_ANIMATION_SETTINGS,SHORT_DOMAIN,SWIPE_REVEAL_ANIMATION_SETTINGS,capitalize,} from "@dub/utils";import { AnimatePresence, motion } from "framer-motion";+import { ChevronRight } from "lucide-react";import { useParams, useRouter } from "next/navigation";import {Dispatch,@@ -139,6 +141,8 @@ function AddEditDomainModal({});}+ const [expanded, setExpanded] = useState(false);+return (<ModalshowModal={showAddEditDomainModal}@@ -306,7 +310,6 @@ function AddEditDomainModal({</Tooltip>)}</div>-<AnimatePresence initial={false}>{target && (<motion.div key="type" {...SWIPE_REVEAL_ANIMATION_SETTINGS}>@@ -333,41 +336,63 @@ function AddEditDomainModal({)}</AnimatePresence>- <div>- <label htmlFor="placeholder" className="flex items-center space-x-2">- <h2 className="text-sm font-medium text-gray-900">- Input Placeholder URL- </h2>- <InfoTooltip content="Provide context to your teammates in the link creation modal by showing them an example of a link to be shortened." />- </label>- <div className="relative mt-1 rounded-md shadow-sm">- <input- type="url"- name="placeholder"- id="placeholder"- className="block w-full rounded-md border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"- placeholder="https://dub.co/help/article/what-is-dub"- value={placeholder}- onChange={(e) =>- setData({ ...data, placeholder: e.target.value })- }- />- </div>- </div>-- <div className="flex items-center justify-between bg-gray-50">- <div className="flex items-center space-x-2">- <h2 className="text-sm font-medium text-gray-900">- Primary Domain- </h2>- <InfoTooltip content="The default domain used in the link creation modal. You can only have one primary domain at a time." />- </div>- <Switch- fn={() => setData((prev) => ({ ...prev, primary: !primary }))}- checked={primary}- disabled={props?.primary}+ <button+ type="button"+ className="flex items-center"+ onClick={() => setExpanded(!expanded)}+ >+ <ChevronRight+ className={`h-5 w-5 text-gray-600 ${+ expanded ? "rotate-90" : ""+ } transition-all`}/>- </div>+ <p className="text-sm text-gray-600">Advanced options</p>+ </button>+ {expanded && (+ <motion.div+ {...FADE_IN_ANIMATION_SETTINGS}+ className="flex flex-col space-y-6"+ >+ <div className="flex items-center justify-between bg-gray-50">+ <div className="flex items-center space-x-2">+ <h2 className="text-sm font-medium text-gray-900">+ Primary Domain+ </h2>+ <InfoTooltip content="The default domain used in the link creation modal. You can only have one primary domain at a time." />+ </div>+ <Switch+ fn={() => setData((prev) => ({ ...prev, primary: !primary }))}+ checked={primary}+ disabled={props?.primary}+ />+ </div>++ <div>+ <label+ htmlFor="placeholder"+ className="flex items-center space-x-2"+ >+ <h2 className="text-sm font-medium text-gray-900">+ Input Placeholder URL+ </h2>+ <InfoTooltip content="Provide context to your teammates in the link creation modal by showing them an example of a link to be shortened." />+ </label>+ <div className="relative mt-1 rounded-md shadow-sm">+ <input+ type="url"+ name="placeholder"+ id="placeholder"+ className="block w-full rounded-md border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"+ placeholder="https://dub.co/help/article/what-is-dub"+ value={placeholder}+ onChange={(e) =>+ setData({ ...data, placeholder: e.target.value })+ }+ />+ </div>+ </div>+ </motion.div>+ )}<div className="grid gap-2"><Button@@ -375,24 +400,18 @@ function AddEditDomainModal({disabled={saveDisabled}loading={saving}/>- {props &&- (props.primary ? (- <Button- disabledTooltip="You can't delete your primary domain."- text="Delete domain"- />- ) : (- <Button- variant="danger"- text="Delete domain"- onClick={() => {- window.confirm(- "Warning: Deleting your project's domain will delete all existing short links using the domain. Are you sure you want to continue?",- ) && deleteDomain();- }}- loading={deleting}- />- ))}+ {props && (+ <Button+ variant="danger"+ text="Delete domain"+ onClick={() => {+ window.confirm(+ "Warning: Deleting your project's domain will delete all existing short links using the domain. Are you sure you want to continue?",+ ) && deleteDomain();+ }}+ loading={deleting}+ />+ )}</div></form></Modal>diff --git a/apps/web/ui/modals/add-edit-link-modal/index.tsx b/apps/web/ui/modals/add-edit-link-modal/index.tsxindex 4a946669df..3d33a83916 100644--- a/apps/web/ui/modals/add-edit-link-modal/index.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/index.tsx@@ -19,7 +19,6 @@ import {deepEqual,getApexDomain,getUrlWithoutUTMParams,- isDubDomain,isValidUrl,linkConstructor,truncate,diff --git a/packages/utils/src/constants/pricing.tsx b/packages/utils/src/constants/pricing.tsxindex 8483492a44..6114802655 100644--- a/packages/utils/src/constants/pricing.tsx+++ b/packages/utils/src/constants/pricing.tsx@@ -10,7 +10,7 @@ export const PLANS = [links: 25,clicks: 1000,domains: 1,- tags: 10,+ tags: 5,users: 1,},colors: {