From 2db2f3f5e41651df1b11736037bcbbd4bd3df500 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Wed, 11 Mar 2020 22:48:27 +0100 Subject: [PATCH] Collab ui tweaks (#913) * decrease gap between menu icons * reduce margin of copy button * add collaboratorsCount to roomDialog toggle button --- src/components/App.tsx | 2 ++ src/components/LayerUI.tsx | 3 ++- src/components/MobileMenu.tsx | 1 + src/components/RoomDialog.scss | 15 ++++++++++++++- src/components/RoomDialog.tsx | 16 ++++++++++++---- src/components/ToolButton.tsx | 7 ++++++- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index cb8a41dc..2305488e 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -234,6 +234,8 @@ export class App extends React.Component { private destroySocketClient = () => { this.setState({ isCollaborating: false, + remotePointers: {}, + collaboratorCount: 0, }); if (this.socket) { this.socket.close(); diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index 58bfdcc1..e3efb0cc 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -109,13 +109,14 @@ export const LayerUI = React.memo(
- + {actionManager.renderAction("loadScene")} {actionManager.renderAction("saveScene")} {renderExportDialog()} {actionManager.renderAction("clearCanvas")} diff --git a/src/components/MobileMenu.tsx b/src/components/MobileMenu.tsx index 8dcf4b6f..2b28186f 100644 --- a/src/components/MobileMenu.tsx +++ b/src/components/MobileMenu.tsx @@ -47,6 +47,7 @@ export function MobileMenu({ {actionManager.renderAction("clearCanvas")} diff --git a/src/components/RoomDialog.scss b/src/components/RoomDialog.scss index 04a59c92..54cfdc89 100644 --- a/src/components/RoomDialog.scss +++ b/src/components/RoomDialog.scss @@ -3,6 +3,19 @@ color: #2b8a3e; // OC GREEN-9 } +.RoomDialog-modalButton-collaborators { + min-width: 1em; + position: absolute; + bottom: -5px; + right: -5px; + padding: 3px; + border-radius: 50%; + background-color: #40c057; // OC GREEN-6 + color: #fff; + font-size: 0.7em; + font-family: var(--ui-font); +} + .RoomDialog-linkContainer { display: flex; margin: 1.5em 0; @@ -11,7 +24,7 @@ .RoomDialog-link { min-width: 0; flex: 1 1 auto; - margin-left: 1.5em; + margin-left: 1em; display: inline-block; cursor: pointer; border: none; diff --git a/src/components/RoomDialog.tsx b/src/components/RoomDialog.tsx index c4392d1a..f4720f2d 100644 --- a/src/components/RoomDialog.tsx +++ b/src/components/RoomDialog.tsx @@ -5,9 +5,9 @@ import { t } from "../i18n"; import useIsMobile from "../is-mobile"; import { users, clipboard, start, stop } from "./icons"; import { Modal } from "./Modal"; - -import "./RoomDialog.scss"; import { copyTextToSystemClipboard } from "../clipboard"; +import { AppState } from "../types"; +import "./RoomDialog.scss"; function RoomModal({ onCloseRequest, @@ -111,10 +111,12 @@ function RoomModal({ export function RoomDialog({ isCollaborating, + collaboratorCount, onRoomCreate, onRoomDestroy, }: { - isCollaborating: boolean; + isCollaborating: AppState["isCollaborating"]; + collaboratorCount: AppState["collaboratorCount"]; onRoomCreate: () => void; onRoomDestroy: () => void; }) { @@ -145,7 +147,13 @@ export function RoomDialog({ aria-label={t("buttons.roomDialog")} showAriaLabel={useIsMobile()} ref={triggerButton} - /> + > + {collaboratorCount > 0 && ( +
+ {collaboratorCount} +
+ )} + {modalIsShown && ( {props["aria-label"]} )} + {props.children} ); }