Collab ui tweaks (#913)
* decrease gap between menu icons * reduce margin of copy button * add collaboratorsCount to roomDialog toggle button
This commit is contained in:
parent
b82b0754ac
commit
2db2f3f5e4
@ -234,6 +234,8 @@ export class App extends React.Component<any, AppState> {
|
|||||||
private destroySocketClient = () => {
|
private destroySocketClient = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isCollaborating: false,
|
isCollaborating: false,
|
||||||
|
remotePointers: {},
|
||||||
|
collaboratorCount: 0,
|
||||||
});
|
});
|
||||||
if (this.socket) {
|
if (this.socket) {
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
|
@ -109,13 +109,14 @@ export const LayerUI = React.memo(
|
|||||||
<Section className="App-right-menu" heading="canvasActions">
|
<Section className="App-right-menu" heading="canvasActions">
|
||||||
<Island padding={4}>
|
<Island padding={4}>
|
||||||
<Stack.Col gap={4}>
|
<Stack.Col gap={4}>
|
||||||
<Stack.Row gap={2.25} justifyContent={"space-between"}>
|
<Stack.Row gap={1} justifyContent={"space-between"}>
|
||||||
{actionManager.renderAction("loadScene")}
|
{actionManager.renderAction("loadScene")}
|
||||||
{actionManager.renderAction("saveScene")}
|
{actionManager.renderAction("saveScene")}
|
||||||
{renderExportDialog()}
|
{renderExportDialog()}
|
||||||
{actionManager.renderAction("clearCanvas")}
|
{actionManager.renderAction("clearCanvas")}
|
||||||
<RoomDialog
|
<RoomDialog
|
||||||
isCollaborating={appState.isCollaborating}
|
isCollaborating={appState.isCollaborating}
|
||||||
|
collaboratorCount={appState.collaboratorCount}
|
||||||
onRoomCreate={onRoomCreate}
|
onRoomCreate={onRoomCreate}
|
||||||
onRoomDestroy={onRoomDestroy}
|
onRoomDestroy={onRoomDestroy}
|
||||||
/>
|
/>
|
||||||
|
@ -47,6 +47,7 @@ export function MobileMenu({
|
|||||||
{actionManager.renderAction("clearCanvas")}
|
{actionManager.renderAction("clearCanvas")}
|
||||||
<RoomDialog
|
<RoomDialog
|
||||||
isCollaborating={appState.isCollaborating}
|
isCollaborating={appState.isCollaborating}
|
||||||
|
collaboratorCount={appState.collaboratorCount}
|
||||||
onRoomCreate={onRoomCreate}
|
onRoomCreate={onRoomCreate}
|
||||||
onRoomDestroy={onRoomDestroy}
|
onRoomDestroy={onRoomDestroy}
|
||||||
/>
|
/>
|
||||||
|
@ -3,6 +3,19 @@
|
|||||||
color: #2b8a3e; // OC GREEN-9
|
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 {
|
.RoomDialog-linkContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 1.5em 0;
|
margin: 1.5em 0;
|
||||||
@ -11,7 +24,7 @@
|
|||||||
.RoomDialog-link {
|
.RoomDialog-link {
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
margin-left: 1.5em;
|
margin-left: 1em;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -5,9 +5,9 @@ import { t } from "../i18n";
|
|||||||
import useIsMobile from "../is-mobile";
|
import useIsMobile from "../is-mobile";
|
||||||
import { users, clipboard, start, stop } from "./icons";
|
import { users, clipboard, start, stop } from "./icons";
|
||||||
import { Modal } from "./Modal";
|
import { Modal } from "./Modal";
|
||||||
|
|
||||||
import "./RoomDialog.scss";
|
|
||||||
import { copyTextToSystemClipboard } from "../clipboard";
|
import { copyTextToSystemClipboard } from "../clipboard";
|
||||||
|
import { AppState } from "../types";
|
||||||
|
import "./RoomDialog.scss";
|
||||||
|
|
||||||
function RoomModal({
|
function RoomModal({
|
||||||
onCloseRequest,
|
onCloseRequest,
|
||||||
@ -111,10 +111,12 @@ function RoomModal({
|
|||||||
|
|
||||||
export function RoomDialog({
|
export function RoomDialog({
|
||||||
isCollaborating,
|
isCollaborating,
|
||||||
|
collaboratorCount,
|
||||||
onRoomCreate,
|
onRoomCreate,
|
||||||
onRoomDestroy,
|
onRoomDestroy,
|
||||||
}: {
|
}: {
|
||||||
isCollaborating: boolean;
|
isCollaborating: AppState["isCollaborating"];
|
||||||
|
collaboratorCount: AppState["collaboratorCount"];
|
||||||
onRoomCreate: () => void;
|
onRoomCreate: () => void;
|
||||||
onRoomDestroy: () => void;
|
onRoomDestroy: () => void;
|
||||||
}) {
|
}) {
|
||||||
@ -145,7 +147,13 @@ export function RoomDialog({
|
|||||||
aria-label={t("buttons.roomDialog")}
|
aria-label={t("buttons.roomDialog")}
|
||||||
showAriaLabel={useIsMobile()}
|
showAriaLabel={useIsMobile()}
|
||||||
ref={triggerButton}
|
ref={triggerButton}
|
||||||
/>
|
>
|
||||||
|
{collaboratorCount > 0 && (
|
||||||
|
<div className="RoomDialog-modalButton-collaborators">
|
||||||
|
{collaboratorCount}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</ToolButton>
|
||||||
{modalIsShown && (
|
{modalIsShown && (
|
||||||
<Modal
|
<Modal
|
||||||
maxWidth={800}
|
maxWidth={800}
|
||||||
|
@ -21,7 +21,11 @@ type ToolButtonBaseProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type ToolButtonProps =
|
type ToolButtonProps =
|
||||||
| (ToolButtonBaseProps & { type: "button"; onClick?(): void })
|
| (ToolButtonBaseProps & {
|
||||||
|
type: "button";
|
||||||
|
children?: React.ReactNode;
|
||||||
|
onClick?(): void;
|
||||||
|
})
|
||||||
| (ToolButtonBaseProps & {
|
| (ToolButtonBaseProps & {
|
||||||
type: "radio";
|
type: "radio";
|
||||||
|
|
||||||
@ -61,6 +65,7 @@ export const ToolButton = React.forwardRef(function(
|
|||||||
{props.showAriaLabel && (
|
{props.showAriaLabel && (
|
||||||
<div className="ToolIcon__label">{props["aria-label"]}</div>
|
<div className="ToolIcon__label">{props["aria-label"]}</div>
|
||||||
)}
|
)}
|
||||||
|
{props.children}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user