mirror of https://github.com/waku-org/js-waku.git
Add network info in toolbar
This commit is contained in:
parent
53412e2fb4
commit
5c790a41c9
|
@ -160,6 +160,7 @@ export default function App() {
|
||||||
nick={nick}
|
nick={nick}
|
||||||
newMessages={newMessages}
|
newMessages={newMessages}
|
||||||
archivedMessages={archivedMessages}
|
archivedMessages={archivedMessages}
|
||||||
|
fleetEnv={fleetEnv}
|
||||||
commandHandler={(input: string) => {
|
commandHandler={(input: string) => {
|
||||||
const { command, response } = handleCommand(
|
const { command, response } = handleCommand(
|
||||||
input,
|
input,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ChatMessage, WakuMessage } from 'js-waku';
|
import { ChatMessage, Environment, WakuMessage } from 'js-waku';
|
||||||
import { ChatContentTopic } from './App';
|
import { ChatContentTopic } from './App';
|
||||||
import ChatList from './ChatList';
|
import ChatList from './ChatList';
|
||||||
import MessageInput from './MessageInput';
|
import MessageInput from './MessageInput';
|
||||||
|
@ -11,17 +11,28 @@ interface Props {
|
||||||
archivedMessages: Message[];
|
archivedMessages: Message[];
|
||||||
commandHandler: (cmd: string) => void;
|
commandHandler: (cmd: string) => void;
|
||||||
nick: string;
|
nick: string;
|
||||||
|
fleetEnv: Environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Room(props: Props) {
|
export default function Room(props: Props) {
|
||||||
const { waku } = useWaku();
|
const { waku } = useWaku();
|
||||||
|
|
||||||
|
let relayPeers = 0;
|
||||||
|
let storePeers = 0;
|
||||||
|
if (waku) {
|
||||||
|
relayPeers = waku.relay.getPeers().size;
|
||||||
|
storePeers = waku.store.peers.length;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="chat-container"
|
className="chat-container"
|
||||||
style={{ height: '98vh', display: 'flex', flexDirection: 'column' }}
|
style={{ height: '98vh', display: 'flex', flexDirection: 'column' }}
|
||||||
>
|
>
|
||||||
<TitleBar title="Waku v2 chat app" />
|
<TitleBar
|
||||||
|
leftIcons={`Peers: ${relayPeers} relay, ${storePeers} store. Fleet: ${props.fleetEnv}`}
|
||||||
|
title="Waku v2 chat app"
|
||||||
|
/>
|
||||||
<ChatList
|
<ChatList
|
||||||
newMessages={props.newMessages}
|
newMessages={props.newMessages}
|
||||||
archivedMessages={props.archivedMessages}
|
archivedMessages={props.archivedMessages}
|
||||||
|
|
Loading…
Reference in New Issue