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.

Move `/[slug]` to `/[slug]/links`

Tim Wilsonee95e75eb78c
diff --git a/apps/web/app/admin.dub.co/(dashboard)/links/page.tsx b/apps/web/app/admin.dub.co/(dashboard)/links/page.tsx
index cbc4c5f5df..4256ef43ef 100644
--- a/apps/web/app/admin.dub.co/(dashboard)/links/page.tsx
+++ b/apps/web/app/admin.dub.co/(dashboard)/links/page.tsx
@@ -1,4 +1,4 @@
-import AdminLinksClient from "app/app.dub.co/(dashboard)/[slug]/page-client";
+import AdminLinksClient from "app/app.dub.co/(dashboard)/[slug]/links/page-client";
import { Suspense } from "react";
export default function AdminLinks() {
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/links-title.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/links-title.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/links-title.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/links/links-title.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/page-client.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/page-client.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/links/page-client.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/page.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/page.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/links/page.tsx
diff --git a/apps/web/lib/middleware/app.ts b/apps/web/lib/middleware/app.ts
index a0be0a8878..e697e255db 100644
--- a/apps/web/lib/middleware/app.ts
+++ b/apps/web/lib/middleware/app.ts
@@ -83,6 +83,7 @@ export default async function AppMiddleware(req: NextRequest) {
"/login",
"/register",
"/workspaces",
+ "/links",
"/analytics",
"/events",
"/programs",
diff --git a/apps/web/lib/middleware/utils/app-redirect.ts b/apps/web/lib/middleware/utils/app-redirect.ts
index c9e314f395..3c2f9a5dee 100644
--- a/apps/web/lib/middleware/utils/app-redirect.ts
+++ b/apps/web/lib/middleware/utils/app-redirect.ts
@@ -9,6 +9,10 @@ export const appRedirect = (path: string) => {
return APP_REDIRECTS[path];
}
+ // Redirect "/[slug]" to "/[slug]/links"
+ const rootRegex = /^\/([^\/]+)$/;
+ if (rootRegex.test(path)) return path.replace(rootRegex, "/$1/links");
+
// Redirect "programs/[programId]/settings" to "programs/[programId]/settings/rewards" (first tab)
const programSettingsRegex = /\/programs\/([^\/]+)\/settings$/;
if (programSettingsRegex.test(path))
diff --git a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
index 237233b988..3edc6fe0ed 100644
--- a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
@@ -50,8 +50,7 @@ const NAV_AREAS: SidebarNavAreas<{
{
name: "Links",
icon: Hyperlink,
- href: `/${slug}${pathname === `/${slug}` ? "" : queryString}`,
- exact: true,
+ href: `/${slug}/links${pathname === `/${slug}/links` ? "" : queryString}`,
},
{
name: "Analytics",