Watch
0
0
Fork
You've already forked hyperhive
0

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:
iris 2026-11-01 12:12:38 +01:00 • committed by mara
commit 464b52004b

View 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 }),
{},
);
});