Add message URLs, unify URL generation
This commit is contained in:
parent
36df984b09
commit
0d9f7f35f0
4 changed files with 31 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
|||
import { html, Component } from "/lib/index.js";
|
||||
import { BufferType, Unread } from "/state.js";
|
||||
import { BufferType, Unread, getBufferURL } from "/state.js";
|
||||
|
||||
function BufferItem(props) {
|
||||
function handleClick(event) {
|
||||
|
@ -19,22 +19,9 @@ function BufferItem(props) {
|
|||
unreadClass = "unread-" + props.buffer.unread;
|
||||
}
|
||||
|
||||
var url = "#";
|
||||
switch (props.buffer.type) {
|
||||
case BufferType.SERVER:
|
||||
url = "irc:///";
|
||||
break;
|
||||
case BufferType.CHANNEL:
|
||||
url = "irc:///" + encodeURIComponent(props.buffer.name);
|
||||
break;
|
||||
case BufferType.NICK:
|
||||
url = "irc:///" + encodeURIComponent(props.buffer.name) + ",isnick";
|
||||
break;
|
||||
}
|
||||
|
||||
return html`
|
||||
<li class="${activeClass} ${unreadClass}">
|
||||
<a href=${url} onClick=${handleClick}>${name}</a>
|
||||
<a href=${getBufferURL(props.buffer)} onClick=${handleClick}>${name}</a>
|
||||
</li>
|
||||
`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue