Skip to content

Commit 2b22e98

Browse files
fix: link profile breadcrumbs to canonical route
1 parent af96221 commit 2b22e98

8 files changed

Lines changed: 26 additions & 4 deletions

File tree

72 KB
Loading
63.7 KB
Loading

src/__tests__/package-detail-route.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,24 @@ describe("plugin detail route", () => {
175175
expect(screen.queryByRole("link", { name: "Download zip" })).toBeNull();
176176
});
177177

178+
it("links plugin breadcrumb owners to canonical publisher profiles", async () => {
179+
loaderDataMock = {
180+
...loaderDataMock,
181+
detail: {
182+
package: loaderDataMock.detail.package,
183+
owner: { handle: "openclaw", displayName: "OpenClaw", image: null },
184+
},
185+
};
186+
const route = await loadRoute();
187+
const Component = route.__config.component as ComponentType;
188+
189+
const { container } = render(<Component />);
190+
191+
expect(
192+
container.querySelector('nav[aria-label="Plugin breadcrumbs"] a[href="/p/openclaw"]'),
193+
).toBeTruthy();
194+
});
195+
178196
it("shows plugin settings when the viewer can manage the plugin", async () => {
179197
useAuthStatusMock.mockReturnValue({
180198
isAuthenticated: true,

src/components/SecurityScannerPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function SecurityScannerHero({ label, props }: { label: string; props: SecurityS
125125
const ownerLabel = getOwnerLabel(props.entity);
126126
const listingLabel = props.entity.kind === "skill" ? "skills" : "plugins";
127127
const ownerHref =
128-
props.entity.kind === "skill" ? `/${encodeURIComponent(ownerLabel)}` : "/plugins";
128+
props.entity.kind === "skill" ? `/p/${encodeURIComponent(ownerLabel)}` : "/plugins";
129129

130130
return (
131131
<header className="security-scan-hero">

src/components/SkillHeader.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ describe("SkillHeader", () => {
104104
expect(screen.getByText("Downloads")).toBeTruthy();
105105
expect(screen.getByText("2")).toBeTruthy();
106106
expect(container.querySelector('a[href="/p/local"]')).toBeTruthy();
107+
expect(
108+
container.querySelector('nav[aria-label="Skill breadcrumbs"] a[href="/p/local"]'),
109+
).toBeTruthy();
107110
});
108111

109112
it("shows the latest version description instead of the short catalog summary", () => {

src/components/SkillHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ export function SkillHeader({
261261
<nav className="skill-hero-breadcrumbs" aria-label="Skill breadcrumbs">
262262
<a href="/skills">skills</a>
263263
<span aria-hidden="true">/</span>
264-
<a href={ownerHandle ? `/${encodeURIComponent(ownerHandle)}` : "#"}>
264+
<a href={ownerHandle ? `/p/${encodeURIComponent(ownerHandle)}` : "#"}>
265265
{ownerHandle ?? owner?.displayName ?? owner?._id ?? "unknown"}
266266
</a>
267267
<span aria-hidden="true">/</span>

src/components/SkillSecurityScanResults.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ describe("SecurityScanResults static guidance", () => {
434434
});
435435

436436
it("shows skills with legacy-only ClawScan analysis in the new ClawScan report shell", () => {
437-
render(
437+
const { container } = render(
438438
<SecurityScannerPage
439439
scanner="clawscan"
440440
entity={{
@@ -455,6 +455,7 @@ describe("SecurityScanResults static guidance", () => {
455455
expect(screen.getByRole("heading", { name: "Scan Metadata" })).toBeTruthy();
456456
expect(screen.queryByText("Review Dimensions")).toBeNull();
457457
expect(screen.queryByText("Purpose & Capability")).toBeNull();
458+
expect(container.querySelector('nav[aria-label="Breadcrumb"] a[href="/p/local"]')).toBeTruthy();
458459
});
459460

460461
it("shows the new ClawScan empty state when no analysis exists yet", () => {

src/routes/plugins/$name.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ export function PluginDetailPage({
603603
<nav className="skill-hero-breadcrumbs" aria-label="Plugin breadcrumbs">
604604
<a href="/plugins">plugins</a>
605605
<span aria-hidden="true">/</span>
606-
<a href={owner?.handle ? `/u/${encodeURIComponent(owner.handle)}` : "#"}>
606+
<a href={owner?.handle ? `/p/${encodeURIComponent(owner.handle)}` : "#"}>
607607
{owner?.handle ?? owner?.displayName ?? "unknown"}
608608
</a>
609609
<span aria-hidden="true">/</span>

0 commit comments

Comments
 (0)