"use strict"; export default function peer_name(peer) { const result = document.createElement("span"); result.classList.append(`peer-name`); result.dataset.peer_id = peer.id; result.dataset.peer_name = peer.name; const peer_name = document.createElement("span"); peer_name.appendChild(document.createTextNode(peer.name)); const peer_id = document.createElement("span"); peer_id.appendChild(document.createTextNode(peer.id)); // TODO: When the id is clicked, copy it to the clipboard - we may need a fancy tooltip library for this // text-overflow: ellipsis; may be useful here result.replaceChildren(peer_name, peer_id); return result; }