From bb47924d92337c10d032e2d78f6920740b6e0dd8 Mon Sep 17 00:00:00 2001 From: HF Date: Tue, 4 Jan 2022 14:00:38 +0100 Subject: [PATCH] fix online counter parsing change styling of OnlineBox and CanvasSwitchButton --- src/components/OnlineBox.jsx | 55 +++++++++---------- src/components/buttons/CanvasSwitchButton.jsx | 5 +- src/socket/packets/OnlineCounter.js | 2 +- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/components/OnlineBox.jsx b/src/components/OnlineBox.jsx index 66f4a134..e870f7f1 100644 --- a/src/components/OnlineBox.jsx +++ b/src/components/OnlineBox.jsx @@ -31,36 +31,35 @@ const OnlineBox = () => { const onlineUsers = (onlineCanvas) ? online[canvasId] : online.total; return ( -
- {(onlineUsers || name) +
dispatch(toggleOnlineCanvas())} + > + {(onlineCanvas) ? ( -
dispatch(toggleOnlineCanvas())} + - {(onlineUsers) - && ( - - {onlineUsers} - - {(onlineCanvas) && } -   - - )} - {(name != null) - && ( - - {numberToString(totalPixels)} - - )} -
- ) : null} + {online[canvasId] || 0} + + ) + : ( + + {online.total} + + ) + } +   + {(name != null) + && ( + + {numberToString(totalPixels)} + + )}
); }; diff --git a/src/components/buttons/CanvasSwitchButton.jsx b/src/components/buttons/CanvasSwitchButton.jsx index 9464d25c..b8f7b31a 100644 --- a/src/components/buttons/CanvasSwitchButton.jsx +++ b/src/components/buttons/CanvasSwitchButton.jsx @@ -1,11 +1,10 @@ /** * - * @flow */ import React from 'react'; import { useDispatch } from 'react-redux'; -import { FaGlobe } from 'react-icons/fa'; +import { FaFlipboard } from 'react-icons/fa'; import { t } from 'ttag'; import { showCanvasSelectionModal } from '../../actions'; @@ -23,7 +22,7 @@ const CanvasSwitchButton = () => { title={t`Canvas Selection`} tabIndex={-1} > - +
); }; diff --git a/src/socket/packets/OnlineCounter.js b/src/socket/packets/OnlineCounter.js index c301a090..2f6cbf15 100644 --- a/src/socket/packets/OnlineCounter.js +++ b/src/socket/packets/OnlineCounter.js @@ -31,7 +31,7 @@ export default { dehydrate(online) { // SERVER (sender) if (!process.env.BROWSER) { - const canvasIds = Object.keys(online); + const canvasIds = Object.keys(online).filter((id) => id !== 'total'); const buffer = Buffer.allocUnsafe(3 + canvasIds.length * (1 + 2)); buffer.writeUInt8(OP_CODE, 0);