The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
show badge
Steven Tey859c5520cc1c
diff --git a/apps/web/app/(ee)/api/admin/impersonate/route.ts b/apps/web/app/(ee)/api/admin/impersonate/route.tsindex a4dcf37a4d..6dfa6ef0e8 100644--- a/apps/web/app/(ee)/api/admin/impersonate/route.ts+++ b/apps/web/app/(ee)/api/admin/impersonate/route.ts@@ -81,7 +81,9 @@ const userSelect = {const ownerSelect = {users: {where: {- role: "owner",+ role: {+ in: ["owner", "billing"], // in cases of disabled workspaces, the billing user is the owner+ },user: {email: {not: null,@@ -113,7 +115,8 @@ function parseImpersonateQuery(): ImpersonateIdentifier | { error: string } {if (typeof raw !== "string" || !raw.trim()) {return {- error: "Enter a user email, workspace slug, domain, or Stripe customer ID",+ error:+ "Enter a user email, workspace slug, domain, or Stripe customer ID",};}diff --git a/apps/web/lib/zod/schemas/workspaces.ts b/apps/web/lib/zod/schemas/workspaces.tsindex 5827e3f142..8c0ead413e 100644--- a/apps/web/lib/zod/schemas/workspaces.ts+++ b/apps/web/lib/zod/schemas/workspaces.ts@@ -68,6 +68,10 @@ export const WorkspaceSchema = z.date().nullable().describe("The date and time when the payment failed for the workspace."),+ disabledAt: z+ .date()+ .nullable()+ .describe("The date and time when the workspace was disabled."),stripeConnectId: z.string().nullable()diff --git a/apps/web/ui/layout/sidebar/workspace-dropdown.tsx b/apps/web/ui/layout/sidebar/workspace-dropdown.tsxindex 09402872c0..09ceaeca02 100644--- a/apps/web/ui/layout/sidebar/workspace-dropdown.tsx+++ b/apps/web/ui/layout/sidebar/workspace-dropdown.tsx@@ -5,7 +5,7 @@ import useWorkspaces from "@/lib/swr/use-workspaces";import { PlanProps, WorkspaceProps } from "@/lib/types";import { ModalContext } from "@/ui/modals/modal-provider";import { getUserAvatarUrl } from "@/ui/users/user-avatar";-import { BlurImage, Popover, ScrollContainer } from "@dub/ui";+import { BlurImage, Popover, ScrollContainer, StatusBadge } from "@dub/ui";import { Check2, Gear, Plus, UserPlus } from "@dub/ui/icons";import { cn, isLegacyBusinessPlan, pluralize } from "@dub/utils";import { useSession } from "next-auth/react";@@ -60,6 +60,7 @@ export function WorkspaceDropdown() {slug: string;image: string;plan: PlanProps;+ disabledAt?: Date | string | null;};const [openPopover, setOpenPopover] = useState(false);@@ -122,6 +123,7 @@ function WorkspaceList({slug?: string; // undefined if the user is on the personal accountimage: string;plan: PlanProps;+ disabledAt?: Date | string | null;};workspaces: WorkspaceProps[];setOpenPopover: (open: boolean) => void;@@ -165,8 +167,20 @@ function WorkspaceList({draggable={false}/><div className="min-w-0">- <div className="truncate text-base font-medium leading-5 text-neutral-900 sm:text-sm">- {selected.name}+ <div className="flex min-w-0 items-center gap-1.5">+ <div className="min-w-0 truncate text-base font-medium leading-5 text-neutral-900 sm:text-sm">+ {selected.name}+ </div>+ {selected.disabledAt && (+ <StatusBadge+ variant="neutral"+ size="sm"+ icon={null}+ className="shrink-0"+ >+ Disabled+ </StatusBadge>+ )}</div>{selected.slug && (<div@@ -214,13 +228,13 @@ function WorkspaceList({Workspaces</p><div className="flex flex-col gap-0.5">- {workspaces.map(({ id, name, slug, logo }) => {+ {workspaces.map(({ id, name, slug, logo, disabledAt }) => {const isActive = selected.slug === slug;return (<Linkkey={slug}className={cn(- "relative flex w-full items-center gap-x-2 rounded-md px-2 py-2 transition-all duration-75",+ "flex w-full items-center gap-x-2 rounded-md px-2 py-2 transition-all duration-75","hover:bg-neutral-200/50 active:bg-neutral-200/80","outline-none focus-visible:ring-2 focus-visible:ring-black/50",isActive && "bg-neutral-200/50",@@ -237,13 +251,24 @@ function WorkspaceList({className="size-5 shrink-0 overflow-hidden rounded-full"draggable={false}/>- <span className="block truncate text-base leading-5 text-neutral-900 sm:max-w-[140px] sm:text-sm">+ <span className="min-w-0 flex-1 truncate text-base leading-5 text-neutral-900 sm:text-sm">{name}</span>- {selected.slug === slug ? (- <span className="absolute inset-y-0 right-0 flex items-center pr-3 text-black">- <Check2 className="size-4" aria-hidden="true" />- </span>+ {disabledAt && (+ <StatusBadge+ variant="neutral"+ size="sm"+ icon={null}+ className="shrink-0"+ >+ Disabled+ </StatusBadge>+ )}+ {isActive ? (+ <Check2+ className="size-4 shrink-0 text-black"+ aria-hidden="true"+ />) : null}</Link>);