mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-13 07:48:37 +01:00
Introduce buffer type
This commit is contained in:
parent
5f30662fc0
commit
6d3621e1be
@ -7,7 +7,9 @@ import Connect from "/components/connect.js";
|
|||||||
import Composer from "/components/composer.js";
|
import Composer from "/components/composer.js";
|
||||||
import ScrollManager from "/components/scroll-manager.js";
|
import ScrollManager from "/components/scroll-manager.js";
|
||||||
import { html, Component, createRef } from "/lib/index.js";
|
import { html, Component, createRef } from "/lib/index.js";
|
||||||
import { SERVER_BUFFER, Status, Unread } from "/state.js";
|
import { BufferType, Status, Unread } from "/state.js";
|
||||||
|
|
||||||
|
const SERVER_BUFFER = "*";
|
||||||
|
|
||||||
function parseQueryString() {
|
function parseQueryString() {
|
||||||
var query = window.location.search.substring(1);
|
var query = window.location.search.substring(1);
|
||||||
@ -107,9 +109,19 @@ export default class App extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var type;
|
||||||
|
if (name == SERVER_BUFFER) {
|
||||||
|
type = BufferType.SERVER;
|
||||||
|
} else if (this.isChannel(name)) {
|
||||||
|
type = BufferType.CHANNEL;
|
||||||
|
} else {
|
||||||
|
type = BufferType.NICK;
|
||||||
|
}
|
||||||
|
|
||||||
var buffers = new Map(state.buffers);
|
var buffers = new Map(state.buffers);
|
||||||
buffers.set(name, {
|
buffers.set(name, {
|
||||||
name: name,
|
name,
|
||||||
|
type,
|
||||||
topic: null,
|
topic: null,
|
||||||
members: new Map(),
|
members: new Map(),
|
||||||
messages: [],
|
messages: [],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { html, Component } from "/lib/index.js";
|
import { html, Component } from "/lib/index.js";
|
||||||
import { SERVER_BUFFER, Unread } from "/state.js";
|
import { BufferType, Unread } from "/state.js";
|
||||||
|
|
||||||
function BufferItem(props) {
|
function BufferItem(props) {
|
||||||
function handleClick(event) {
|
function handleClick(event) {
|
||||||
@ -8,7 +8,7 @@ function BufferItem(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var name = props.buffer.name;
|
var name = props.buffer.name;
|
||||||
if (name == SERVER_BUFFER) {
|
if (props.buffer.type == BufferType.SERVER) {
|
||||||
name = "server";
|
name = "server";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user