The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
remove /workspaces
Steven Teyd4ede51abe27
diff --git a/apps/web/app/app.dub.co/(dashboard)/workspaces/page.tsx b/apps/web/app/app.dub.co/(dashboard)/workspaces/page.tsxdeleted file mode 100644index 9d00d66d4b..0000000000--- a/apps/web/app/app.dub.co/(dashboard)/workspaces/page.tsx+++ /dev/null@@ -1,23 +0,0 @@-import CreateWorkspaceButton from "@/ui/workspaces/create-workspace-button";-import WorkspaceList from "@/ui/workspaces/workspace-list";-import { MaxWidthWrapper } from "@dub/ui";--export default function Workspaces() {- return (- <>- <div className="flex h-36 items-center border-b border-gray-200 bg-white">- <MaxWidthWrapper>- <div className="flex items-center justify-between">- <h1 className="truncate text-2xl text-gray-600">My Workspaces</h1>- <CreateWorkspaceButton />- </div>- </MaxWidthWrapper>- </div>- <MaxWidthWrapper>- <div className="my-10 grid grid-cols-1 gap-5 lg:grid-cols-2 xl:grid-cols-3">- <WorkspaceList />- </div>- </MaxWidthWrapper>- </>- );-}diff --git a/apps/web/lib/middleware/app.ts b/apps/web/lib/middleware/app.tsindex 9b8daa6330..5d00eeebbb 100644--- a/apps/web/lib/middleware/app.ts+++ b/apps/web/lib/middleware/app.ts@@ -73,6 +73,7 @@ export default async function AppMiddleware(req: NextRequest) {"/","/login","/register",+ "/workspaces","/analytics","/events","/settings",diff --git a/apps/web/lib/middleware/workspaces.ts b/apps/web/lib/middleware/workspaces.tsindex 705a479e97..1814279c8c 100644--- a/apps/web/lib/middleware/workspaces.ts+++ b/apps/web/lib/middleware/workspaces.ts@@ -4,8 +4,6 @@ import { parse } from "./utils";import { getDefaultWorkspace } from "./utils/get-default-workspace";import { isTopLevelSettingsRedirect } from "./utils/is-top-level-settings-redirect";-const topLevelSettingRedirects = ["/integrations", "/webhooks", "/domains"];-export default async function WorkspacesMiddleware(req: NextRequest,user: UserProps,@@ -16,7 +14,7 @@ export default async function WorkspacesMiddleware(if (defaultWorkspace) {let redirectPath = path;- if (["/", "/login", "/register"].includes(path)) {+ if (["/", "/login", "/register", "/workspaces"].includes(path)) {redirectPath = "";} else if (isTopLevelSettingsRedirect(path)) {redirectPath = `/settings/${path}`;@@ -28,6 +26,6 @@ export default async function WorkspacesMiddleware(),);} else {- return NextResponse.redirect(new URL("/workspaces", req.url));+ return NextResponse.redirect(new URL("/onboarding/workspace", req.url));}}diff --git a/apps/web/ui/workspaces/workspace-card-placeholder.tsx b/apps/web/ui/workspaces/workspace-card-placeholder.tsxdeleted file mode 100644index 91ad8ce82d..0000000000--- a/apps/web/ui/workspaces/workspace-card-placeholder.tsx+++ /dev/null@@ -1,21 +0,0 @@-export default function WorkspaceCardPlaceholder() {- return (- <div className="flex flex-col space-y-[46px] rounded-lg border border-gray-100 bg-white p-6 shadow transition-all hover:shadow-md">- <div className="flex items-center space-x-3">- <div className="h-12 w-12 animate-pulse rounded-full bg-gray-200" />- <div className="flex flex-col space-y-2.5">- <div className="h-5 w-36 animate-pulse rounded-md bg-gray-200" />- <div className="flex items-center space-x-2">- <div className="h-5 w-20 animate-pulse rounded-md bg-gray-200" />- <div className="h-5 w-5 animate-pulse rounded-full bg-gray-200" />- </div>- </div>- </div>- <div className="flex items-center justify-between space-x-4">- <div className="h-4 w-24 animate-pulse rounded-md bg-gray-200" />- <div className="h-4 w-24 animate-pulse rounded-md bg-gray-200" />- <div className="h-4 w-24 animate-pulse rounded-md bg-gray-200" />- </div>- </div>- );-}diff --git a/apps/web/ui/workspaces/workspace-card.tsx b/apps/web/ui/workspaces/workspace-card.tsxdeleted file mode 100644index 214b7b2ebf..0000000000--- a/apps/web/ui/workspaces/workspace-card.tsx+++ /dev/null@@ -1,197 +0,0 @@-"use client";--import { WorkspaceProps } from "@/lib/types";-import { CheckCircleFill, XCircleFill } from "@/ui/shared/icons";-import { Badge, BlurImage, Globe2, NumberTooltip, Tooltip } from "@dub/ui";-import { DICEBEAR_AVATAR_URL, fetcher, nFormatter, punycode } from "@dub/utils";-import { BarChart2, ExternalLink, Link2, MinusCircle } from "lucide-react";-import Link from "next/link";-import useSWR from "swr";-import PlanBadge from "./plan-badge";--export default function WorkspaceCard({- id,- name,- slug,- logo,- usage,- plan,- domains,-}: WorkspaceProps) {- const { data: count } = useSWR<number>(- `/api/links/count?workspaceId=${id}`,- fetcher,- );-- return (- <Link- key={slug}- href={`/${slug}`}- className="relative flex flex-col justify-between space-y-10 rounded-lg border border-gray-100 bg-white p-6 shadow transition-all hover:shadow-lg"- >- <div className="flex items-start justify-between">- <div className="flex items-center space-x-3">- <BlurImage- src={logo || `${DICEBEAR_AVATAR_URL}${name}`}- alt={id}- className="h-10 w-10 flex-shrink-0 overflow-hidden rounded-full"- width={48}- height={48}- />- <div>- <h2 className="max-w-[200px] truncate text-lg font-medium text-gray-700">- {name}- </h2>- {!domains ? (- <div className="mt-1 flex items-center space-x-2">- <div className="h-5 w-20 animate-pulse rounded-md bg-gray-200" />- <div className="h-5 w-5 animate-pulse rounded-full bg-gray-200" />- </div>- ) : (- <div className="flex items-center">- <p className="max-w-[160px] truncate text-gray-500">- {domains.length > 0- ? domains.find((d) => d.primary)?.slug || domains[0].slug- : "dub.sh"}- </p>- <Tooltip- content={- <DomainsTooltip- domains={domains}- title={- domains.length === 0- ? "No custom domains added yet – currently using Dub default domains."- : "Here are all the domains for this workspace."- }- cta={- domains.length === 0- ? "Add Domain"- : `Manage Domain${domains.length > 1 ? "s" : ""}`- }- href={`/${slug}/settings/domains`}- />- }- >- <div className="ml-1 flex items-center">- {domains.length > 1 ? (- <Badge- variant="gray"- className="border-gray-300 transition-all hover:bg-gray-200"- >- +{domains.length - 1}- </Badge>- ) : domains.length === 0 ? (- <MinusCircle- fill="rgb(209 213 219)"- className="h-5 w-5 text-white"- />- ) : (- <CheckCircleFill className="h-5 w-5 text-blue-500" />- )}- </div>- </Tooltip>- </div>- )}- </div>- </div>- <PlanBadge plan={plan} />- </div>- <div className="flex items-center space-x-4">- <div className="flex items-center space-x-1 text-gray-500">- <Globe2 className="h-4 w-4" />- {!domains ? (- <div className="h-4 w-16 animate-pulse rounded-md bg-gray-200" />- ) : (- <h2 className="whitespace-nowrap text-sm">- {nFormatter(domains.length)} domain{domains.length != 1 && "s"}- </h2>- )}- </div>- <div className="flex items-center space-x-1 text-gray-500">- <Link2 className="h-4 w-4" />- {count || count === 0 ? (- <NumberTooltip value={count} unit="links">- <h2 className="whitespace-nowrap text-sm">- {nFormatter(count)} link{count != 1 && "s"}- </h2>- </NumberTooltip>- ) : (- <div className="h-4 w-16 animate-pulse rounded-md bg-gray-200" />- )}- </div>- <div className="flex items-center space-x-1 text-gray-500">- <BarChart2 className="h-4 w-4" />- <NumberTooltip value={usage}>- <h2 className="whitespace-nowrap text-sm">- {nFormatter(usage)} click{usage != 1 && "s"}- </h2>- </NumberTooltip>- </div>- </div>- </Link>- );-}--const DomainsTooltip = ({- domains,- title,- cta,- href,-}: {- domains: { slug: string; verified: boolean }[];- title: string;- cta?: string;- href: string;-}) => {- return (- <div- className="flex w-full flex-col items-center space-y-2 p-4 md:w-60"- onClick={(e) => e.stopPropagation()}- >- <p className="px-2 text-sm text-gray-500">{title}</p>- <div className="flex w-full flex-col">- {domains.slice(0, 8).map(({ slug, verified }) => (- <a- key={slug}- href={`https://${slug}`}- target="_blank"- rel="noopener noreferrer"- className="group flex items-center justify-between rounded-md p-2 transition-all hover:bg-gray-100"- >- <div className="flex items-center space-x-1">- {verified ? (- <CheckCircleFill className="h-5 w-5 text-blue-500" />- ) : (- <XCircleFill className="h-5 w-5 text-gray-300" />- )}- <p className="text-sm font-semibold text-gray-500">- {punycode(slug)}- </p>- </div>- <ExternalLink className="h-4 w-4 text-gray-500 md:invisible md:group-hover:visible" />- </a>- ))}- {domains.length > 8 && (- <Link- href={href}- className="flex items-center space-x-1 rounded-md p-2 transition-all hover:bg-gray-100"- >- <p className="text-sm font-semibold text-gray-500">- +{domains.length - 8} more- </p>- <ExternalLink className="h-4 w-4 text-gray-500 md:invisible" />- </Link>- )}- </div>-- <div className="mt-2 w-full px-2">- <Link- href={href}- className="block rounded-md border border-black bg-black px-3 py-1.5 text-center text-sm text-white transition-all hover:bg-white hover:text-black"- >- {cta}- </Link>- </div>- </div>- );-};diff --git a/apps/web/ui/workspaces/workspace-list.tsx b/apps/web/ui/workspaces/workspace-list.tsxdeleted file mode 100644index 73f55af961..0000000000--- a/apps/web/ui/workspaces/workspace-list.tsx+++ /dev/null@@ -1,22 +0,0 @@-"use client";--import useWorkspaces from "@/lib/swr/use-workspaces";-import NoWorkspacesPlaceholder from "@/ui/workspaces/no-workspaces-placeholder";-import WorkspaceCard from "@/ui/workspaces/workspace-card";-import WorkspaceCardPlaceholder from "./workspace-card-placeholder";--export default function WorkspaceList() {- const { workspaces, loading } = useWorkspaces();-- if (loading) {- return Array.from({ length: 6 }).map((_, i) => (- <WorkspaceCardPlaceholder key={i} />- ));- }-- if (!workspaces || workspaces.length === 0) {- return <NoWorkspacesPlaceholder />;- }-- return workspaces.map((d) => <WorkspaceCard key={d.slug} {...d} />);-}