mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-14 19:25:26 -05:00
Pretty-print buffer name in buffer header
This commit is contained in:
parent
6e16163103
commit
bc7162ebe2
3 changed files with 24 additions and 19 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { html, Component } from "../lib/index.js";
|
import { html, Component } from "../lib/index.js";
|
||||||
import linkify from "../lib/linkify.js";
|
import linkify from "../lib/linkify.js";
|
||||||
import { strip as stripANSI } from "../lib/ansi.js";
|
import { strip as stripANSI } from "../lib/ansi.js";
|
||||||
import { BufferType, NetworkStatus } from "../state.js";
|
import { BufferType, NetworkStatus, getNetworkName } from "../state.js";
|
||||||
|
|
||||||
const UserStatus = {
|
const UserStatus = {
|
||||||
HERE: "here",
|
HERE: "here",
|
||||||
|
@ -154,8 +154,13 @@ export default function BufferHeader(props) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var name = props.buffer.name;
|
||||||
|
if (props.buffer.type == BufferType.SERVER) {
|
||||||
|
name = getNetworkName(props.network, props.bouncerNetwork, props.isBouncer);
|
||||||
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<span class="title">${props.buffer.name}</span>
|
<span class="title">${name}</span>
|
||||||
<span class="description">${description}</span>
|
<span class="description">${description}</span>
|
||||||
<span class="actions">${actions}</span>
|
<span class="actions">${actions}</span>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -1,22 +1,6 @@
|
||||||
import * as irc from "../lib/irc.js";
|
import * as irc from "../lib/irc.js";
|
||||||
import { html, Component } from "../lib/index.js";
|
import { html, Component } from "../lib/index.js";
|
||||||
import { BufferType, Unread, getBufferURL } from "../state.js";
|
import { BufferType, Unread, getBufferURL, getNetworkName } from "../state.js";
|
||||||
|
|
||||||
function getNetworkName(network, bouncerNetwork, bouncer) {
|
|
||||||
if (bouncerNetwork && bouncerNetwork.name) {
|
|
||||||
return bouncerNetwork.name;
|
|
||||||
}
|
|
||||||
if (bouncer) {
|
|
||||||
return "bouncer";
|
|
||||||
}
|
|
||||||
|
|
||||||
var netName = network.isupport.get("NETWORK");
|
|
||||||
if (netName) {
|
|
||||||
return netName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "server";
|
|
||||||
}
|
|
||||||
|
|
||||||
function BufferItem(props) {
|
function BufferItem(props) {
|
||||||
function handleClick(event) {
|
function handleClick(event) {
|
||||||
|
|
16
state.js
16
state.js
|
@ -54,3 +54,19 @@ export function getMessageURL(buf, msg) {
|
||||||
return bufURL + "?timestamp=" + encodeURIComponent(msg.tags.time);
|
return bufURL + "?timestamp=" + encodeURIComponent(msg.tags.time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getNetworkName(network, bouncerNetwork, isBouncer) {
|
||||||
|
if (bouncerNetwork && bouncerNetwork.name) {
|
||||||
|
return bouncerNetwork.name;
|
||||||
|
}
|
||||||
|
if (isBouncer) {
|
||||||
|
return "bouncer";
|
||||||
|
}
|
||||||
|
|
||||||
|
var netName = network.isupport.get("NETWORK");
|
||||||
|
if (netName) {
|
||||||
|
return netName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "server";
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue