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.

add redirects for workspace sections

Steven Tey8d02e848bcea
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/layout.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/settings/layout.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/layout.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/page-client.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/page-client.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/page.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/page.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/settings/page.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/page.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/tokens/page-client.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/settings/tokens/page-client.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/tokens/page-client.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/tokens/page.tsx b/apps/web/app/app.dub.co/(dashboard)/account/settings/tokens/page.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/settings/tokens/page.tsx
rename to apps/web/app/app.dub.co/(dashboard)/account/settings/tokens/page.tsx
diff --git a/apps/web/lib/middleware/app.ts b/apps/web/lib/middleware/app.ts
index fc599200d7..2c401188cd 100644
--- a/apps/web/lib/middleware/app.ts
+++ b/apps/web/lib/middleware/app.ts
@@ -42,12 +42,19 @@ export default async function AppMiddleware(req: NextRequest) {
return NextResponse.redirect(new URL("/welcome", req.url));
// if the path is / or /login or /register, redirect to the default workspace
- } else if (path === "/" || path === "/login" || path === "/register") {
+ } else if (
+ path === "/" ||
+ path === "/login" ||
+ path === "/register" ||
+ path.startsWith("/analytics") ||
+ path.startsWith("/integrations") ||
+ path.startsWith("/settings")
+ ) {
const defaultWorkspace = await getDefaultWorkspace(user);
if (defaultWorkspace) {
return NextResponse.redirect(
- new URL(`/${defaultWorkspace}${searchParamsString}`, req.url),
+ new URL(`/${defaultWorkspace}${path}${searchParamsString}`, req.url),
);
} else {
return NextResponse.redirect(new URL("/workspaces", req.url));
diff --git a/apps/web/ui/layout/settings-nav-link.tsx b/apps/web/ui/layout/settings-nav-link.tsx
index 85d640fd5e..95351e63d6 100644
--- a/apps/web/ui/layout/settings-nav-link.tsx
+++ b/apps/web/ui/layout/settings-nav-link.tsx
@@ -20,7 +20,7 @@ export default function NavLink({
slug?: string;
};
- const href = `${slug ? `/${slug}` : ""}/settings${
+ const href = `${slug ? `/${slug}` : "/account"}/settings${
segment ? `/${segment}` : ""
}`;
diff --git a/apps/web/ui/layout/user-dropdown.tsx b/apps/web/ui/layout/user-dropdown.tsx
index 831dcae140..f82e812259 100644
--- a/apps/web/ui/layout/user-dropdown.tsx
+++ b/apps/web/ui/layout/user-dropdown.tsx
@@ -51,7 +51,7 @@ export default function UserDropdown() {
/>
</Link>
<Link
- href="/settings"
+ href="/account/settings"
onClick={() => setOpenPopover(false)}
className="block w-full rounded-md p-2 text-sm transition-all duration-75 hover:bg-gray-100 active:bg-gray-200"
>
diff --git a/apps/web/ui/modals/google-oauth-modal.tsx b/apps/web/ui/modals/google-oauth-modal.tsx
index dee4c0f29f..13e1865de5 100644
--- a/apps/web/ui/modals/google-oauth-modal.tsx
+++ b/apps/web/ui/modals/google-oauth-modal.tsx
@@ -45,7 +45,7 @@ function GoogleOauthModal({
onClick={() => {
setClickedGoogle(true);
signIn("google", {
- callbackUrl: "/settings?google=true",
+ callbackUrl: "/account/settings?google=true",
});
}}
loading={clickedGoogle}