components/buffer-list: show buffers with errors in red

This commit is contained in:
Simon Ser 2022-09-05 14:00:52 +02:00
parent 096fcbf829
commit a603b79e33
2 changed files with 13 additions and 1 deletions

View file

@ -1,6 +1,6 @@
import * as irc from "../lib/irc.js";
import { html, Component } from "../lib/index.js";
import { BufferType, Unread, getBufferURL, getServerName } from "../state.js";
import { BufferType, Unread, ServerStatus, getBufferURL, getServerName } from "../state.js";
function BufferItem(props) {
function handleClick(event) {
@ -26,6 +26,15 @@ function BufferItem(props) {
if (props.buffer.unread != Unread.NONE) {
classes.push("unread-" + props.buffer.unread);
}
if (props.buffer.type === BufferType.SERVER) {
let isError = props.server.status === ServerStatus.DISCONNECTED;
if (props.bouncerNetwork && props.bouncerNetwork.error) {
isError = true;
}
if (isError) {
classes.push("error");
}
}
return html`
<li class="${classes.join(" ")}">

View file

@ -158,6 +158,9 @@ button.danger:hover {
color: white;
background-color: var(--gray);
}
#buffer-list li.error a {
color: red;
}
#buffer-list li.unread-message a {
color: #b37400;
}