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.

fix test, small ui update

Steven Teyb2beab8d1986
diff --git a/apps/web/tests/tracks/track-lead.test.ts b/apps/web/tests/tracks/track-lead.test.ts
index 3bc5afda1a..18e2d67f81 100644
--- a/apps/web/tests/tracks/track-lead.test.ts
+++ b/apps/web/tests/tracks/track-lead.test.ts
@@ -50,12 +50,12 @@ describe("POST /track/lead", async () => {
},
});
- expect(response.status).toEqual(429);
+ expect(response.status).toEqual(409);
expect(response.data).toStrictEqual({
error: {
- code: "rate_limit_exceeded",
- doc_url: "https://dub.co/docs/api-reference/errors#rate-limit_exceeded",
- message: `Rate limit exceeded for customer ${customer.id}: Signup`,
+ code: "conflict",
+ doc_url: "https://dub.co/docs/api-reference/errors#conflict",
+ message: `Customer with externalId ${customer.id} and event name: Signup has already been recorded in the last hour.`,
},
});
});
diff --git a/apps/web/ui/folders/folder-dropdown.tsx b/apps/web/ui/folders/folder-dropdown.tsx
index 30de2462d6..d447b47f0e 100644
--- a/apps/web/ui/folders/folder-dropdown.tsx
+++ b/apps/web/ui/folders/folder-dropdown.tsx
@@ -16,7 +16,8 @@ interface FolderDropdownProps {
onFolderSelect?: (folder: FolderSummary) => void;
hideViewAll?: boolean;
hideFolderIcon?: boolean;
- textClassName?: string;
+ buttonClassName?: string;
+ buttonTextClassName?: string;
disableAutoRedirect?: boolean; // decide if we should auto redirect to the folder after it's created
}
@@ -24,7 +25,8 @@ export const FolderDropdown = ({
onFolderSelect,
hideViewAll = false,
hideFolderIcon = false,
- textClassName,
+ buttonClassName,
+ buttonTextClassName,
disableAutoRedirect = false,
}: FolderDropdownProps) => {
const router = useRouter();
@@ -75,7 +77,7 @@ export const FolderDropdown = ({
<AddFolderModal />
<Popover
content={
- <div className="relative mt-1 max-h-80 w-full space-y-0.5 overflow-auto rounded-md bg-white p-2 text-base sm:w-60 sm:text-sm sm:shadow-lg">
+ <div className="relative mt-1 max-h-80 w-full space-y-0.5 overflow-auto rounded-md bg-white p-2 text-base sm:w-60 sm:text-sm sm:shadow-lg md:w-80">
{!hideViewAll && (
<div className="flex items-center justify-between px-2 pb-1">
<p className="text-xs font-medium text-neutral-500">Folders</p>
@@ -112,7 +114,7 @@ export const FolderDropdown = ({
>
<FolderIcon folder={folder} shape="square" />
<span
- className={`flex items-center justify-start gap-1.5 text-sm sm:max-w-[140px] ${
+ className={`flex items-center justify-start gap-1.5 text-sm sm:max-w-36 md:max-w-52 ${
selectedFolder?.id === folder.id
? "font-medium"
: "font-normal"
@@ -181,19 +183,24 @@ export const FolderDropdown = ({
>
<button
className={cn(
- "group flex max-w-60 items-center gap-2 rounded-lg px-2 py-1",
+ "group flex max-w-40 items-center gap-2 rounded-lg px-2 py-1 md:max-w-fit",
"transition-colors hover:bg-neutral-100 active:bg-neutral-200 data-[state=open]:bg-neutral-100",
+ buttonClassName,
)}
>
{!(selectedFolder?.id === "unsorted" && hideFolderIcon) &&
selectedFolder && (
- <FolderIcon folder={selectedFolder} shape="square" />
+ <FolderIcon
+ folder={selectedFolder}
+ shape="square"
+ className="hidden md:block"
+ />
)}
<h1
className={cn(
"min-w-0 truncate text-left text-xl font-semibold leading-7 text-neutral-900 md:text-2xl",
- textClassName,
+ buttonTextClassName,
)}
>
{selectedFolder ? selectedFolder.name : "Links"}
diff --git a/apps/web/ui/modals/link-builder/index.tsx b/apps/web/ui/modals/link-builder/index.tsx
index 2b265230bd..9578cc5b03 100644
--- a/apps/web/ui/modals/link-builder/index.tsx
+++ b/apps/web/ui/modals/link-builder/index.tsx
@@ -343,57 +343,60 @@ function LinkBuilderInner({
}
})}
>
- <div className="flex items-center justify-between px-6 py-4">
- <div className="flex items-center gap-2">
- {flags?.linkFolders && (
- <>
- <FolderDropdown
- hideViewAll={true}
- disableAutoRedirect={true}
- onFolderSelect={(folder) => {
- setValue("folderId", folder.id, { shouldDirty: true });
- }}
- textClassName="text-lg md:text-lg font-medium"
- />
-
- <ChevronRight className="size-4 text-neutral-500" />
- </>
- )}
-
- <LinkLogo
- apexDomain={getApexDomain(debouncedUrl)}
- className="size-6 sm:size-6 [&>*]:size-3 sm:[&>*]:size-4"
- />
- <h3 className="!mt-0 max-w-sm truncate text-lg font-medium">
- {props ? `Edit ${shortLink}` : "New link"}
- </h3>
- </div>
- {!homepageDemo && (
- <div className="flex items-center gap-4">
- {!homepageDemo && workspaceId && (
- <DraftControls
- ref={draftControlsRef}
- props={props}
- workspaceId={workspaceId}
- />
- )}
- <button
- type="button"
- onClick={() => {
- setShowLinkBuilder(false);
- if (searchParams.has("newLink")) {
- queryParams({
- del: ["newLink"],
- });
- }
- draftControlsRef.current?.onClose();
+ <div className="flex flex-col items-start gap-2 px-6 py-4 md:flex-row md:items-center md:justify-between">
+ {flags?.linkFolders && (
+ <div className="flex items-center gap-2">
+ <FolderDropdown
+ hideViewAll={true}
+ disableAutoRedirect={true}
+ onFolderSelect={(folder) => {
+ setValue("folderId", folder.id, { shouldDirty: true });
}}
- className="group hidden rounded-full p-2 text-neutral-500 transition-all duration-75 hover:bg-neutral-100 focus:outline-none active:bg-neutral-200 md:block"
- >
- <X className="h-5 w-5" />
- </button>
+ buttonClassName="max-w-60 md:max-w-[24rem]"
+ buttonTextClassName="text-lg md:text-lg font-medium"
+ />
+
+ <ChevronRight className="hidden size-4 text-neutral-500 md:block" />
</div>
)}
+
+ <div className="flex w-full items-center justify-between gap-2">
+ <div className="flex items-center gap-2">
+ <LinkLogo
+ apexDomain={getApexDomain(debouncedUrl)}
+ className="size-6 sm:size-6 [&>*]:size-3 sm:[&>*]:size-4"
+ />
+ <h3 className="!mt-0 max-w-sm truncate text-lg font-medium">
+ {props ? `Edit ${shortLink}` : "New link"}
+ </h3>
+ </div>
+ {!homepageDemo && (
+ <div className="flex items-center gap-4">
+ {!homepageDemo && workspaceId && (
+ <DraftControls
+ ref={draftControlsRef}
+ props={props}
+ workspaceId={workspaceId}
+ />
+ )}
+ <button
+ type="button"
+ onClick={() => {
+ setShowLinkBuilder(false);
+ if (searchParams.has("newLink")) {
+ queryParams({
+ del: ["newLink"],
+ });
+ }
+ draftControlsRef.current?.onClose();
+ }}
+ className="group hidden rounded-full p-2 text-neutral-500 transition-all duration-75 hover:bg-neutral-100 focus:outline-none active:bg-neutral-200 md:block"
+ >
+ <X className="h-5 w-5" />
+ </button>
+ </div>
+ )}
+ </div>
</div>
<div