The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improve project creation flow
Steven Tey9e17030a4c6a
diff --git a/apps/web/ui/modals/add-edit-domain-modal/domain-input.tsx b/apps/web/ui/modals/add-edit-domain-modal/domain-input.tsxnew file mode 100644index 0000000000..8e782539aa--- /dev/null+++ b/apps/web/ui/modals/add-edit-domain-modal/domain-input.tsx@@ -0,0 +1,162 @@+import { AlertCircleFill, CheckCircleFill } from "@/ui/shared/icons";+import { Label, RadioGroup, RadioGroupItem } from "@dub/ui";+import {+ FADE_IN_ANIMATION_SETTINGS,+ cn,+ getApexDomain,+ getSubdomain,+ getUrlFromString,+} from "@dub/utils";+import { useEffect, useMemo, useState } from "react";+import { useDebounce } from "use-debounce";+import { motion } from "framer-motion";+import { InfoTooltip } from "@dub/ui/src/tooltip";++export default function DomainInput({+ identifier = "domain", // "domain" is the default, but when it's used in AddEditDomainModal, it's "slug"+ data,+ setData,+ domainError,+ setDomainError,+}) {+ const domain = data[identifier];++ const [debouncedDomain] = useDebounce(domain, 500);++ useEffect(() => {+ if (debouncedDomain.length > 0) {+ fetch(`/api/domains/${debouncedDomain}/exists`).then(async (res) => {+ if (res.status === 200) {+ const exists = await res.json();+ setDomainError(exists === 1 ? "Domain is already in use." : null);+ }+ });+ }+ }, [debouncedDomain]);++ const [domainType, setDomainType] = useState<string | undefined>(undefined);+ const apexDomain = useMemo(+ () => getApexDomain(getUrlFromString(domain) || ""),+ [domain],+ );++ return (+ <>+ <div className="relative mt-2 flex rounded-md shadow-sm">+ {domainType === "website" ? (+ <div className="relative flex w-full rounded-md shadow-sm">+ <input+ name="subdomain"+ id="subdomain"+ type="text"+ required+ autoComplete="off"+ placeholder="subdomain"+ className="w-1/3 rounded-l-md border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"+ value={getSubdomain(domain, apexDomain) || ""}+ onChange={(e) => {+ setData({+ ...data,+ [identifier]: `${e.target.value}.${apexDomain}`,+ });+ }}+ aria-invalid="true"+ />+ <span className="inline-flex flex-1 items-center rounded-r-md border border-l-0 border-gray-300 bg-gray-50 px-3 text-gray-500 sm:text-sm">+ {apexDomain}+ </span>+ </div>+ ) : (+ <input+ name="domain"+ id="domain"+ type="text"+ required+ autoComplete="off"+ pattern="[a-zA-Z0-9\-.]+"+ className={cn(+ "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",+ {+ "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500":+ domainError,+ },+ )}+ placeholder="go.acme.com"+ value={domain}+ onChange={(e) => {+ setDomainError(null);+ setData({ ...data, [identifier]: e.target.value });+ }}+ aria-invalid="true"+ />+ )}+ {domainError ? (+ <div className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">+ <AlertCircleFill+ className="h-5 w-5 text-red-500"+ aria-hidden="true"+ />+ </div>+ ) : domainType === "spare" ? (+ <div className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">+ <CheckCircleFill+ className="h-5 w-5 text-green-500"+ aria-hidden="true"+ />+ </div>+ ) : null}+ </div>+ {domainError &&+ (domainError === "Domain is already in use." ? (+ <p className="mt-2 text-sm text-red-600" id="domain-error">+ Domain is already in use.{" "}+ <a+ className="underline"+ href="mailto:[email protected]?subject=My Domain Is Already In Use"+ >+ Contact us+ </a>{" "}+ if you'd like to use this domain for your project.+ </p>+ ) : (+ <p className="mt-2 text-sm text-red-600" id="domain-error">+ {domainError}+ </p>+ ))}+ {domain && !domainError && (+ <motion.div {...FADE_IN_ANIMATION_SETTINGS}>+ <RadioGroup+ className="mt-2"+ name="domainType"+ required+ value={domainType}+ onValueChange={(value) => {+ setDomainType(value);+ }}+ >+ <div className="flex items-center space-x-2 rounded-md border border-gray-300 bg-white transition-all hover:bg-gray-50 active:bg-gray-100">+ <RadioGroupItem value="spare" id="spare" className="ml-3" />+ <Label+ htmlFor="spare"+ className="flex flex-1 cursor-pointer items-center justify-between space-x-1 p-3 pl-0"+ >+ <p className="text-gray-600">This is a spare domain</p>+ <InfoTooltip content="If this is a separate domain that you're planning to use solely for short links, then you're good to go." />+ </Label>+ </div>+ <div className="flex items-center space-x-2 rounded-md border border-gray-300 bg-white transition-all hover:bg-gray-50 active:bg-gray-100">+ <RadioGroupItem value="website" id="website" className="ml-3" />+ <Label+ htmlFor="website"+ className="flex flex-1 cursor-pointer items-center justify-between space-x-1 p-3 pl-0"+ >+ <p className="text-gray-600">This is our website's domain</p>+ <InfoTooltip content="If you're using this domain for your main website or app, you should be using a subdomain for your short links instead (e.g. go.acme.com)." />+ </Label>+ </div>+ </RadioGroup>+ </motion.div>+ )}+ </>+ );+}diff --git a/apps/web/ui/modals/add-edit-domain-modal.tsx b/apps/web/ui/modals/add-edit-domain-modal/index.tsxsimilarity index 55%rename from apps/web/ui/modals/add-edit-domain-modal.tsxrename to apps/web/ui/modals/add-edit-domain-modal/index.tsxindex 86ea361927..4c7525e443 100644--- a/apps/web/ui/modals/add-edit-domain-modal.tsx+++ b/apps/web/ui/modals/add-edit-domain-modal/index.tsx@@ -1,33 +1,31 @@import useProject from "@/lib/swr/use-project";import { DomainProps } from "@/lib/types";-import { ModalContext } from "@/ui/modals/provider";import { BlurImage } from "@/ui/shared/blur-image";-import { AlertCircleFill, Lock } from "@/ui/shared/icons";+import { Lock } from "@/ui/shared/icons";import {Button,InfoTooltip,Logo,Modal,- SimpleTooltipContent,Switch,Tooltip,TooltipContent,+ useRouterStuff,} from "@dub/ui";-import { SHORT_DOMAIN, SWIPE_REVEAL_ANIMATION_SETTINGS } from "@dub/utils";-import { AnimatePresence, motion } from "framer-motion";+import { FADE_IN_ANIMATION_SETTINGS, capitalize } from "@dub/utils";+import { motion } from "framer-motion";+import { ChevronRight } from "lucide-react";import { useParams, useRouter } from "next/navigation";import {Dispatch,SetStateAction,useCallback,- useContext,- useEffect,useMemo,useState,} from "react";import { toast } from "sonner";import { mutate } from "swr";-import { useDebounce } from "use-debounce";+import DomainInput from "./domain-input";function AddEditDomainModal({showAddEditDomainModal,@@ -41,7 +39,7 @@ function AddEditDomainModal({const router = useRouter();const { slug } = useParams() as { slug: string };const { logo, plan } = useProject();- const { setShowUpgradePlanModal } = useContext(ModalContext);+ const { queryParams } = useRouterStuff();const [data, setData] = useState<DomainProps>(props || {@@ -56,18 +54,6 @@ function AddEditDomainModal({const { slug: domain, primary, target, type, placeholder } = data;- const [debouncedDomain] = useDebounce(domain, 500);- useEffect(() => {- if (debouncedDomain.length > 0 && debouncedDomain !== props?.slug) {- fetch(`/api/domains/${debouncedDomain}/exists`).then(async (res) => {- if (res.status === 200) {- const exists = await res.json();- setDomainError(exists === 1 ? "Domain is already in use." : null);- }- });- }- }, [debouncedDomain]);-const [lockDomain, setLockDomain] = useState(true);const [saving, setSaving] = useState(false);const [domainError, setDomainError] = useState<string | null>(null);@@ -118,16 +104,11 @@ function AddEditDomainModal({method: "DELETE",}).then(async (res) => {if (res.status === 200) {- await Promise.all([- mutate(`/api/projects/${slug}/domains`),- mutate(- (key) =>- typeof key === "string" &&- key.startsWith(`/api/projects/${slug}/links`),- undefined,- { revalidate: true },- ),- ]);+ await mutate(+ (key) => typeof key === "string" && key.startsWith(`/api/projects`),+ undefined,+ { revalidate: true },+ );setShowAddEditDomainModal(false);toast.success("Successfully deleted domain!");} else {@@ -137,6 +118,8 @@ function AddEditDomainModal({});}+ const [expanded, setExpanded] = useState(false);+return (<ModalshowModal={showAddEditDomainModal}@@ -208,60 +191,18 @@ function AddEditDomainModal({)}</div>{props && lockDomain ? (- <div className="mt-1 cursor-not-allowed rounded-md border border-gray-300 bg-gray-100 px-3 py-2 text-sm text-gray-500 shadow-sm">+ <div className="mt-2 cursor-not-allowed rounded-md border border-gray-300 bg-gray-100 px-3 py-2 text-sm text-gray-500 shadow-sm">{domain}</div>) : (- <div className="relative mt-1 rounded-md shadow-sm">- <input- type="text"- name="domain"- id="domain"- required- autoFocus- autoComplete="off"- pattern="[[\p{Letter}\p{Mark}\d-.]+"- className={`${- domainError- ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"- : "border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:ring-gray-500"- } block w-full rounded-md focus:outline-none sm:text-sm`}- placeholder={SHORT_DOMAIN}- value={domain}- onChange={(e) => {- setDomainError(null);- setData({ ...data, slug: e.target.value });- }}- aria-invalid="true"- aria-describedby="domain-error"- />- {domainError && (- <div className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">- <AlertCircleFill- className="h-5 w-5 text-red-500"- aria-hidden="true"- />- </div>- )}- </div>+ <DomainInput+ identifier="slug"+ data={data}+ setData={setData}+ domainError={domainError}+ setDomainError={setDomainError}+ />)}- {domainError &&- (domainError === "Domain is already in use." ? (- <p className="mt-2 text-sm text-red-600" id="domain-error">- Domain is already in use.{" "}- <a- className="underline"- href="mailto:[email protected]?subject=My Domain Is Already In Use"- >- Contact us- </a>{" "}- if you'd like to use this domain for your project.- </p>- ) : (- <p className="mt-2 text-sm text-red-600" id="domain-error">- {domainError}- </p>- ))}</div><div>@@ -270,7 +211,7 @@ function AddEditDomainModal({<InfoTooltip content="The page your users will get redirected to when they visit your domain." /></label>{plan !== "free" ? (- <div className="relative mt-1 rounded-md shadow-sm">+ <div className="relative mt-2 rounded-md shadow-sm"><inputtype="url"name="target"@@ -289,79 +230,102 @@ function AddEditDomainModal({cta="Upgrade to Pro"onClick={() => {setShowAddEditDomainModal(false);- setShowUpgradePlanModal(true);+ queryParams({+ set: {+ upgrade: "pro",+ },+ });}}/>}>- <div className="mt-1 w-full cursor-not-allowed rounded-md border border-gray-300 px-3 py-2 text-left text-sm text-gray-300 sm:max-w-md">+ <div className="mt-2 w-full cursor-not-allowed rounded-md border border-gray-300 px-3 py-2 text-left text-sm text-gray-300 sm:max-w-md">https://yourdomain.com</div></Tooltip>)}</div>-- <AnimatePresence initial={false}>- {target && (- <motion.div key="type" {...SWIPE_REVEAL_ANIMATION_SETTINGS}>- <label- htmlFor="type"- className="block text-sm font-medium text-gray-700"- >- Behavior- </label>- <select- value={type}- onChange={(e) =>- setData({- ...data,- type: e.target.value as "redirect" | "rewrite",- })- }- className="mt-1 w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-gray-500 shadow-sm focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"- >- <option value="redirect">Redirect</option>- <option value="rewrite">Rewrite (Link Cloaking)</option>- </select>- </motion.div>- )}- </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}+ {target && (+ <motion.div key="type" {...FADE_IN_ANIMATION_SETTINGS}>+ <label+ htmlFor="type"+ className="block text-sm font-medium text-gray-700"+ >+ Behavior+ </label>+ <select+ value={type}onChange={(e) =>- setData({ ...data, placeholder: e.target.value })+ setData({+ ...data,+ type: e.target.value as "redirect" | "rewrite",+ })}- />- </div>- </div>+ className="mt-2 w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-gray-500 shadow-sm focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"+ >+ <option value="redirect">Redirect</option>+ <option value="rewrite">Rewrite (Link Cloaking)</option>+ </select>+ </motion.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-2 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@@ -369,24 +333,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>@@ -399,12 +357,12 @@ function AddEditDomainButton({setShowAddEditDomainModal: Dispatch<SetStateAction<boolean>>;}) {return (- <button- onClick={() => setShowAddEditDomainModal(true)}- className="rounded-md border border-black bg-black px-5 py-2 text-sm font-medium text-white transition-all duration-75 hover:bg-white hover:text-black active:scale-95"- >- Add Domain- </button>+ <div>+ <Button+ text="Add Domain"+ onClick={() => setShowAddEditDomainModal(true)}+ />+ </div>);}diff --git a/apps/web/ui/modals/add-project-modal.tsx b/apps/web/ui/modals/add-project-modal.tsxindex cbad5ce603..dc6378bac9 100644--- a/apps/web/ui/modals/add-project-modal.tsx+++ b/apps/web/ui/modals/add-project-modal.tsx@@ -1,9 +1,20 @@import { AlertCircleFill } from "@/ui/shared/icons";-import { Button, InfoTooltip, Logo, Modal } from "@dub/ui";-import { HOME_DOMAIN, SHORT_DOMAIN, generateDomainFromName } from "@dub/utils";+import {+ Button,+ InfoTooltip,+ Logo,+ Modal,+ Switch,+ useRouterStuff,+} from "@dub/ui";+import {+ FADE_IN_ANIMATION_SETTINGS,+ HOME_DOMAIN,+ generateDomainFromName,+} from "@dub/utils";import slugify from "@sindresorhus/slugify";import va from "@vercel/analytics";-import { usePathname, useRouter } from "next/navigation";+import { usePathname, useRouter, useSearchParams } from "next/navigation";import {Dispatch,FormEvent,@@ -16,6 +27,8 @@ import {import { toast } from "sonner";import { useDebounce } from "use-debounce";import { mutate } from "swr";+import { motion } from "framer-motion";+import DomainInput from "./add-edit-domain-modal/domain-input";function AddProjectModalHelper({showAddProjectModal,@@ -27,10 +40,6 @@ function AddProjectModalHelper({const router = useRouter();const pathname = usePathname();- const [slugError, setSlugError] = useState<string | null>(null);- const [domainError, setDomainError] = useState<string | null>(null);- const [saving, setSaving] = useState(false);-const [data, setData] = useState<{name: string;slug: string;@@ -42,6 +51,10 @@ function AddProjectModalHelper({});const { name, slug, domain } = data;+ const [slugError, setSlugError] = useState<string | null>(null);+ const [domainError, setDomainError] = useState<string | null>(null);+ const [saving, setSaving] = useState(false);+const [debouncedSlug] = useDebounce(slug, 500);useEffect(() => {if (debouncedSlug.length > 0 && !slugError) {@@ -54,18 +67,6 @@ function AddProjectModalHelper({}}, [debouncedSlug, slugError]);- const [debouncedDomain] = useDebounce(domain, 500);- useEffect(() => {- if (debouncedDomain.length > 0 && !domainError) {- fetch(`/api/domains/${debouncedDomain}/exists`).then(async (res) => {- if (res.status === 200) {- const exists = await res.json();- setDomainError(exists === 1 ? "Domain is already in use." : null);- }- });- }- }, [debouncedDomain, domainError]);-useEffect(() => {setSlugError(null);setDomainError(null);@@ -135,7 +136,7 @@ function AddProjectModalHelper({toast.error(domainErrorResponse);}} else {- toast.error(res.statusText);+ toast.error(await res.text());}setSaving(false);});@@ -151,7 +152,7 @@ function AddProjectModalHelper({content={`This is the name of your project on ${process.env.NEXT_PUBLIC_APP_NAME}.`}/></label>- <div className="mt-1 flex rounded-md shadow-sm">+ <div className="mt-2 flex rounded-md shadow-sm"><inputname="name"id="name"@@ -160,7 +161,7 @@ function AddProjectModalHelper({autoFocusautoComplete="off"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={process.env.NEXT_PUBLIC_APP_NAME}+ placeholder="Acme, Inc."value={name}onChange={(e) => {setData({ ...data, name: e.target.value });@@ -179,7 +180,7 @@ function AddProjectModalHelper({content={`This is your project's unique slug on ${process.env.NEXT_PUBLIC_APP_NAME}.`}/></label>- <div className="relative mt-1 flex rounded-md shadow-sm">+ <div className="relative mt-2 flex rounded-md shadow-sm"><span className="inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-50 px-5 text-gray-500 sm:text-sm">app.{process.env.NEXT_PUBLIC_APP_DOMAIN}</span>@@ -195,7 +196,7 @@ function AddProjectModalHelper({? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500": "border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:ring-gray-500"} block w-full rounded-r-md focus:outline-none sm:text-sm`}- placeholder="dub"+ placeholder="acme"value={slug}onChange={(e) => {setSlugError(null);@@ -220,59 +221,22 @@ function AddProjectModalHelper({</div><div>- <label htmlFor="domain" className="flex items-center space-x-2">- <p className="block text-sm font-medium text-gray-700">- Shortlink Domain- </p>- <InfoTooltip content="This is the domain that your short links will be hosted on. E.g. yourbrand.com/link" />- </label>- <div className="relative mt-1 flex rounded-md shadow-sm">- <input- name="domain"- id="domain"- type="text"- required- autoComplete="off"- pattern="[a-zA-Z0-9\-.]+"- className={`${- domainError- ? "border-red-300 pr-10 text-red-900 placeholder-red-300 focus:border-red-500 focus:ring-red-500"- : "border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:ring-gray-500"- } block w-full rounded-md focus:outline-none sm:text-sm`}- placeholder={SHORT_DOMAIN}- value={domain}- onChange={(e) => {- setDomainError(null);- setData({ ...data, domain: e.target.value });- }}- aria-invalid="true"- />- {domainError && (- <div className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">- <AlertCircleFill- className="h-5 w-5 text-red-500"- aria-hidden="true"- />- </div>- )}- </div>- {domainError &&- (domainError === "Domain is already in use." ? (- <p className="mt-2 text-sm text-red-600" id="domain-error">- Domain is already in use.{" "}- <a- className="underline"- href="mailto:[email protected]?subject=My Domain Is Already In Use"- >- Contact us- </a>{" "}- if you'd like to use this domain for your project.- </p>- ) : (- <p className="mt-2 text-sm text-red-600" id="domain-error">- {domainError}+ <div className="flex items-center justify-between">+ <label htmlFor="domain" className="flex items-center space-x-2">+ <p className="block text-sm font-medium text-gray-700">+ Custom Domain</p>- ))}+ <InfoTooltip content="This is the domain that your short links will be hosted on. E.g. yourbrand.com/link" />+ </label>+ </div>+ <motion.div {...FADE_IN_ANIMATION_SETTINGS}>+ <DomainInput+ data={data}+ setData={setData}+ domainError={domainError}+ setDomainError={setDomainError}+ />+ </motion.div></div><Buttondiff --git a/packages/ui/package.json b/packages/ui/package.jsonindex e9ce92aa18..672ef38b39 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -37,8 +37,10 @@"dependencies": {"@radix-ui/react-accordion": "^1.0.1","@radix-ui/react-dialog": "1.0.5",+ "@radix-ui/react-label": "^2.0.2","@radix-ui/react-navigation-menu": "^1.1.2","@radix-ui/react-popover": "1.0.7",+ "@radix-ui/react-radio-group": "^1.1.3","@radix-ui/react-switch": "^1.0.1","@radix-ui/react-tooltip": "^1.0.7","class-variance-authority": "^0.7.0",diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsxindex 08c72bdb7e..767152f56d 100644--- a/packages/ui/src/index.tsx+++ b/packages/ui/src/index.tsx@@ -7,8 +7,10 @@ export * from "./avatar";export * from "./badge";export * from "./button";export * from "./form";+export * from "./label";export * from "./modal";export * from "./popover";+export * from "./radio-group";export * from "./switch";export * from "./tooltip";diff --git a/packages/ui/src/label.tsx b/packages/ui/src/label.tsxnew file mode 100644index 0000000000..e2db63dd31--- /dev/null+++ b/packages/ui/src/label.tsx@@ -0,0 +1,25 @@+"use client";++import { cn } from "@dub/utils";+import * as LabelPrimitive from "@radix-ui/react-label";+import { cva, type VariantProps } from "class-variance-authority";+import * as React from "react";++const labelVariants = cva(+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",+);++const Label = React.forwardRef<+ React.ElementRef<typeof LabelPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &+ VariantProps<typeof labelVariants>+>(({ className, ...props }, ref) => (+ <LabelPrimitive.Root+ ref={ref}+ className={cn(labelVariants(), className)}+ {...props}+ />+));+Label.displayName = LabelPrimitive.Root.displayName;++export { Label };diff --git a/packages/ui/src/radio-group.tsx b/packages/ui/src/radio-group.tsxnew file mode 100644index 0000000000..6eb9f3f599--- /dev/null+++ b/packages/ui/src/radio-group.tsx@@ -0,0 +1,44 @@+"use client";++import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";+import { Circle } from "lucide-react";+import * as React from "react";++import { cn } from "@dub/utils";++const RadioGroup = React.forwardRef<+ React.ElementRef<typeof RadioGroupPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>+>(({ className, ...props }, ref) => {+ return (+ <RadioGroupPrimitive.Root+ className={cn("grid gap-2", className)}+ {...props}+ ref={ref}+ />+ );+});+RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;++const RadioGroupItem = React.forwardRef<+ React.ElementRef<typeof RadioGroupPrimitive.Item>,+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>+>(({ className, ...props }, ref) => {+ return (+ <RadioGroupPrimitive.Item+ ref={ref}+ className={cn(+ "border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square h-4 w-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",+ className,+ )}+ {...props}+ >+ <RadioGroupPrimitive.Indicator className="flex items-center justify-center">+ <Circle className="h-2.5 w-2.5 fill-current text-current" />+ </RadioGroupPrimitive.Indicator>+ </RadioGroupPrimitive.Item>+ );+});+RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;++export { RadioGroup, RadioGroupItem };diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex f7107e1cab..8d6ea40729 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -356,12 +356,18 @@ importers:'@radix-ui/react-dialog':specifier: 1.0.5version: 1.0.5(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-label':+ specifier: ^2.0.2'@radix-ui/react-navigation-menu':specifier: ^1.1.2version: 1.1.2([email protected])([email protected])'@radix-ui/react-popover':specifier: 1.0.7+ '@radix-ui/react-radio-group':+ specifier: ^1.1.3'@radix-ui/react-switch':specifier: ^1.0.1version: 1.0.1([email protected])([email protected])@@ -468,7 +474,7 @@ importers:version: link:../tsconfigtsup:specifier: ^6.1.3- version: 6.1.3([email protected])([email protected])+ version: 6.1.3([email protected])typescript:specifier: ^5.1.6version: 5.1.6@@ -4848,6 +4854,29 @@ packages:react-dom: 18.2.0([email protected])dev: false+ resolution: {integrity: sha512-3SzW+0PW7yBBoQlT8wNcGtaxaD0XSu0uLUFgrtHY08Acx05TaHaOmVLR73c0j/cqpDy53KBMO7s0dx2wmOIDIA==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0+ react-dom: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@babel/runtime': 7.23.2+ '@radix-ui/react-compose-refs': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-slot': 1.0.2(@types/[email protected])([email protected])+ '@types/react': 18.2.14+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false+/@radix-ui/[email protected]([email protected]):resolution: {integrity: sha512-0KaSv6sx787/hK3eF53iOkiSLwAGlFMx5lotrqD2pTjB18KbybKoEIgkNZTKC60YECDQTKGTRcDBILwZVqVKvA==}peerDependencies:@@ -4964,6 +4993,20 @@ packages:react: 18.2.0dev: false+ resolution: {integrity: sha512-RXcvnXgyvYvBEOhCBuddKecVkoMiI10Jcm5cTI7abJRAHYfFxeu+FBQs/DvdxSYucxR5mna0dNsL6QFlds5TMA==}+ peerDependencies:+ '@types/react': '*'+ react: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ dependencies:+ '@babel/runtime': 7.23.2+ '@types/react': 18.2.14+ react: 18.2.0+ dev: false+resolution: {integrity: sha512-n7kDRfx+LB1zLueRDvZ1Pd0bxdJWDUZNQ/GWoxDn2prnuJKRdxsjulejX/ePkOsLi2tTm6P24mDqlMSgQpsT6g==}peerDependencies:@@ -5106,6 +5149,26 @@ packages:react: 18.2.0dev: false+ resolution: {integrity: sha512-N5ehvlM7qoTLx7nWPodsPYPgMzA5WM8zZChQg8nyFJKnDO5WHdba1vv5/H6IO5LtJMfD2Q3wh1qHFGNtK0w3bQ==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0+ react-dom: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@babel/runtime': 7.23.2+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@types/react': 18.2.14+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false+resolution: {integrity: sha512-1fSjOAGTThYSgJ5pENG2V8we7+6KDbfbiyt66HmLTeo0W3PAmmciclm0o97VlcVZW7q5Vg2hN7Cbj4XKo5u2sw==}peerDependencies:@@ -5319,6 +5382,63 @@ packages:react-dom: 18.2.0([email protected])dev: false+ resolution: {integrity: sha512-x+yELayyefNeKeTx4fjK6j99Fs6c4qKm3aY38G3swQVTN6xMpsrbigC0uHs2L//g8q4qR7qOcww8430jJmi2ag==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0+ react-dom: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@babel/runtime': 7.23.2+ '@radix-ui/primitive': 1.0.1+ '@radix-ui/react-compose-refs': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-direction': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-presence': 1.0.1(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-roving-focus': 1.0.4(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-use-controllable-state': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-use-previous': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-use-size': 1.0.1(@types/[email protected])([email protected])+ '@types/react': 18.2.14+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false++ resolution: {integrity: sha512-2mUg5Mgcu001VkGy+FfzZyzbmuUWzgWkj3rvv4yu+mLw03+mTzbxZHvfcGyFp2b8EkQeMkpRQ5FiA2Vr2O6TeQ==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0+ react-dom: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@babel/runtime': 7.23.2+ '@radix-ui/primitive': 1.0.1+ '@radix-ui/react-collection': 1.0.3(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-compose-refs': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-direction': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-id': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-use-callback-ref': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-use-controllable-state': 1.0.1(@types/[email protected])([email protected])+ '@types/react': 18.2.14+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false+/@radix-ui/[email protected]([email protected]):resolution: {integrity: sha512-3mrKauI/tWXo1Ll+gN5dHcxDPdm/Df1ufcDLCecn+pnCIVcdWE7CujXo8QaXOWRJyZyQWWbpB8eFwHzWXlv5mQ==}peerDependencies:@@ -5518,6 +5638,20 @@ packages:react: 18.2.0dev: false+ resolution: {integrity: sha512-cV5La9DPwiQ7S0gf/0qiD6YgNqM5Fk97Kdrlc5yBcrF3jyEZQwm7vYFqMo4IfeHgJXsRaMvLABFtd0OVEmZhDw==}+ peerDependencies:+ '@types/react': '*'+ react: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ dependencies:+ '@babel/runtime': 7.23.2+ '@types/react': 18.2.14+ react: 18.2.0+ dev: false+resolution: {integrity: sha512-Cq5DLuSiuYVKNU8orzJMbl15TXilTnJKUCltMVQg53BQOF1/C5toAaGrowkgksdBQ9H+SRL23g0HDmg9tvmxXw==}peerDependencies:@@ -12637,7 +12771,6 @@ packages:lilconfig: 2.1.0postcss: 8.4.21yaml: 1.10.2- dev: falseresolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}@@ -12725,7 +12858,6 @@ packages:nanoid: 3.3.6picocolors: 1.0.0source-map-js: 1.0.2- dev: falseresolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==}@@ -14557,6 +14689,42 @@ packages:- ts-nodedev: true+ resolution: {integrity: sha512-eRpBnbfpDFng+EJNTQ90N7QAf4HAGGC7O3buHIjroKWK7D1ibk9/YnR/3cS8HsMU5T+6Oi+cnF+yU5WmCnB//Q==}+ engines: {node: '>=14'}+ hasBin: true+ peerDependencies:+ '@swc/core': ^1+ postcss: ^8.4.12+ typescript: ^4.1.0+ peerDependenciesMeta:+ '@swc/core':+ optional: true+ postcss:+ optional: true+ typescript:+ optional: true+ dependencies:+ bundle-require: 3.1.2([email protected])+ cac: 6.7.14+ chokidar: 3.5.3+ debug: 4.3.4+ esbuild: 0.14.54+ execa: 5.1.1+ globby: 11.1.0+ joycon: 3.1.1+ postcss-load-config: 3.1.4([email protected])+ resolve-from: 5.0.0+ rollup: 2.79.1+ source-map: 0.8.0-beta.0+ sucrase: 3.34.0+ tree-kill: 1.2.2+ typescript: 5.1.6+ transitivePeerDependencies:+ - supports-color+ - ts-node+ dev: true+resolution: {integrity: sha512-xHtFaKtHxM9LOklMmJdI3BEnQq/D5F73Of2E1GDrITi9sgoVkvIsrQUTY1G8FlmGtA+awCI4EBlTRRYxkL2sRg==}hasBin: true