Keep track of client status in Client

This commit is contained in:
Simon Ser 2021-01-22 18:29:22 +01:00
parent 0261bc11e7
commit 41cd2153cf
4 changed files with 70 additions and 43 deletions

View file

@ -1,7 +1,7 @@
import { html, Component } from "/lib/index.js";
import linkify from "/lib/linkify.js";
import { strip as stripANSI } from "/lib/ansi.js";
import { BufferType, Status } from "/state.js";
import { BufferType, NetworkStatus } from "/state.js";
const UserStatus = {
HERE: "here",
@ -28,13 +28,16 @@ export default function BufferHeader(props) {
var description = null;
if (props.buffer.serverInfo) {
switch (props.network.status) {
case Status.DISCONNECTED:
case NetworkStatus.DISCONNECTED:
description = "Disconnected";
break;
case Status.CONNECTING:
case NetworkStatus.CONNECTING:
description = "Connecting...";
break;
case Status.REGISTERED:
case NetworkStatus.REGISTERING:
description = "Logging in...";
break;
case NetworkStatus.REGISTERED:
var serverInfo = props.buffer.serverInfo;
description = `Connected to ${serverInfo.name}`;
break;