lib/irc: move over STD_MEMBERSHIP_NAMES

This commit is contained in:
Simon Ser 2024-09-07 12:36:13 +02:00
parent 9bcfd088c2
commit 301f133272
2 changed files with 11 additions and 11 deletions

View file

@ -1,21 +1,13 @@
import { html, Component } from "../lib/index.js";
// XXX: If we were feeling creative we could generate unique colors for
// each item in ISUPPORT CHANMODES. But I am not feeling creative.
const names = {
"~": "owner",
"&": "admin",
"@": "op",
"%": "halfop",
"+": "voice",
};
export default function Membership(props) {
if (!this.props.value) {
return null;
}
const name = names[this.props.value[0]] || "";
// XXX: If we were feeling creative we could generate unique colors for
// each item in ISUPPORT CHANMODES. But I am not feeling creative.
const name = irc.STD_MEMBERSHIP_NAMES[this.props.value[0]] || "";
return html`
<span class="membership ${name}" title=${name}>
${this.props.value}

View file

@ -77,6 +77,14 @@ export const ERR_SASLALREADY = "907";
export const STD_MEMBERSHIPS = "~&@%+";
export const STD_CHANTYPES = "#&+!";
export const STD_MEMBERSHIP_NAMES = {
"~": "owner",
"&": "admin",
"@": "operator",
"%": "halfop",
"+": "voice",
};
const tagEscapeMap = {
";": "\\:",
" ": "\\s",