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.

run prettier

Steven Tey0c4e0335a734
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/route.ts
index 9f0327a953..1819be7ecc 100644
--- a/apps/web/app/api/workspaces/[idOrSlug]/route.ts
+++ b/apps/web/app/api/workspaces/[idOrSlug]/route.ts
@@ -10,15 +10,24 @@ import { NextResponse } from "next/server";
const updateWorkspaceSchema = z.object({
name: z.preprocess(trim, z.string().min(1).max(32)).optional(),
- slug: z.preprocess(trim,
- z.string()
- .min(3, "Slug must be at least 3 characters")
- .max(48, "Slug must be less than 48 characters")
- .transform((v) => slugify(v))
- .refine((v) => validSlugRegex.test(v), { message: "Invalid slug format" })
- .refine(async (v) => !((await isReservedKey(v)) || DEFAULT_REDIRECTS[v]), {
- message: "Cannot use reserved slugs",
- }))
+ slug: z
+ .preprocess(
+ trim,
+ z
+ .string()
+ .min(3, "Slug must be at least 3 characters")
+ .max(48, "Slug must be less than 48 characters")
+ .transform((v) => slugify(v))
+ .refine((v) => validSlugRegex.test(v), {
+ message: "Invalid slug format",
+ })
+ .refine(
+ async (v) => !((await isReservedKey(v)) || DEFAULT_REDIRECTS[v]),
+ {
+ message: "Cannot use reserved slugs",
+ },
+ ),
+ )
.optional(),
});
diff --git a/apps/web/app/app.dub.co/(auth)/login/form.tsx b/apps/web/app/app.dub.co/(auth)/login/form.tsx
index e28d914346..b337f2c653 100644
--- a/apps/web/app/app.dub.co/(auth)/login/form.tsx
+++ b/apps/web/app/app.dub.co/(auth)/login/form.tsx
@@ -15,7 +15,7 @@ export default function LoginForm() {
const [noSuchAccount, setNoSuchAccount] = useState(false);
const [email, setEmail] = useState("");
const [clickedGoogle, setClickedGoogle] = useState(false);
- const [clickedGitub, setClickedGithub] = useState(false);
+ const [clickedGithub, setClickedGithub] = useState(false);
const [clickedEmail, setClickedEmail] = useState(false);
const [clickedSSO, setClickedSSO] = useState(false);
@@ -59,7 +59,7 @@ export default function LoginForm() {
...(next && next.length > 0 ? { callbackUrl: next } : {}),
});
}}
- loading={clickedGitub}
+ loading={clickedGithub}
disabled={clickedEmail || clickedSSO}
icon={<Github className="h-5 w-5 text-black" />}
/>
diff --git a/apps/web/app/app.dub.co/(auth)/register/form.tsx b/apps/web/app/app.dub.co/(auth)/register/form.tsx
index f637a2b605..4e6c515b01 100644
--- a/apps/web/app/app.dub.co/(auth)/register/form.tsx
+++ b/apps/web/app/app.dub.co/(auth)/register/form.tsx
@@ -10,7 +10,7 @@ export default function RegisterForm() {
const searchParams = useSearchParams();
const next = searchParams?.get("next");
const [clickedGoogle, setClickedGoogle] = useState(false);
- const [clickedGitub, setClickedGithub] = useState(false);
+ const [clickedGithub, setClickedGithub] = useState(false);
useEffect(() => {
// when leave page, reset state
@@ -42,7 +42,7 @@ export default function RegisterForm() {
...(next && next.length > 0 ? { callbackUrl: next } : {}),
});
}}
- loading={clickedGitub}
+ loading={clickedGithub}
icon={<Github className="h-4 w-4" />}
/>
<p className="text-center text-sm text-gray-500">
diff --git a/apps/web/lib/openapi/index.ts b/apps/web/lib/openapi/index.ts
index 372dd88017..c6d08980c3 100644
--- a/apps/web/lib/openapi/index.ts
+++ b/apps/web/lib/openapi/index.ts
@@ -1,7 +1,5 @@
import { openApiErrorResponses } from "@/lib/openapi/responses";
-import { LinkSchema } from "@/lib/zod/schemas";
-import { TagSchema } from "@/lib/zod/schemas";
-import { WorkspaceSchema } from "@/lib/zod/schemas";
+import { LinkSchema, TagSchema, WorkspaceSchema } from "@/lib/zod/schemas";
import { API_DOMAIN } from "@dub/utils";
import { ZodOpenApiObject } from "zod-openapi";
import { analyticsPaths } from "./analytics";
diff --git a/apps/web/lib/openapi/request.ts b/apps/web/lib/openapi/request.ts
index ed1aa37201..30ad4093af 100644
--- a/apps/web/lib/openapi/request.ts
+++ b/apps/web/lib/openapi/request.ts
@@ -5,6 +5,8 @@ export const workspaceParamsSchema = z.object({
projectSlug: z
.string()
.optional()
- .describe("The slug of the project. This field is deprecated – use `workspaceId` instead.")
+ .describe(
+ "The slug of the project. This field is deprecated – use `workspaceId` instead.",
+ )
.openapi({ deprecated: true }),
});
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index e0a12d8f03..0f86edb48c 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -35,7 +35,9 @@ const LinksQuerySchema = z.object({
tagId: z
.string()
.optional()
- .describe("The tag ID to filter the links by. This field is deprecated – use `tagIds` instead.")
+ .describe(
+ "The tag ID to filter the links by. This field is deprecated – use `tagIds` instead.",
+ )
.openapi({ deprecated: true }),
tagIds: z
.union([z.string(), z.array(z.string())])
@@ -366,7 +368,9 @@ export const LinkSchema = z
.describe("The date and time when the short link was last updated."),
projectId: z
.string()
- .describe("The project ID of the short link. This field is deprecated – use `workspaceId` instead.")
+ .describe(
+ "The project ID of the short link. This field is deprecated – use `workspaceId` instead.",
+ )
.openapi({ deprecated: true }),
})
.openapi({ title: "Link" });
diff --git a/apps/web/scripts/bulk-create-domains.ts b/apps/web/scripts/bulk-create-domains.ts
index 99fdb22f85..2c80369f76 100644
--- a/apps/web/scripts/bulk-create-domains.ts
+++ b/apps/web/scripts/bulk-create-domains.ts
@@ -1,8 +1,8 @@
import { addDomainToVercel, setRootDomain } from "@/lib/api/domains";
+import prisma from "@/lib/prisma";
import "dotenv-flow/config";
import * as fs from "fs";
import * as Papa from "papaparse";
-import prisma from "@/lib/prisma";
const projectId = "xxx";
const domains: { domain: string; target: string }[] = [];
diff --git a/apps/web/ui/analytics/bar-list.tsx b/apps/web/ui/analytics/bar-list.tsx
index 1e5a66f196..fddfc9716d 100644
--- a/apps/web/ui/analytics/bar-list.tsx
+++ b/apps/web/ui/analytics/bar-list.tsx
@@ -16,7 +16,6 @@ import {
getApexDomain,
linkConstructor,
nFormatter,
- punycode,
truncate,
} from "@dub/utils";
import { motion } from "framer-motion";
diff --git a/apps/web/ui/analytics/link-preview.tsx b/apps/web/ui/analytics/link-preview.tsx
index 707defe35c..9b456a2641 100644
--- a/apps/web/ui/analytics/link-preview.tsx
+++ b/apps/web/ui/analytics/link-preview.tsx
@@ -5,7 +5,6 @@ import {
cn,
getApexDomain,
linkConstructor,
- punycode,
timeAgo,
truncate,
} from "@dub/utils";
diff --git a/apps/web/ui/analytics/toggle.tsx b/apps/web/ui/analytics/toggle.tsx
index ba5e4faef6..6edcb29a07 100644
--- a/apps/web/ui/analytics/toggle.tsx
+++ b/apps/web/ui/analytics/toggle.tsx
@@ -5,7 +5,6 @@ import {
cn,
getApexDomain,
linkConstructor,
- punycode,
} from "@dub/utils";
import { useContext } from "react";
import { AnalyticsContext } from ".";