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.

remove "/workspaces"

Steven Teyb8b993d871df
diff --git a/apps/web/lib/middleware/app.ts b/apps/web/lib/middleware/app.ts
index 5d00eeebbb..ccfd6cc5e5 100644
--- a/apps/web/lib/middleware/app.ts
+++ b/apps/web/lib/middleware/app.ts
@@ -1,6 +1,7 @@
import { parse } from "@/lib/middleware/utils";
import { NextRequest, NextResponse } from "next/server";
import NewLinkMiddleware from "./new-link";
+import { APP_REDIRECTS } from "./utils/app-redirects";
import { getDefaultWorkspace } from "./utils/get-default-workspace";
import { getOnboardingStep } from "./utils/get-onboarding-step";
import { getUserViaToken } from "./utils/get-user-via-token";
@@ -83,6 +84,8 @@ export default async function AppMiddleware(req: NextRequest) {
isTopLevelSettingsRedirect(path)
) {
return WorkspacesMiddleware(req, user);
+ } else if (APP_REDIRECTS[path]) {
+ return NextResponse.redirect(new URL(APP_REDIRECTS[path], req.url));
}
}
diff --git a/apps/web/lib/middleware/utils/app-redirects.ts b/apps/web/lib/middleware/utils/app-redirects.ts
new file mode 100644
index 0000000000..ce94ff35bc
--- /dev/null
+++ b/apps/web/lib/middleware/utils/app-redirects.ts
@@ -0,0 +1,3 @@
+export const APP_REDIRECTS = {
+ "/account": "/account/settings",
+};
diff --git a/apps/web/ui/layout/sidebar/workspace-dropdown.tsx b/apps/web/ui/layout/sidebar/workspace-dropdown.tsx
index bddaf1c989..6dacc5b30d 100644
--- a/apps/web/ui/layout/sidebar/workspace-dropdown.tsx
+++ b/apps/web/ui/layout/sidebar/workspace-dropdown.tsx
@@ -215,15 +215,6 @@ function WorkspaceList({
<p className="px-1 text-xs font-medium text-neutral-500">
Workspaces
</p>
- {workspaces.length > 0 && (
- <Link
- href="/workspaces"
- onClick={() => setOpenPopover(false)}
- className="rounded-md px-2 py-1 text-xs text-neutral-500 transition-colors duration-75 hover:bg-neutral-200/50 hover:text-neutral-700 active:bg-neutral-200/80"
- >
- View All
- </Link>
- )}
</div>
<div className="flex flex-col gap-0.5">
{workspaces.map(({ id, name, slug, logo, plan }) => {
diff --git a/apps/web/ui/layout/workspace-switcher.tsx b/apps/web/ui/layout/workspace-switcher.tsx
index 15bbc0cfa5..24467efffb 100644
--- a/apps/web/ui/layout/workspace-switcher.tsx
+++ b/apps/web/ui/layout/workspace-switcher.tsx
@@ -139,15 +139,6 @@ function WorkspaceList({
<div className="relative mt-1 max-h-72 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="flex items-center justify-between px-2 pb-1">
<p className="text-xs text-gray-500">My Workspaces</p>
- {workspaces.length > 0 && (
- <Link
- href="/workspaces"
- onClick={() => setOpenPopover(false)}
- className="rounded-md border border-gray-200 px-2 py-1 text-xs transition-colors hover:bg-gray-100"
- >
- View All
- </Link>
- )}
</div>
{workspaces.map(({ id, name, slug, logo }) => {
return (
diff --git a/apps/web/ui/modals/delete-workspace-modal.tsx b/apps/web/ui/modals/delete-workspace-modal.tsx
index f55bbb3994..d575d5403f 100644
--- a/apps/web/ui/modals/delete-workspace-modal.tsx
+++ b/apps/web/ui/modals/delete-workspace-modal.tsx
@@ -36,7 +36,7 @@ function DeleteWorkspaceModal({
}).then(async (res) => {
if (res.ok) {
await mutate("/api/workspaces");
- router.push("/workspaces");
+ router.push("/");
resolve(null);
} else {
setDeleting(false);
diff --git a/apps/web/ui/workspaces/workspace-not-found.tsx b/apps/web/ui/workspaces/workspace-not-found.tsx
index bcfaba2212..be84d8a085 100644
--- a/apps/web/ui/workspaces/workspace-not-found.tsx
+++ b/apps/web/ui/workspaces/workspace-not-found.tsx
@@ -1,6 +1,5 @@
import { MaxWidthWrapper } from "@dub/ui";
import { FileX2 } from "lucide-react";
-import Link from "next/link";
export default function WorkspaceNotFound() {
return (
@@ -22,12 +21,6 @@ export default function WorkspaceNotFound() {
width={400}
height={400}
/>
- <Link
- href="/workspaces"
- className="z-10 rounded-md border border-black bg-black px-10 py-2 text-sm font-medium text-white transition-all duration-75 hover:bg-white hover:text-black"
- >
- Back to my workspaces
- </Link>
</div>
</MaxWidthWrapper>
);