Merge pull request #3608 from thelounge/richrd/channel-list-item-classes

Relocate not-secure and not-connected classes and make sure channel exists in jumpToChannel
This commit is contained in:
Pavel Djundik 2019-12-19 15:25:15 +02:00 committed by GitHub
commit f1eee6c9b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 12 deletions

View file

@ -8,6 +8,11 @@
{active: activeChannel && channel === activeChannel.channel},
{'parted-channel': channel.type === 'channel' && channel.state === 0},
{'has-draft': channel.pendingMessage},
{
'not-secure':
channel.type === 'lobby' && network.status.connected && !network.status.secure,
},
{'not-connected': channel.type === 'lobby' && !network.status.connected},
]"
:aria-label="getAriaLabel()"
:title="getAriaLabel()"

View file

@ -23,8 +23,6 @@
:key="network.uuid"
:class="{
collapsed: network.isCollapsed,
'not-connected': !network.status.connected,
'not-secure': !network.status.secure,
}"
class="network"
role="region"

View file

@ -729,22 +729,22 @@ background on hover (unless active) */
margin: 0 8px;
}
.network.not-secure .channel-list-item[data-type="lobby"] {
.channel-list-item.not-secure {
color: #f39c12;
}
.network.not-secure .channel-list-item[data-type="lobby"]:hover,
.network.not-secure .channel-list-item[data-type="lobby"].active {
.channel-list-item.not-secure:hover,
.channel-list-item.not-secure.active {
color: #f8c572;
}
.network.not-connected .channel-list-item[data-type="lobby"],
.channel-list-item.not-connected,
.channel-list-item.parted-channel {
color: #e74c3c;
}
.network.not-connected .channel-list-item[data-type="lobby"]:hover,
.network.not-connected .channel-list-item[data-type="lobby"].active,
.channel-list-item.not-connected:hover,
.channel-list-item.not-connected.active,
.channel-list-item.parted-channel:hover,
.channel-list-item.parted-channel.active {
color: #f1978e;

View file

@ -97,11 +97,13 @@ Mousetrap.bind(["alt+a"], function() {
function jumpToChannel(targetChannel) {
switchToChannel(targetChannel);
scrollIntoViewNicely(
document.querySelector(
`#sidebar .channel-list-item[aria-controls="#chan-${targetChannel.id}"]`
)
const element = document.querySelector(
`#sidebar .channel-list-item[aria-controls="#chan-${targetChannel.id}"]`
);
if (element) {
scrollIntoViewNicely(element);
}
}
// Ignored keys which should not automatically focus the input bar