From cf7d0301d2ac7fb7f37c91fcf8f5aa8fd24c8038 Mon Sep 17 00:00:00 2001 From: Janis Date: Sun, 25 Jun 2023 21:48:14 +0200 Subject: [PATCH] [feature] show proper viewer --- src/App.tsx | 41 ------------------------- src/Viewer.tsx | 65 +++++++++++++++++++++++++++++++++++----- src/styles/Viewer.scss | 24 +++++++++++++++ src/styles/index.scss | 4 +++ src/teamspeak5Handler.ts | 5 +++- 5 files changed, 89 insertions(+), 50 deletions(-) create mode 100644 src/styles/Viewer.scss diff --git a/src/App.tsx b/src/App.tsx index ba792c2..d1b2617 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -50,7 +50,6 @@ export default function App() { return (
- {activeConnectionId} { @@ -61,46 +60,6 @@ export default function App() { } channel={currentChannel} /> -
-

Channels {channels.length}

- {channels.map((channel) => ( -
-

- - {channel.id} {channel.properties.name} - -

-
- {clients.map((client) => { - if (client.channel?.id === channel.id) { - return ( -

- {client.id} {client.properties.nickname} -

- ); - } - })} -
- ))} -
-
-

Clients {clients.length}

- {clients.map((client) => ( -
-

- {client.id} {client.properties.nickname} -

-
- ))} -
-
-

Connections {connections.length}

- {connections.map((connection) => ( -
-

{connection.id}

-
- ))} -
); } diff --git a/src/Viewer.tsx b/src/Viewer.tsx index d64726b..49bb374 100644 --- a/src/Viewer.tsx +++ b/src/Viewer.tsx @@ -1,4 +1,5 @@ import { IChannel, IClient } from "interfaces/teamspeak"; +import "@styles/Viewer.scss"; export default function Viewer({ clients, @@ -8,17 +9,65 @@ export default function Viewer({ channel: IChannel | undefined; }) { return ( -
-

{channel?.properties.name}

+
+

{channel?.properties.name}

{clients?.map((client) => { if (client) { return ( -

- {client.talkStatus === 1 ? "🎤" : ""} - {client.properties.inputMuted ? "🎤x" : ""} - {client.properties.outputMuted ? "🔈" : ""} - {client.id} {client.properties.nickname} -

+
+ {client.properties.outputMuted ? ( + + muted_output + + + + + + + + + ) : client.properties.inputMuted ? ( + + muted_input + + + + + ) : client.talkStatus == 1 ? ( + + player_on_v2 + + + + + ) : ( + + player_off_v2 + + + + + )} +

{client.properties.nickname}

+
); } else { return <>; diff --git a/src/styles/Viewer.scss b/src/styles/Viewer.scss new file mode 100644 index 0000000..0ea77d7 --- /dev/null +++ b/src/styles/Viewer.scss @@ -0,0 +1,24 @@ +.viewer { + display: flex; + flex-direction: column; + gap: 0 0; + h3 { + font-size: 1.3rem; + margin-bottom: 10px; + } + + .client { + display: flex; + height: 30px; + align-items: center; + gap: 0 10px; + + svg { + width: 23px; + height: 23px; + } + p { + font-size: 1rem; + } + } +} diff --git a/src/styles/index.scss b/src/styles/index.scss index e69de29..9c18e58 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -0,0 +1,4 @@ +* { + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; +} diff --git a/src/teamspeak5Handler.ts b/src/teamspeak5Handler.ts index f449de4..02c1256 100644 --- a/src/teamspeak5Handler.ts +++ b/src/teamspeak5Handler.ts @@ -434,7 +434,10 @@ class TS5MessageHandler { } handleClientSelfPropertyUpdatedMessage(data: IClientSelfPropertyUpdatedMessage) { console.log("handleClientSelfPropertyUpdated", data); - this.setActiveConnectionId(data.payload.connectionId); + + if (data.payload.flag == "inputHardware") { // sadly thats the only way to detect if a server is active or not + this.setActiveConnectionId(data.payload.connectionId); + } } handleServerPropertiesUpdatedMessage(data: IServerPropertiesUpdatedMessage) {