components/buffer: show realname as tooltip

This commit is contained in:
Simon Ser 2024-02-20 22:39:34 +01:00
parent a514104c55
commit 15cc546876

View file

@ -21,9 +21,19 @@ function Nick(props) {
props.onClick(); props.onClick();
} }
let title;
if (props.user && irc.isMeaningfulRealname(props.user.realname, props.nick)) {
title = stripANSI(props.user.realname);
}
let colorIndex = djb2(props.nick) % 16 + 1; let colorIndex = djb2(props.nick) % 16 + 1;
return html` return html`
<a href=${irc.formatURL({ entity: props.nick })} class="nick nick-${colorIndex}" onClick=${handleClick}>${props.nick}</a> <a
href=${irc.formatURL({ entity: props.nick })}
title=${title}
class="nick nick-${colorIndex}"
onClick=${handleClick}
>${props.nick}</a>
`; `;
} }
@ -98,7 +108,11 @@ class LogLine extends Component {
function createNick(nick) { function createNick(nick) {
return html` return html`
<${Nick} nick=${nick} onClick=${() => onNickClick(nick)}/> <${Nick}
nick=${nick}
user=${server.users.get(nick)}
onClick=${() => onNickClick(nick)}
/>
`; `;
} }
function createChannel(channel) { function createChannel(channel) {
@ -325,11 +339,16 @@ class FoldGroup extends Component {
render() { render() {
let msgs = this.props.messages; let msgs = this.props.messages;
let buf = this.props.buffer; let buf = this.props.buffer;
let server = this.props.server;
let onNickClick = this.props.onNickClick; let onNickClick = this.props.onNickClick;
function createNick(nick) { function createNick(nick) {
return html` return html`
<${Nick} nick=${nick} onClick=${() => onNickClick(nick)}/> <${Nick}
nick=${nick}
user=${server.users.get(nick)}
onClick=${() => onNickClick(nick)}
/>
`; `;
} }