Files
589be3a6de fix(hub): open the project Dashboard to every member, rename /insights → /dashboard (BEA-12) (#62)
* fix(hub): open the project Dashboard to every member, rename /insights → /dashboard (BEA-12)

"Dashboard" was the first sidebar item a new member clicked and it always
refused: it landed on /<project>/insights showing "Insights is for hub
admins and org owners." The gate was client-side only — GET /heat is
gated on project membership and returns counts without actor identities,
so every member's browser could already fetch every number the page draws.

Drops the canInsights gate (nav item, dedicated route, project-home
embed, ⋯ menu entry) and renames the view route insights → dashboard so
the nav label, the URL and the page title finally agree. The shipped
/insights URL still resolves and normalizes to /dashboard (LEGACY_VIEWS
in router.ts) so bookmarks don't 404 and only one URL stays live.

No server change: /heat gating and response shape are untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(architecture): router VIEW_ROUTES now names dashboard, with LEGACY_VIEWS

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 07:05:00 +09:00

36 lines
1.6 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { login, wikiId } from "./helpers";
test("dashboard via ⋯ scopes to the open file", async ({ page }) => {
await login(page);
const pid = await wikiId(page);
await page.goto(`/${pid}/notes/readme.md`);
await page.click("#more-btn");
await page.click("#more-menu .more-item:has-text('Dashboard')");
await expect(page).toHaveURL(`/${pid}/dashboard/notes/readme.md`);
await expect(page.locator(".in-title .in-scope")).toContainText("notes/readme.md");
// The subject stays selected in the tree; Dashboard does NOT light up.
await expect(page.locator('#tree .row[data-path="notes/readme.md"]')).toHaveClass(/active/);
await expect(page.locator("#nav-dashboard")).not.toHaveClass(/active/);
});
test("dashboard via ⋯ scopes to the selected folder", async ({ page }) => {
await login(page);
const pid = await wikiId(page);
await page.goto(`/${pid}/notes`);
await page.click("#more-btn");
await page.click("#more-menu .more-item:has-text('Dashboard')");
await expect(page).toHaveURL(`/${pid}/dashboard/notes`);
await expect(page.locator(".in-title .in-scope")).toContainText("notes");
await expect(page.locator('#tree .row[data-path="notes"]')).toHaveClass(/active/);
await expect(page.locator("#nav-dashboard")).not.toHaveClass(/active/);
});
test("root Dashboard still lights the menu, not the tree", async ({ page }) => {
await login(page);
await wikiId(page);
await page.click("#nav-dashboard");
await expect(page.locator("#nav-dashboard")).toHaveClass(/active/);
await expect(page.locator("#tree .row.active")).toHaveCount(0);
});