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.

Add new domains UI (WIP)

Tim Wilsonbe182c06c52a
diff --git a/apps/web/app/admin.dub.co/components/user-info.tsx b/apps/web/app/admin.dub.co/components/user-info.tsx
index a393446b06..dd2a775b73 100644
--- a/apps/web/app/admin.dub.co/components/user-info.tsx
+++ b/apps/web/app/admin.dub.co/components/user-info.tsx
@@ -1,8 +1,7 @@
"use client";
-import { Badge, Copy, Tick } from "@dub/ui";
+import { Badge, Copy, Globe2, Tick } from "@dub/ui";
import { capitalize, nFormatter } from "@dub/utils";
-import { Globe } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
@@ -58,7 +57,7 @@ export default function UserInfo({ data }: { data: UserInfoProps }) {
{Object.entries(data.defaultDomainLinks).map(([domain, count]) => (
<div key={domain} className="flex justify-between py-2">
<div className="flex items-center space-x-2">
- <Globe className="h-4 w-4" />
+ <Globe2 className="h-4 w-4" />
<span className="font-semibold text-gray-700">{domain}</span>
</div>
<span className="text-gray-500">{count}</span>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/page-client.tsx
new file mode 100644
index 0000000000..39f0890708
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/page-client.tsx
@@ -0,0 +1,64 @@
+"use client";
+
+import useDomains from "@/lib/swr/use-domains";
+import useWorkspace from "@/lib/swr/use-workspace";
+import DomainCard from "@/ui/domains/domain-card";
+import DomainCardPlaceholder from "@/ui/domains/domain-card-placeholder";
+import NoDomainsPlaceholder from "@/ui/domains/no-domains-placeholder";
+import { useAddEditDomainModal } from "@/ui/modals/add-edit-domain-modal";
+import { Button } from "@dub/ui";
+import { useState } from "react";
+
+export default function WorkspaceDomainsClient() {
+ const { id: workspaceId } = useWorkspace();
+
+ const { AddEditDomainModal, AddDomainButton } = useAddEditDomainModal();
+ const { activeWorkspaceDomains, archivedWorkspaceDomains } = useDomains();
+ const [showArchivedDomains, setShowArchivedDomains] = useState(false);
+
+ return (
+ <>
+ <div className="flex justify-between">
+ <h1 className="mb-5 text-2xl font-semibold tracking-tight text-black">
+ Domains
+ </h1>
+ <AddDomainButton />
+ </div>
+ {workspaceId && <AddEditDomainModal />}
+ <div>
+ {activeWorkspaceDomains ? (
+ activeWorkspaceDomains.length > 0 ? (
+ <ul className="grid grid-cols-1 gap-3">
+ {activeWorkspaceDomains.map((domain) => (
+ <li key={domain.slug}>
+ <DomainCard props={domain} />
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <NoDomainsPlaceholder AddDomainButton={AddDomainButton} />
+ )
+ ) : (
+ <DomainCardPlaceholder />
+ )}
+ {archivedWorkspaceDomains && archivedWorkspaceDomains.length > 0 && (
+ <ul className="mt-3 grid grid-cols-1 gap-3">
+ {showArchivedDomains &&
+ archivedWorkspaceDomains?.map((domain) => (
+ <li key={domain.slug}>
+ <DomainCard props={domain} />
+ </li>
+ ))}
+ <Button
+ text={`${showArchivedDomains ? "Hide" : "Show"} ${
+ archivedWorkspaceDomains.length
+ } archived domains`}
+ variant="secondary"
+ onClick={() => setShowArchivedDomains(!showArchivedDomains)}
+ />
+ </ul>
+ )}
+ </div>
+ </>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/page.tsx
new file mode 100644
index 0000000000..b83e32a8d6
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/domains/page.tsx
@@ -0,0 +1,10 @@
+import { Suspense } from "react";
+import WorkspaceDomainsClient from "./page-client";
+
+export default function WorkspaceDomains() {
+ return (
+ <Suspense>
+ <WorkspaceDomainsClient />
+ </Suspense>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
index 876b84ac7c..b22d990de8 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/layout.tsx
@@ -1,5 +1,5 @@
import SettingsLayout from "@/ui/layout/settings-layout";
-import { Gear2, Key, Receipt2, ShieldCheck, Users6 } from "@dub/ui";
+import { Gear2, Globe, Key, Receipt2, ShieldCheck, Users6 } from "@dub/ui";
import { ReactNode } from "react";
export default function WorkspaceSettingsLayout({
@@ -13,6 +13,11 @@ export default function WorkspaceSettingsLayout({
icon: Gear2,
segment: null,
},
+ {
+ name: "Domains",
+ icon: Globe,
+ segment: "domains",
+ },
{
name: "Billing",
icon: Receipt2,
diff --git a/apps/web/ui/analytics/link-preview.tsx b/apps/web/ui/analytics/link-preview.tsx
index dbb0facc17..920c3d3e78 100644
--- a/apps/web/ui/analytics/link-preview.tsx
+++ b/apps/web/ui/analytics/link-preview.tsx
@@ -1,5 +1,5 @@
import { LinkProps } from "@/lib/types";
-import { BlurImage, CopyButton } from "@dub/ui";
+import { BlurImage, CopyButton, Globe2 } from "@dub/ui";
import {
GOOGLE_FAVICON_URL,
getApexDomain,
@@ -7,7 +7,6 @@ import {
timeAgo,
truncate,
} from "@dub/utils";
-import { Globe } from "lucide-react";
export default function LinkPreviewTooltip({ data }: { data: LinkProps }) {
const { domain, key, url, createdAt } = data;
@@ -26,7 +25,7 @@ export default function LinkPreviewTooltip({ data }: { data: LinkProps }) {
/>
) : (
<div className="flex h-8 w-8 items-center justify-center rounded-full border border-gray-300 px-0 sm:h-10 sm:w-10">
- <Globe className="h-4 w-4 text-gray-500 sm:h-5 sm:w-5" />
+ <Globe2 className="h-4 w-4 text-gray-500 sm:h-5 sm:w-5" />
</div>
)}
{/*
diff --git a/apps/web/ui/analytics/toggle.tsx b/apps/web/ui/analytics/toggle.tsx
index 56bb168692..fa4c2fc467 100644
--- a/apps/web/ui/analytics/toggle.tsx
+++ b/apps/web/ui/analytics/toggle.tsx
@@ -25,7 +25,7 @@ import {
Cube,
CursorRays,
FlagWavy,
- Globe,
+ Globe2,
Hyperlink,
Magic,
MobilePhone,
@@ -167,7 +167,7 @@ export default function Toggle({
: [
{
value: `Clicks on ${primaryDomain} domain this year`,
- icon: Globe,
+ icon: Globe2,
},
]),
{
@@ -211,7 +211,7 @@ export default function Toggle({
: [
{
key: "domain",
- icon: Globe,
+ icon: Globe2,
label: "Domain",
getOptionIcon: (value) => (
<BlurImage
@@ -259,7 +259,7 @@ export default function Toggle({
options: [
{
value: true,
- icon: Globe,
+ icon: Globe2,
label: "Root domain link",
},
{
diff --git a/apps/web/ui/domains/domain-card-placeholder.tsx b/apps/web/ui/domains/domain-card-placeholder.tsx
index 8b330c3eb3..5bd9bc0524 100644
--- a/apps/web/ui/domains/domain-card-placeholder.tsx
+++ b/apps/web/ui/domains/domain-card-placeholder.tsx
@@ -1,26 +1,15 @@
export default function DomainCardPlaceholder() {
return (
- <div className="flex flex-col space-y-3 rounded-lg border border-gray-200 bg-white px-5 py-8 sm:px-10">
- <div className="flex flex-col justify-between space-y-4 sm:flex-row sm:space-x-4">
- <div className="flex items-center space-x-2">
- <div className="h-6 w-28 animate-pulse rounded-md bg-gray-200" />
- <div className="h-6 w-32 animate-pulse rounded-full bg-gray-200" />
- </div>
- <div className="flex space-x-3">
- <div className="h-9 w-24 animate-pulse rounded-md bg-gray-200" />
- <div className="h-9 w-9 animate-pulse rounded-md bg-gray-200" />
- </div>
- </div>
- <div className="flex h-10 flex-col space-y-2 sm:flex-row sm:items-center sm:space-x-5 sm:space-y-0">
- <div className="flex items-center space-x-2">
- <div className="h-6 w-6 animate-pulse rounded-full bg-gray-200" />
- <div className="h-5 w-36 animate-pulse rounded-md bg-gray-200" />
- </div>
- <div className="flex items-center space-x-2">
- <div className="h-6 w-6 animate-pulse rounded-full bg-gray-200" />
- <div className="h-5 w-36 animate-pulse rounded-md bg-gray-200" />
+ <div className="grid grid-cols-[60%_1fr] items-center gap-4 rounded-xl border border-gray-200 bg-white p-5 sm:grid-cols-[2fr_1fr_1.5fr] md:grid-cols-[2fr_1fr_0.5fr_1.5fr]">
+ <div className="flex items-center gap-2">
+ <div className="h-12 w-12 animate-pulse rounded-md bg-gray-200" />
+ <div>
+ <div className="h-6 w-32 animate-pulse rounded-md bg-gray-200" />
+ <div className="mt-1 h-5 w-32 animate-pulse rounded-md bg-gray-200" />
</div>
</div>
+ <div className="h-6 w-32 animate-pulse rounded-md bg-gray-200" />
+ <div className="h-6 w-32 animate-pulse rounded-md bg-gray-200" />
</div>
);
}
diff --git a/apps/web/ui/domains/domain-card.tsx b/apps/web/ui/domains/domain-card.tsx
index 01b864f228..262112901d 100644
--- a/apps/web/ui/domains/domain-card.tsx
+++ b/apps/web/ui/domains/domain-card.tsx
@@ -5,33 +5,45 @@ import {
DomainVerificationStatusProps,
LinkProps,
} from "@/lib/types";
+import { CheckCircleFill, Delete, ThreeDots } from "@/ui/shared/icons";
import {
- AlertCircleFill,
- Chart,
- CheckCircleFill,
- Delete,
- ExternalLink,
- ThreeDots,
- XCircleFill,
-} from "@/ui/shared/icons";
-import {
+ ArrowTurnRight2,
Button,
+ CircleCheck,
+ CircleHalfDottedClock,
+ CircleWarning,
+ Copy,
+ Flag2,
+ Gear,
+ Globe,
+ LinesY,
LoadingCircle,
- LoadingDots,
NumberTooltip,
+ PenWriting,
Popover,
+ Refresh2,
SimpleTooltipContent,
+ StatusBadge,
+ Tooltip,
useIntersectionObserver,
+ useMediaQuery,
} from "@dub/ui";
-import { Copy, Gear } from "@dub/ui/src/icons";
import {
DEFAULT_LINK_PROPS,
+ cn,
fetcher,
nFormatter,
punycode,
- truncate,
} from "@dub/utils";
-import { Archive, Edit3, FileCog, FolderInput, QrCode } from "lucide-react";
+import { motion } from "framer-motion";
+import {
+ Archive,
+ ChevronDown,
+ Edit3,
+ FileCog,
+ FolderInput,
+ QrCode,
+} from "lucide-react";
import Link from "next/link";
import { useRef, useState } from "react";
import { toast } from "sonner";
@@ -47,10 +59,9 @@ import { useTransferDomainModal } from "../modals/transfer-domain-modal";
import DomainConfiguration from "./domain-configuration";
export default function DomainCard({ props }: { props: DomainProps }) {
- const { slug: domain, primary, archived } = props || {};
+ const { slug: domain, primary } = props || {};
const { id: workspaceId, slug } = useWorkspace();
- const { activeWorkspaceDomains } = useDomains();
const { data: linkProps } = useSWRImmutable<LinkProps>(
workspaceId
@@ -59,23 +70,6 @@ export default function DomainCard({ props }: { props: DomainProps }) {
fetcher,
);
- const { setShowAddEditLinkModal, AddEditLinkModal } = useAddEditLinkModal({
- props: linkProps || { ...DEFAULT_LINK_PROPS, key: "_root", domain },
- });
-
- const { setShowLinkQRModal, LinkQRModal } = useLinkQRModal({
- props: linkProps || DEFAULT_LINK_PROPS,
- });
-
- const [copiedLinkId, setCopiedLinkId] = useState(false);
-
- const copyLinkId = () => {
- navigator.clipboard.writeText(props.id);
- setCopiedLinkId(true);
- toast.success("Link ID copied!");
- setTimeout(() => setCopiedLinkId(false), 3000);
- };
-
const { data: totalEvents } = useSWR<{ clicks: number }>(
workspaceId &&
linkProps &&
@@ -100,6 +94,206 @@ export default function DomainCard({ props }: { props: DomainProps }) {
fetcher,
);
+ const [showDetails, setShowDetails] = useState(false);
+ const [groupHover, setGroupHover] = useState(false);
+
+ const isInvalid =
+ data &&
+ !["Valid Configuration", "Pending Verification"].includes(data.status);
+
+ return (
+ <>
+ <div
+ ref={domainRef}
+ className="group rounded-xl border border-gray-200 bg-white p-5 transition-[filter] hover:[filter:drop-shadow(0_8px_12px_#222A350d)_drop-shadow(0_32px_80px_#2f30370f)]"
+ onPointerEnter={() => setGroupHover(true)}
+ onPointerLeave={() => setGroupHover(false)}
+ >
+ <div className="grid grid-cols-[60%_1fr] items-center gap-4 sm:grid-cols-[2fr_1fr_1.5fr] md:grid-cols-[2fr_1fr_0.5fr_1.5fr]">
+ <div className="flex items-center gap-4">
+ <div className="rounded-full border border-gray-200">
+ <div className="rounded-full border border-white bg-gradient-to-t from-gray-100 p-1 md:p-3">
+ <Globe className="h-5 w-5" />
+ </div>
+ </div>
+ <div className="overflow-hidden">
+ <div className="flex items-center gap-2.5">
+ <a
+ href={`http://${domain}`}
+ target="_blank"
+ rel="noreferrer"
+ className="truncate text-sm font-medium"
+ title={punycode(domain)}
+ >
+ {punycode(domain)}
+ </a>
+
+ {primary && (
+ <span className="flex items-center gap-1 rounded-full bg-sky-400/[.15] px-3 py-1 text-xs font-medium text-sky-600">
+ <Flag2 className="h-3 w-3" />
+ Primary
+ </span>
+ )}
+ </div>
+ <div className="mt-1 flex items-center gap-1 text-xs">
+ <ArrowTurnRight2 className="h-3 w-3 text-gray-400" />
+ {linkProps ? (
+ linkProps.url ? (
+ <span
+ className="truncate text-gray-500"
+ title={linkProps.url}
+ >
+ {linkProps.url}
+ </span>
+ ) : (
+ <span className="truncate text-gray-400">
+ No redirect configured
+ </span>
+ )
+ ) : (
+ <div className="h-4 w-16 animate-pulse rounded-md bg-gray-200" />
+ )}
+ </div>
+ </div>
+ </div>
+
+ {/* Clicks */}
+ <div className="hidden md:flex">
+ {totalEvents ? (
+ <NumberTooltip value={totalEvents?.clicks}>
+ <Link
+ href={`/${slug}/analytics?domain=${domain}&key=_root`}
+ className="flex items-center gap-1.5 whitespace-nowrap rounded-md bg-gray-100 px-3 py-1 transition-all duration-75 hover:scale-105 active:scale-100"
+ >
+ <LinesY className="h-3 w-3 text-gray-500" />
+ <p className="text-xs font-medium text-gray-900">
+ {nFormatter(totalEvents.clicks)}
+ <span className="ml-1">clicks</span>
+ </p>
+ </Link>
+ </NumberTooltip>
+ ) : (
+ <div className="h-6 w-16 animate-pulse rounded-md bg-gray-200" />
+ )}
+ </div>
+
+ {/* Status */}
+ <div className="hidden sm:block">
+ {data ? (
+ <StatusBadge
+ variant={
+ data.status === "Valid Configuration"
+ ? "success"
+ : data.status === "Pending Verification"
+ ? "pending"
+ : "error"
+ }
+ >
+ {data.status === "Valid Configuration"
+ ? "Active"
+ : data.status === "Pending Verification"
+ ? "Pending"
+ : "Invalid"}
+ </StatusBadge>
+ ) : (
+ <div className="h-6 w-16 animate-pulse rounded-md bg-gray-200" />
+ )}
+ </div>
+
+ <div className="flex justify-end gap-3">
+ <Button
+ text={
+ <div className="flex items-center gap-1">
+ <div className="relative">
+ <Gear
+ className={cn(
+ "h-4 w-4",
+ showDetails ? "text-gray-800" : "text-gray-600",
+ )}
+ />
+ {/* Error indicator */}
+ {data && isInvalid && (
+ <div className="absolute -right-px -top-px h-[5px] w-[5px] rounded-full bg-red-500">
+ <div className="h-full w-full animate-pulse rounded-full ring-2 ring-red-500/30" />
+ </div>
+ )}
+ </div>
+ <ChevronDown
+ className={cn(
+ "hidden h-4 w-4 text-gray-400 transition-transform sm:block",
+ showDetails && "rotate-180",
+ )}
+ />
+ </div>
+ }
+ variant="secondary"
+ className={cn(
+ "h-8 w-auto px-2.5 opacity-100 transition-opacity",
+ !showDetails &&
+ !isInvalid &&
+ "sm:opacity-0 sm:group-hover:opacity-100",
+ )}
+ onClick={() => setShowDetails((s) => !s)}
+ data-state={showDetails ? "open" : "closed"}
+ />
+ <Menu
+ props={props}
+ linkProps={linkProps}
+ refreshProps={{ isValidating, mutate }}
+ groupHover={groupHover}
+ />
+ </div>
+ </div>
+ <motion.div
+ initial={false}
+ animate={{ height: showDetails ? "auto" : 0 }}
+ className="overflow-hidden"
+ >
+ {(!data || data.status !== "Valid Configuration") && (
+ <div className="mt-6 flex items-center gap-2">
+ {data ? (
+ data.status === "Valid Configuration" ? (
+ <CircleCheck className="h-4 w-4 text-blue-500" />
+ ) : data.status === "Pending Verification" ? (
+ <CircleHalfDottedClock className="h-4 w-4 text-yellow-500" />
+ ) : (
+ <CircleWarning className="h-4 w-4 text-red-500" />
+ )
+ ) : (
+ <LoadingCircle className="mr-1 h-4 w-4" />
+ )}
+ <p className="text-xs text-gray-500">
+ {data ? data.status : "Checking Domain Status"}
+ </p>
+ </div>
+ )}
+ {data && <DomainConfiguration data={data} />}
+ </motion.div>
+ </div>
+ </>
+ );
+}
+
+function Menu({
+ props,
+ linkProps,
+ refreshProps,
+ groupHover,
+}: {
+ props: DomainProps;
+ linkProps?: LinkProps;
+ refreshProps: {
+ isValidating: boolean;
+ mutate: () => void;
+ };
+ groupHover: boolean;
+}) {
+ const { primary, archived, slug: domain } = props;
+
+ const { isMobile } = useMediaQuery();
+
+ const { activeWorkspaceDomains } = useDomains();
+
const [openPopover, setOpenPopover] = useState(false);
const { setShowAddEditDomainModal, AddEditDomainModal } =
@@ -126,6 +320,23 @@ export default function DomainCard({ props }: { props: DomainProps }) {
props,
});
+ const { setShowAddEditLinkModal, AddEditLinkModal } = useAddEditLinkModal({
+ props: linkProps || { ...DEFAULT_LINK_PROPS, key: "_root", domain },
+ });
+
+ const { setShowLinkQRModal, LinkQRModal } = useLinkQRModal({
+ props: linkProps || DEFAULT_LINK_PROPS,
+ });
+
+ const [copiedLinkId, setCopiedLinkId] = useState(false);
+
+ const copyLinkId = () => {
+ navigator.clipboard.writeText(props.id);
+ setCopiedLinkId(true);
+ toast.success("Link ID copied!");
+ setTimeout(() => setCopiedLinkId(false), 3000);
+ };
+
const activeDomainsCount = activeWorkspaceDomains?.length || 0;
return (
@@ -137,231 +348,165 @@ export default function DomainCard({ props }: { props: DomainProps }) {
<ArchiveDomainModal />
<DeleteDomainModal />
<TransferDomainModal />
- <div
- ref={domainRef}
- className="flex flex-col space-y-3 rounded-lg border border-gray-200 bg-white px-5 py-8 sm:px-10"
- >
- <div className="flex flex-col justify-between space-y-4 sm:flex-row sm:space-x-4">
- <div className="flex items-center space-x-2">
- <a
- href={`http://${domain}`}
- target="_blank"
- rel="noreferrer"
- className="flex items-center space-x-2"
- >
- <p className="flex items-center text-xl font-semibold">
- {punycode(domain)}
- </p>
- <ExternalLink className="h-5 w-5" />
- </a>
-
- <NumberTooltip value={totalEvents?.clicks}>
- <Link
- href={`/${slug}/analytics?domain=${domain}&key=_root`}
- className="flex items-center space-x-1 rounded-md bg-gray-100 px-2 py-0.5 transition-all duration-75 hover:scale-105 active:scale-100"
- >
- <Chart className="h-4 w-4" />
- <p className="text-sm">
- {!totalEvents ? (
- <LoadingDots />
- ) : (
- nFormatter(totalEvents?.clicks)
- )}
- <span className="ml-1 hidden sm:inline-block">clicks</span>
- </p>
- </Link>
- </NumberTooltip>
- {primary && (
- <span className="rounded-full bg-blue-500 px-3 py-0.5 text-xs text-white">
- Primary Domain
- </span>
- )}
- </div>
- <div className="flex space-x-3">
- <Button
- text="Refresh"
- variant="secondary"
- loading={isValidating}
- onClick={() => {
- mutate();
- }}
- />
- <Popover
- content={
- <div className="w-full sm:w-48">
- <div className="grid gap-px p-2">
- <Button
- text="Edit Link"
- variant="outline"
- onClick={() => {
- setOpenPopover(false);
- setShowAddEditLinkModal(true);
- }}
- icon={<Edit3 className="h-4 w-4" />}
- className="h-9 justify-start px-2 font-medium"
- />
- <Button
- text="QR Code"
- variant="outline"
- onClick={() => {
- setOpenPopover(false);
- setShowLinkQRModal(true);
- }}
- icon={<QrCode className="h-4 w-4" />}
- className="h-9 justify-start px-2 font-medium"
- />
- <Button
- text="Copy Link ID"
- variant="outline"
- onClick={() => copyLinkId()}
- icon={
- copiedLinkId ? (
- <CheckCircleFill className="h-4 w-4" />
- ) : (
- <Copy className="h-4 w-4" />
- )
- }
- className="h-9 justify-start px-2 font-medium"
- />
- </div>
- <div className="border-t border-gray-200" />
- <div className="grid gap-px p-2">
- <Button
- text="Settings"
- variant="outline"
- onClick={() => {
- setOpenPopover(false);
- setShowAddEditDomainModal(true);
- }}
- icon={<Gear className="h-4 w-4" />}
- className="h-9 justify-start px-2 font-medium"
- />
- {!primary && (
- <Button
- text="Set as Primary"
- variant="outline"
- onClick={() => {
- setOpenPopover(false);
- setShowPrimaryDomainModal(true);
- }}
- icon={<FileCog className="h-4 w-4" />}
- className="h-9 justify-start px-2 font-medium"
- />
- )}
- <Button
- text="Transfer"
- variant="outline"
- onClick={() => {
- setOpenPopover(false);
- setShowTransferDomainModal(true);
- }}
- icon={<FolderInput className="h-4 w-4" />}
- className="h-9 justify-start px-2 font-medium"
- {...(primary &&
- activeDomainsCount > 1 && {
- disabledTooltip: (
- <SimpleTooltipContent
- title="You cannot transfer your workspace's primary domain. Set another domain as primary to transfer this domain."
- cta="Learn more."
- href="https://dub.co/help/article/how-to-set-primary-domain"
- />
- ),
- })}
- />
- <Button
- text={archived ? "Unarchive" : "Archive"}
- variant="outline"
- onClick={() => {
- setOpenPopover(false);
- setShowArchiveDomainModal(true);
- }}
- icon={<Archive className="h-4 w-4" />}
- className="h-9 justify-start px-2 font-medium"
- />
- <Button
- text="Delete"
- variant="danger-outline"
- onClick={() => {
- setOpenPopover(false);
- setShowDeleteDomainModal(true);
- }}
- icon={<Delete className="h-4 w-4" />}
- className="h-9 justify-start px-2 font-medium"
- />
- </div>
- </div>
- }
- align="end"
- openPopover={openPopover}
- setOpenPopover={setOpenPopover}
- >
- <Button
- variant="secondary"
- className="px-2"
- icon={<ThreeDots className="h-5 w-5" />}
- onClick={() => {
- setOpenPopover(!openPopover);
- }}
+ <motion.div
+ animate={{
+ width: groupHover && !isMobile ? "auto" : 38,
+ }}
+ className="flex items-center justify-end divide-x divide-transparent overflow-hidden rounded-md border border-gray-200 sm:group-hover:divide-gray-200"
+ >
+ <Tooltip content="Domain settings">
+ <Button
+ text={<PenWriting className={cn("h-4 w-4 shrink-0")} />}
+ variant="outline"
+ className="h-8 rounded-none border-0 px-3 text-gray-600"
+ onClick={() => setShowAddEditDomainModal(true)}
+ />
+ </Tooltip>
+ <Tooltip content="Refresh">
+ <Button
+ text={
+ <Refresh2
+ className={cn(
+ "h-4 w-4 shrink-0 -scale-100 transition-colors [animation-duration:0.25s]",
+ refreshProps.isValidating && "animate-spin text-gray-500",
+ )}
/>
- </Popover>
- </div>
- </div>
- <div className="flex h-10 flex-col space-y-2 sm:flex-row sm:items-center sm:space-x-5 sm:space-y-0">
- <div className="flex items-center space-x-2">
- {data ? (
- data.status === "Valid Configuration" ? (
- <CheckCircleFill className="h-6 w-6 text-blue-500" />
- ) : data.status === "Pending Verification" ? (
- <AlertCircleFill className="h-6 w-6 text-yellow-500" />
- ) : (
- <XCircleFill className="h-6 w-6 text-red-500" />
- )
- ) : (
- <LoadingCircle className="mr-1 h-5 w-5" />
- )}
- <p className="text-sm text-gray-500">
- {data ? data.status : "Checking Domain Status"}
- </p>
- </div>
- <div className="flex items-center space-x-2">
- {linkProps ? (
- linkProps.url ? (
- <CheckCircleFill className="h-6 w-6 text-blue-500" />
- ) : (
- <XCircleFill className="h-6 w-6 text-gray-400" />
- )
- ) : (
- <LoadingCircle className="mr-1 h-5 w-5" />
- )}
- <div className="flex space-x-1">
- <p className="text-sm text-gray-500">
- {linkProps
- ? linkProps.url
- ? `Redirects to`
- : `No redirect configured`
- : `Checking Link Status`}
- </p>
- {linkProps && (
- <a
- href={linkProps.url}
- target="_blank"
- rel="noreferrer"
- className="text-sm font-medium text-gray-600 underline-offset-4 hover:underline"
- >
- {truncate(
- linkProps.url.replace(/^(?:https?:\/\/)?(?:www\.)?/i, ""),
- 24,
- )}
- </a>
- )}
+ }
+ variant="outline"
+ className="h-8 rounded-none border-0 px-3 text-gray-600"
+ onClick={() => refreshProps.mutate()}
+ />
+ </Tooltip>
+ <Popover
+ content={
+ <div className="w-full sm:w-48">
+ <div className="grid gap-px p-2">
+ <Button
+ text="Refresh"
+ variant="outline"
+ onClick={() => {
+ setOpenPopover(false);
+ refreshProps.mutate();
+ }}
+ icon={<Refresh2 className="h-4 w-4" />}
+ className="h-9 justify-start px-2 font-medium sm:hidden"
+ />
+ <Button
+ text="Edit Link"
+ variant="outline"
+ onClick={() => {
+ setOpenPopover(false);
+ setShowAddEditLinkModal(true);
+ }}
+ icon={<Edit3 className="h-4 w-4" />}
+ className="h-9 justify-start px-2 font-medium"
+ />
+ <Button
+ text="QR Code"
+ variant="outline"
+ onClick={() => {
+ setOpenPopover(false);
+ setShowLinkQRModal(true);
+ }}
+ icon={<QrCode className="h-4 w-4" />}
+ className="h-9 justify-start px-2 font-medium"
+ />
+ <Button
+ text="Copy Link ID"
+ variant="outline"
+ onClick={() => copyLinkId()}
+ icon={
+ copiedLinkId ? (
+ <CheckCircleFill className="h-4 w-4" />
+ ) : (
+ <Copy className="h-4 w-4" />
+ )
+ }
+ className="h-9 justify-start px-2 font-medium"
+ />
+ </div>
+ <div className="border-t border-gray-200" />
+ <div className="grid gap-px p-2">
+ <Button
+ text="Settings"
+ variant="outline"
+ onClick={() => {
+ setOpenPopover(false);
+ setShowAddEditDomainModal(true);
+ }}
+ icon={<Gear className="h-4 w-4" />}
+ className="h-9 justify-start px-2 font-medium sm:hidden"
+ />
+ {!primary && (
+ <Button
+ text="Set as Primary"
+ variant="outline"
+ onClick={() => {
+ setOpenPopover(false);
+ setShowPrimaryDomainModal(true);
+ }}
+ icon={<FileCog className="h-4 w-4" />}
+ className="h-9 justify-start px-2 font-medium"
+ />
+ )}
+ <Button
+ text="Transfer"
+ variant="outline"
+ onClick={() => {
+ setOpenPopover(false);
+ setShowTransferDomainModal(true);
+ }}
+ icon={<FolderInput className="h-4 w-4" />}
+ className="h-9 justify-start px-2 font-medium"
+ {...(primary &&
+ activeDomainsCount > 1 && {
+ disabledTooltip: (
+ <SimpleTooltipContent
+ title="You cannot transfer your workspace's primary domain. Set another domain as primary to transfer this domain."
+ cta="Learn more."
+ href="https://dub.co/help/article/how-to-set-primary-domain"
+ />
+ ),
+ })}
+ />
+ <Button
+ text={archived ? "Unarchive" : "Archive"}
+ variant="outline"
+ onClick={() => {
+ setOpenPopover(false);
+ setShowArchiveDomainModal(true);
+ }}
+ icon={<Archive className="h-4 w-4" />}
+ className="h-9 justify-start px-2 font-medium"
+ />
+ <Button
+ text="Delete"
+ variant="danger-outline"
+ onClick={() => {
+ setOpenPopover(false);
+ setShowDeleteDomainModal(true);
+ }}
+ icon={<Delete className="h-4 w-4" />}
+ className="h-9 justify-start px-2 font-medium"
+ />
+ </div>
</div>
- </div>
- </div>
- {data && data.status !== "Valid Configuration" && (
- <DomainConfiguration data={data} />
- )}
- </div>
+ }
+ align="end"
+ openPopover={openPopover}
+ setOpenPopover={setOpenPopover}
+ >
+ <Button
+ variant="outline"
+ className="h-8 rounded-none border-0 px-2 transition-[border-color] duration-200"
+ icon={<ThreeDots className="h-5 w-5 shrink-0" />}
+ onClick={() => {
+ setOpenPopover(!openPopover);
+ }}
+ />
+ </Popover>
+ </motion.div>
</>
);
}
diff --git a/apps/web/ui/domains/domain-configuration.tsx b/apps/web/ui/domains/domain-configuration.tsx
index 75cf50b077..c4269aeee6 100644
--- a/apps/web/ui/domains/domain-configuration.tsx
+++ b/apps/web/ui/domains/domain-configuration.tsx
@@ -1,7 +1,7 @@
import { DomainVerificationStatusProps } from "@/lib/types";
-import { CopyButton } from "@dub/ui";
-import { getSubdomain } from "@dub/utils";
-import { useState } from "react";
+import { CircleInfo, CopyButton, TabSelect } from "@dub/ui";
+import { cn, getSubdomain } from "@dub/utils";
+import { Fragment, useState } from "react";
export default function DomainConfiguration({
data,
@@ -65,7 +65,7 @@ export default function DomainConfiguration({
)}
/>
<DnsRecord
- instructions="Afterwards, set the following record on your DNS provider to continue:"
+ instructions="Afterwards, set the following record on your DNS provider:"
records={[
{
type: recordType,
@@ -88,28 +88,19 @@ export default function DomainConfiguration({
}
return (
- <div className="border-t border-gray-200 pt-5">
- <div className="flex justify-start space-x-4">
- <button
- onClick={() => setRecordType("A")}
- className={`${
- recordType == "A"
- ? "border-black text-black"
- : "border-white text-gray-400"
- } ease border-b-2 pb-1 text-sm transition-all duration-150`}
- >
- A Record{!subdomain && " (recommended)"}
- </button>
- <button
- onClick={() => setRecordType("CNAME")}
- className={`${
- recordType == "CNAME"
- ? "border-black text-black"
- : "border-white text-gray-400"
- } ease border-b-2 pb-1 text-sm transition-all duration-150`}
- >
- CNAME Record{subdomain && " (recommended)"}
- </button>
+ <div className="pt-2">
+ <div className="-ml-1.5 border-b border-gray-200">
+ <TabSelect
+ options={[
+ { id: "A", label: `A Record${!subdomain ? " (recommended)" : ""}` },
+ {
+ id: "CNAME",
+ label: `CNAME Record${subdomain ? " (recommended)" : ""}`,
+ },
+ ]}
+ selected={recordType}
+ onSelect={setRecordType}
+ />
</div>
<DnsRecord
@@ -117,8 +108,7 @@ export default function DomainConfiguration({
recordType === "A" ? "apex domain" : "subdomain"
} <code>${
recordType === "A" ? domainJson.apexName : domainJson.name
- }</code>, set the following ${recordType} record on your DNS provider to
- continue:`}
+ }</code>, set the following ${recordType} record on your DNS provider:`}
records={[
{
type: recordType,
@@ -135,7 +125,7 @@ export default function DomainConfiguration({
const MarkdownText = ({ text }: { text: string }) => {
return (
<p
- className="prose-sm prose-code:rounded-md prose-code:bg-blue-100 prose-code:p-1 prose-code:text-[14px] prose-code:font-medium prose-code:font-mono prose-code:text-blue-900 my-5 max-w-none"
+ className="prose-sm prose-code:rounded-md prose-code:bg-gray-100 prose-code:p-1 prose-code:text-[.8125rem] prose-code:font-medium prose-code:font-mono prose-code:text-gray-900 max-w-none"
dangerouslySetInnerHTML={{ __html: text }}
/>
);
@@ -151,52 +141,60 @@ const DnsRecord = ({
warning?: string;
}) => {
const hasTtl = records.some((x) => x.ttl);
+
return (
- <div className="my-3 text-left">
- <MarkdownText text={instructions} />
- <div className="flex items-center justify-start space-x-10 rounded-md bg-gray-50 p-2">
- <div>
- <p className="text-sm font-bold">Type</p>
- {records.map((record) => (
- <p key={record.type} className="mt-2 font-mono text-sm">
+ <div className="mt-3 text-left text-gray-600">
+ <div className="my-5">
+ <MarkdownText text={instructions} />
+ </div>
+ <div
+ className={cn(
+ "grid items-end gap-x-10 gap-y-1 rounded-lg bg-gray-100/80 p-4 text-sm",
+ hasTtl
+ ? "grid-cols-[repeat(4,min-content)]"
+ : "grid-cols-[repeat(3,min-content)]",
+ )}
+ >
+ {["Type", "Name", "Value", "TTL"].map((s) => (
+ <p key={s} className="font-medium text-gray-950">
+ {s}
+ </p>
+ ))}
+
+ {records.map((record, idx) => (
+ <Fragment key={idx}>
+ <p key={record.type} className="font-mono">
{record.type}
</p>
- ))}
- </div>
- <div>
- <p className="text-sm font-bold">Name</p>
- {records.map((record) => (
- <p key={record.name} className="mt-2 font-mono text-sm">
+ <p key={record.name} className="font-mono">
{record.name}
</p>
- ))}
- </div>
- <div>
- <p className="text-sm font-bold">Value</p>
- {records.map((record) => (
- <p key={record.value} className="mt-2 font-mono text-sm">
- {record.value} <CopyButton value={record.value} />
+ <p key={record.value} className="flex items-end gap-1 font-mono">
+ {record.value}{" "}
+ <CopyButton
+ variant="neutral"
+ className="-mb-0.5"
+ value={record.value}
+ />
</p>
- ))}
- </div>
- {hasTtl && (
- <div>
- <p className="text-sm font-bold">TTL</p>
- {records.map((record) => (
- <p key={record.ttl} className="mt-2 font-mono text-sm">
+ {hasTtl && (
+ <p key={record.ttl} className="font-mono">
{record.ttl}
</p>
- ))}
- </div>
- )}
+ )}
+ </Fragment>
+ ))}
</div>
{(warning || hasTtl) && (
- <MarkdownText
- text={
- warning ||
- "Note: for TTL, if <code>86400</code> is not available, set the highest value possible. Also, domain propagation can take anywhere between 1 hour to 12 hours."
- }
- />
+ <div className="mt-4 flex items-center gap-2 rounded-lg bg-indigo-50 p-3 text-indigo-600">
+ <CircleInfo className="h-5 w-5 shrink-0" />
+ <MarkdownText
+ text={
+ warning ||
+ "If a TTL value of 86400 is not available, choose the highest available value. Domain propagation may take up to 12 hours."
+ }
+ />
+ </div>
)}
</div>
);
diff --git a/apps/web/ui/layout/settings-layout.tsx b/apps/web/ui/layout/settings-layout.tsx
index 06338d85c7..30a2f0b111 100644
--- a/apps/web/ui/layout/settings-layout.tsx
+++ b/apps/web/ui/layout/settings-layout.tsx
@@ -20,7 +20,10 @@ export default function SettingsLayout({
<div className="relative min-h-[calc(100vh-16px)] bg-white">
<MaxWidthWrapper className="grid items-start gap-8 py-10 lg:grid-cols-5">
<div
- className={cn("flex gap-1 lg:sticky lg:grid", tabContainerClassName)}
+ className={cn(
+ "flex flex-wrap gap-1 lg:sticky lg:grid",
+ tabContainerClassName,
+ )}
>
{tabs.map(({ name, segment, icon }) => (
<NavLink segment={segment} icon={icon}>
diff --git a/apps/web/ui/layout/settings-nav-link.tsx b/apps/web/ui/layout/settings-nav-link.tsx
index 5d29f06ab1..85d640fd5e 100644
--- a/apps/web/ui/layout/settings-nav-link.tsx
+++ b/apps/web/ui/layout/settings-nav-link.tsx
@@ -31,7 +31,7 @@ export default function NavLink({
key={href}
href={href}
className={cn(
- "flex items-center gap-2.5 rounded-lg p-2 text-sm text-gray-950 outline-none transition-all duration-75",
+ "flex items-center gap-2.5 whitespace-nowrap rounded-lg p-2 text-sm text-gray-950 outline-none transition-all duration-75",
"ring-black/50 focus-visible:ring-2",
isSelected
? "bg-gray-950/5"
@@ -41,7 +41,7 @@ export default function NavLink({
{Icon && (
<Icon
className={cn(
- "h-4 w-4",
+ "h-4 w-4 shrink-0",
isSelected ? "text-gray-950" : "text-gray-700",
)}
/>
diff --git a/apps/web/ui/workspaces/workspace-card.tsx b/apps/web/ui/workspaces/workspace-card.tsx
index f32f9b6d84..d32680aced 100644
--- a/apps/web/ui/workspaces/workspace-card.tsx
+++ b/apps/web/ui/workspaces/workspace-card.tsx
@@ -7,6 +7,7 @@ import { CheckCircleFill, XCircleFill } from "@/ui/shared/icons";
import {
Badge,
BlurImage,
+ Globe2,
InlineSnippet,
NumberTooltip,
Tooltip,
@@ -18,13 +19,7 @@ import {
nFormatter,
punycode,
} from "@dub/utils";
-import {
- BarChart2,
- ExternalLink,
- Globe,
- Link2,
- MinusCircle,
-} from "lucide-react";
+import { BarChart2, ExternalLink, Link2, MinusCircle } from "lucide-react";
import Link from "next/link";
import useSWR from "swr";
import PlanBadge from "./plan-badge";
@@ -156,7 +151,7 @@ export default function WorkspaceCard({
</div>
<div className="flex items-center space-x-4">
<div className="flex items-center space-x-1 text-gray-500">
- <Globe className="h-4 w-4" />
+ <Globe2 className="h-4 w-4" />
{loading ? (
<div className="h-4 w-16 animate-pulse rounded-md bg-gray-200" />
) : (
diff --git a/packages/tailwind-config/tailwind.config.ts b/packages/tailwind-config/tailwind.config.ts
index df594f1266..eed761e0ce 100644
--- a/packages/tailwind-config/tailwind.config.ts
+++ b/packages/tailwind-config/tailwind.config.ts
@@ -53,6 +53,8 @@ const config: Config = {
spinner: "spinner 1.2s linear infinite",
// Custom blink animation (for loading-dots)
blink: "blink 1.4s infinite both",
+ // Custom pulse animation
+ pulse: "pulse 1s linear infinite alternate",
},
keyframes: {
// Modal
@@ -148,6 +150,15 @@ const config: Config = {
opacity: "0.2",
},
},
+ // Custom pulse animation
+ pulse: {
+ from: {
+ opacity: "0",
+ },
+ to: {
+ opacity: "1",
+ },
+ },
},
colors: {
brown: {
diff --git a/packages/ui/src/copy-button.tsx b/packages/ui/src/copy-button.tsx
index 023db65949..99f10c93e7 100644
--- a/packages/ui/src/copy-button.tsx
+++ b/packages/ui/src/copy-button.tsx
@@ -1,12 +1,30 @@
"use client";
import { cn } from "@dub/utils";
+import { VariantProps, cva } from "class-variance-authority";
import { LucideIcon } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import { Copy, Tick } from "./icons";
+const copyButtonVariants = cva(
+ "group rounded-full p-1.5 transition-all duration-75",
+ {
+ variants: {
+ variant: {
+ default:
+ "bg-gray-100 hover:scale-105 hover:bg-blue-100 active:scale-95 text-gray-700 hover:text-blue-800",
+ neutral: "bg-transparent hover:bg-gray-200 active:bg-gray-300",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ },
+);
+
export function CopyButton({
+ variant = "default",
value,
className,
icon,
@@ -14,7 +32,7 @@ export function CopyButton({
value: string;
className?: string;
icon?: LucideIcon;
-}) {
+} & VariantProps<typeof copyButtonVariants>) {
const [copied, setCopied] = useState(false);
const Comp = icon || Copy;
return (
@@ -27,16 +45,13 @@ export function CopyButton({
});
setTimeout(() => setCopied(false), 3000);
}}
- className={cn(
- "group rounded-full bg-gray-100 p-1.5 transition-all duration-75 hover:scale-105 hover:bg-blue-100 active:scale-95",
- className,
- )}
+ className={cn(copyButtonVariants({ variant }), className)}
>
<span className="sr-only">Copy</span>
{copied ? (
- <Tick className="text-gray-700 transition-all group-hover:text-blue-800" />
+ <Tick className="h-3.5 w-3.5" />
) : (
- <Comp className="text-gray-700 transition-all group-hover:text-blue-800" />
+ <Comp className="h-3.5 w-3.5" />
)}
</button>
);
diff --git a/packages/ui/src/icons/nucleo/arrow-turn-right2.tsx b/packages/ui/src/icons/nucleo/arrow-turn-right2.tsx
new file mode 100644
index 0000000000..0b43350550
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/arrow-turn-right2.tsx
@@ -0,0 +1,26 @@
+import { SVGProps } from "react";
+
+export function ArrowTurnRight2(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" {...props}>
+ <g fill="currentColor">
+ <path
+ d="M15.25,9.75H4.75c-1.105,0-2-.895-2-2V3.75"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <polyline
+ fill="none"
+ points="11 5.5 15.25 9.75 11 14"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/circle-check.tsx b/packages/ui/src/icons/nucleo/circle-check.tsx
new file mode 100644
index 0000000000..c54bd51776
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/circle-check.tsx
@@ -0,0 +1,34 @@
+import { SVGProps } from "react";
+
+export function CircleCheck(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <circle
+ cx="9"
+ cy="9"
+ fill="none"
+ r="7.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <polyline
+ fill="none"
+ points="5.75 9.25 8 11.75 12.25 6.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/circle-half-dotted-clock.tsx b/packages/ui/src/icons/nucleo/circle-half-dotted-clock.tsx
new file mode 100644
index 0000000000..83c69acee2
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/circle-half-dotted-clock.tsx
@@ -0,0 +1,75 @@
+import { SVGProps } from "react";
+
+export function CircleHalfDottedClock(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <polyline
+ fill="none"
+ points="9 4.75 9 9 12.25 11.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M9,1.75c4.004,0,7.25,3.246,7.25,7.25s-3.246,7.25-7.25,7.25"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <circle
+ cx="3.873"
+ cy="14.127"
+ fill="currentColor"
+ r=".75"
+ stroke="none"
+ />
+ <circle cx="1.75" cy="9" fill="currentColor" r=".75" stroke="none" />
+ <circle
+ cx="3.873"
+ cy="3.873"
+ fill="currentColor"
+ r=".75"
+ stroke="none"
+ />
+ <circle
+ cx="6.226"
+ cy="15.698"
+ fill="currentColor"
+ r=".75"
+ stroke="none"
+ />
+ <circle
+ cx="2.302"
+ cy="11.774"
+ fill="currentColor"
+ r=".75"
+ stroke="none"
+ />
+ <circle
+ cx="2.302"
+ cy="6.226"
+ fill="currentColor"
+ r=".75"
+ stroke="none"
+ />
+ <circle
+ cx="6.226"
+ cy="2.302"
+ fill="currentColor"
+ r=".75"
+ stroke="none"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/circle-info.tsx b/packages/ui/src/icons/nucleo/circle-info.tsx
new file mode 100644
index 0000000000..bf732cf986
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/circle-info.tsx
@@ -0,0 +1,42 @@
+import { SVGProps } from "react";
+
+export function CircleInfo(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <circle
+ cx="9"
+ cy="9"
+ fill="none"
+ r="7.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="9"
+ x2="9"
+ y1="12.819"
+ y2="8.25"
+ />
+ <path
+ d="M9,6.75c-.552,0-1-.449-1-1s.448-1,1-1,1,.449,1,1-.448,1-1,1Z"
+ fill="currentColor"
+ stroke="none"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/circle-warning.tsx b/packages/ui/src/icons/nucleo/circle-warning.tsx
new file mode 100644
index 0000000000..1f256a95e9
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/circle-warning.tsx
@@ -0,0 +1,42 @@
+import { SVGProps } from "react";
+
+export function CircleWarning(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <circle
+ cx="9"
+ cy="9"
+ fill="none"
+ r="7.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="9"
+ x2="9"
+ y1="5.431"
+ y2="9.569"
+ />
+ <path
+ d="M9,13.417c-.552,0-1-.449-1-1s.448-1,1-1,1,.449,1,1-.448,1-1,1Z"
+ fill="currentColor"
+ stroke="none"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/flag2.tsx b/packages/ui/src/icons/nucleo/flag2.tsx
new file mode 100644
index 0000000000..ff75142e12
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/flag2.tsx
@@ -0,0 +1,29 @@
+import { SVGProps } from "react";
+
+export function Flag2(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" {...props}>
+ <g fill="currentColor">
+ <path
+ d="M3.75,3.25H13.25c.552,0,1,.448,1,1v5c0,.552-.448,1-1,1H3.75"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="3.75"
+ x2="3.75"
+ y1="1.75"
+ y2="16.25"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/globe.tsx b/packages/ui/src/icons/nucleo/globe.tsx
index c8f4cb0218..6dbb3db6ca 100644
--- a/packages/ui/src/icons/nucleo/globe.tsx
+++ b/packages/ui/src/icons/nucleo/globe.tsx
@@ -10,13 +10,37 @@ export function Globe(props: SVGProps<SVGSVGElement>) {
{...props}
>
<g fill="currentColor">
- <path
- d="M16.25,8.25h-3.517c-.157-3.641-1.454-7.25-3.733-7.25s-3.576,3.609-3.733,7.25H1.75v1.5h3.517c.157,3.641,1.454,7.25,3.733,7.25s3.576-3.609,3.733-7.25h3.517v-1.5ZM9,2.5c.858,0,2.079,2.216,2.233,5.75H6.767c.154-3.534,1.375-5.75,2.233-5.75Zm0,13c-.858,0-2.079-2.216-2.233-5.75h4.467c-.154,3.534-1.375,5.75-2.233,5.75Z"
- fill="currentColor"
+ <ellipse
+ cx="9"
+ cy="9"
+ fill="none"
+ rx="7.25"
+ ry="3"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
- <path
- d="M9,17c-4.411,0-8-3.589-8-8S4.589,1,9,1s8,3.589,8,8-3.589,8-8,8Zm0-14.5c-3.584,0-6.5,2.916-6.5,6.5s2.916,6.5,6.5,6.5,6.5-2.916,6.5-6.5-2.916-6.5-6.5-6.5Z"
- fill="currentColor"
+ <ellipse
+ cx="9"
+ cy="9"
+ fill="none"
+ rx="3"
+ ry="7.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <circle
+ cx="9"
+ cy="9"
+ fill="none"
+ r="7.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
/>
</g>
</svg>
diff --git a/packages/ui/src/icons/nucleo/globe2.tsx b/packages/ui/src/icons/nucleo/globe2.tsx
new file mode 100644
index 0000000000..db9482b2e8
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/globe2.tsx
@@ -0,0 +1,24 @@
+import { SVGProps } from "react";
+
+export function Globe2(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <path
+ d="M16.25,8.25h-3.517c-.157-3.641-1.454-7.25-3.733-7.25s-3.576,3.609-3.733,7.25H1.75v1.5h3.517c.157,3.641,1.454,7.25,3.733,7.25s3.576-3.609,3.733-7.25h3.517v-1.5ZM9,2.5c.858,0,2.079,2.216,2.233,5.75H6.767c.154-3.534,1.375-5.75,2.233-5.75Zm0,13c-.858,0-2.079-2.216-2.233-5.75h4.467c-.154,3.534-1.375,5.75-2.233,5.75Z"
+ fill="currentColor"
+ />
+ <path
+ d="M9,17c-4.411,0-8-3.589-8-8S4.589,1,9,1s8,3.589,8,8-3.589,8-8,8Zm0-14.5c-3.584,0-6.5,2.916-6.5,6.5s2.916,6.5,6.5,6.5,6.5-2.916,6.5-6.5-2.916-6.5-6.5-6.5Z"
+ fill="currentColor"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 308d27f24a..6f4b920f46 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -1,7 +1,12 @@
+export * from "./arrow-turn-right2";
export * from "./blog";
export * from "./book2";
export * from "./bullet-list";
export * from "./chart-line";
+export * from "./circle-check";
+export * from "./circle-half-dotted-clock";
+export * from "./circle-info";
+export * from "./circle-warning";
export * from "./code";
export * from "./crosshairs";
export * from "./cube";
@@ -10,21 +15,26 @@ export * from "./desktop";
export * from "./download";
export * from "./filter-bars";
export * from "./flag-wavy";
+export * from "./flag2";
export * from "./gaming-console";
export * from "./gear";
export * from "./gear2";
export * from "./globe";
+export * from "./globe2";
export * from "./headset";
export * from "./hexadecagon-star";
export * from "./hyperlink";
export * from "./invoice-dollar";
export * from "./key";
+export * from "./lines-y";
export * from "./mobile-phone";
export * from "./office-building";
export * from "./paintbrush";
+export * from "./pen-writing";
export * from "./qrcode";
export * from "./receipt2";
export * from "./referred-via";
+export * from "./refresh2";
export * from "./shield-check";
export * from "./sliders";
export * from "./stars2";
diff --git a/packages/ui/src/icons/nucleo/lines-y.tsx b/packages/ui/src/icons/nucleo/lines-y.tsx
new file mode 100644
index 0000000000..c4ce473850
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/lines-y.tsx
@@ -0,0 +1,60 @@
+import { SVGProps } from "react";
+
+export function LinesY(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="2.75"
+ x2="2.75"
+ y1="2.75"
+ y2="15.25"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="15.25"
+ x2="15.25"
+ y1="4.75"
+ y2="15.25"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="7"
+ x2="7"
+ y1="7.75"
+ y2="15.25"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="11"
+ x2="11"
+ y1="11.75"
+ y2="15.25"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/pen-writing.tsx b/packages/ui/src/icons/nucleo/pen-writing.tsx
new file mode 100644
index 0000000000..4e285c2f12
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/pen-writing.tsx
@@ -0,0 +1,35 @@
+import { SVGProps } from "react";
+
+export function PenWriting(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <path
+ d="M2.75,15.25s3.599-.568,4.546-1.515,7.327-7.327,7.327-7.327c.837-.837,.837-2.194,0-3.03-.837-.837-2.194-.837-3.03,0,0,0-6.38,6.38-7.327,7.327-.947,.947-1.515,4.546-1.515,4.546h0Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="9"
+ x2="15.25"
+ y1="15.25"
+ y2="15.25"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/refresh2.tsx b/packages/ui/src/icons/nucleo/refresh2.tsx
new file mode 100644
index 0000000000..3afc81a98d
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/refresh2.tsx
@@ -0,0 +1,48 @@
+import { SVGProps } from "react";
+
+export function Refresh2(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <polyline
+ fill="none"
+ points="8.5 12.75 10.75 15 8.5 17.25"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <polyline
+ fill="none"
+ points="9.5 5.25 7.25 3 9.5 .75"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M4.952,4.238c-1.347,1.146-2.202,2.855-2.202,4.762,0,3.452,2.798,6.25,6.25,6.25,.579,0,1.14-.079,1.672-.226"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M13.048,13.762c1.347-1.146,2.202-2.855,2.202-4.762,0-3.452-2.798-6.25-6.25-6.25-.597,0-1.175,.084-1.722,.24"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx
index 265c82032f..00e5f797ea 100644
--- a/packages/ui/src/index.tsx
+++ b/packages/ui/src/index.tsx
@@ -17,6 +17,7 @@ export * from "./label";
export * from "./modal";
export * from "./popover";
export * from "./radio-group";
+export * from "./status-badge";
export * from "./switch";
export * from "./tooltip";
diff --git a/packages/ui/src/link-logo.tsx b/packages/ui/src/link-logo.tsx
index 2d1562c1d6..ec5e6511a3 100644
--- a/packages/ui/src/link-logo.tsx
+++ b/packages/ui/src/link-logo.tsx
@@ -1,6 +1,6 @@
import { GOOGLE_FAVICON_URL, cn } from "@dub/utils";
-import { Globe } from "lucide-react";
import { BlurImage } from "./blur-image";
+import { Globe2 } from "./icons";
export function LinkLogo({
apexDomain,
@@ -24,7 +24,7 @@ export function LinkLogo({
className,
)}
>
- <Globe className="h-4 w-4 text-gray-600 sm:h-5 sm:w-5" />
+ <Globe2 className="h-4 w-4 text-gray-600 sm:h-5 sm:w-5" />
</div>
);
}
diff --git a/packages/ui/src/status-badge.tsx b/packages/ui/src/status-badge.tsx
new file mode 100644
index 0000000000..91d9bbf35f
--- /dev/null
+++ b/packages/ui/src/status-badge.tsx
@@ -0,0 +1,61 @@
+import { cn } from "@dub/utils";
+import { cva, type VariantProps } from "class-variance-authority";
+import {
+ CircleCheck,
+ CircleHalfDottedClock,
+ CircleInfo,
+ CircleWarning,
+ Icon,
+} from "./icons";
+
+const statusBadgeVariants = cva(
+ "flex gap-1.5 items-center max-w-fit rounded-md px-2 py-1 text-xs font-medium whitespace-nowrap",
+ {
+ variants: {
+ variant: {
+ neutral: "bg-gray-500/[.15] text-gray-600",
+ success: "bg-green-500/[.15] text-green-600",
+ pending: "bg-orange-500/[.15] text-orange-600",
+ error: "bg-red-500/[.15] text-red-600",
+ },
+ },
+ defaultVariants: {
+ variant: "neutral",
+ },
+ },
+);
+
+const defaultIcons = {
+ neutral: CircleInfo,
+ success: CircleCheck,
+ pending: CircleHalfDottedClock,
+ error: CircleWarning,
+};
+
+interface BadgeProps
+ extends React.HTMLAttributes<HTMLSpanElement>,
+ VariantProps<typeof statusBadgeVariants> {
+ icon?: Icon;
+}
+
+function StatusBadge({
+ className,
+ variant,
+ icon,
+ children,
+ ...props
+}: BadgeProps) {
+ const Icon =
+ icon !== null ? icon ?? defaultIcons[variant ?? "neutral"] : null;
+ return (
+ <span
+ className={cn(statusBadgeVariants({ variant }), className)}
+ {...props}
+ >
+ {Icon && <Icon className="h-3 w-3 shrink-0" />}
+ {children}
+ </span>
+ );
+}
+
+export { StatusBadge, statusBadgeVariants };