// What the links menu shows for one link, without a DOM: where it opens and // what it is called. Shared by the swarm UI (its `/api/links`) and the hive // dashboard (its stats and API docs pages, and the swarm UI). /** One entry of the links menu. */ export interface MenuLink { label: string; /** A glyph before the label; none leaves the label alone. */ icon?: string; url: string; /** * Opens in a new tab. Defaults to true: a link the menu was handed from * elsewhere (the swarm's service list) leaves the page. A page of the * same site says `false` and opens in place. */ external?: boolean; } /** The anchor attributes that make a link open where its entry says. */ export function linkAttrs(link: MenuLink): { target?: string; rel?: string; } { return link.external === false ? {} : { target: "_blank", rel: "noreferrer" }; }