the hive dashboard uses the swarm UI's links menu, beside the profile avatar
The links menu moves into @hive/shared and takes its links as a prop. The swarm UI feeds it /api/links as before; the dashboard feeds it stats, API docs and the swarm, and mounts it next to the profile menu in place of its own hamburger on the left. A link opens in a new tab unless its entry says it is a page of the same site.
This commit is contained in:
parent
b2e3b05198
commit
464b52004b
1 changed files with 192 additions and 239 deletions
23
frontend/packages/swarm-ui/test/links-menu.test.mjs
Normal file
23
frontend/packages/swarm-ui/test/links-menu.test.mjs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// How a link in the links menu opens. Run by `npm test`, which Node runs with
|
||||
// its built-in test runner and type stripping.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { linkAttrs } from "../../shared/src/links-menu/links.ts";
|
||||
|
||||
test("a link the menu was handed opens in a new tab, without a referrer", () => {
|
||||
assert.deepEqual(linkAttrs({ label: "forge", url: "https://forge.x" }), {
|
||||
target: "_blank",
|
||||
rel: "noreferrer",
|
||||
});
|
||||
assert.deepEqual(
|
||||
linkAttrs({ label: "forge", url: "https://forge.x", external: true }),
|
||||
{ target: "_blank", rel: "noreferrer" },
|
||||
);
|
||||
});
|
||||
|
||||
test("a page of the same site opens in place", () => {
|
||||
assert.deepEqual(
|
||||
linkAttrs({ label: "stats", url: "/stats.html", external: false }),
|
||||
{},
|
||||
);
|
||||
});
|
||||
Loading…
Reference in a new issue