feat(ui): migrate the Playground page to App Router path routing

Add llm-playground -> playground to MIGRATED_PAGES and remove the page's arm
from the legacy switch in page.tsx. The playground route already sources all
its data from useAuthorized and fetches its own proxy settings, so this is a
pure cutover with no prop or state changes.

Visiting /ui/?page=llm-playground now redirects to /ui/playground, the sidebar
links to and highlights it, and navigating away returns to the legacy switch.
Cover the new mapping with a reverse-lookup test so the sidebar highlight is pinned.
This commit is contained in:
ryan-crabbe-berri 2026-06-08 13:08:26 -07:00
parent 1afc41cb29
commit 363579f70f
3 changed files with 3 additions and 3 deletions

View file

@ -2,7 +2,6 @@
import SidebarProvider from "@/app/(dashboard)/components/SidebarProvider";
import OldModelDashboard from "@/app/(dashboard)/models-and-endpoints/ModelsAndEndpointsView";
import PlaygroundPage from "@/app/(dashboard)/playground/page";
import AdminPanel from "@/components/AdminPanel";
import AgentsPanel from "@/components/agents";
import BudgetPanel from "@/components/budgets/budget_panel";
@ -406,8 +405,6 @@ function CreateKeyPageContent() {
premiumUser={premiumUser}
teams={teams}
/>
) : page == "llm-playground" ? (
<PlaygroundPage />
) : page == "users" ? (
<ViewUserDashboard
userID={userID}

View file

@ -34,6 +34,7 @@ describe("migratedHref / legacyPageHref", () => {
expect(MIGRATED_PAGES.api_ref).toBe("api-reference");
expect(MIGRATED_PAGES["api-reference"]).toBe("api-reference");
expect(MIGRATED_PAGES["llm-playground"]).toBe("playground");
});
});
@ -49,6 +50,7 @@ describe("legacyKeyForPathname", () => {
// Resolves to the sidebar key api_ref, not the hyphenated alias, so highlighting works.
expect(legacyKeyForPathname("/ui/api-reference")).toBe("api_ref");
expect(legacyKeyForPathname("/ui/api-reference/")).toBe("api_ref");
expect(legacyKeyForPathname("/ui/playground")).toBe("llm-playground");
});
it("returns null for a not-yet-migrated path", async () => {

View file

@ -12,6 +12,7 @@ export const MIGRATED_PAGES: Record<string, string> = {
api_ref: "api-reference",
// Legacy alias: older bookmarks used the hyphenated ?page=api-reference form.
"api-reference": "api-reference",
"llm-playground": "playground",
};
function uiBase(): string {