From d27b4d1cf394a408ca2e6a24ba031806dad92c58 Mon Sep 17 00:00:00 2001 From: Federico Ruggi <1081051+ruggi@users.noreply.github.com> Date: Fri, 19 Jan 2024 12:33:28 +0100 Subject: [PATCH] Follow mode colors, stop button, outline (#4770) * use followed user colors in toast * stop follow button * colored border in follow overlay * 4px --- .../canvas/multiplayer-presence.tsx | 96 ++++++++++++------- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/editor/src/components/canvas/multiplayer-presence.tsx b/editor/src/components/canvas/multiplayer-presence.tsx index 91621458a06c..76c2e0254c3c 100644 --- a/editor/src/components/canvas/multiplayer-presence.tsx +++ b/editor/src/components/canvas/multiplayer-presence.tsx @@ -1,5 +1,5 @@ import type { User } from '@liveblocks/client' -import { motion } from 'framer-motion' +import { AnimatePresence, motion } from 'framer-motion' import { useAtom, useSetAtom } from 'jotai' import React from 'react' import type { Presence, PresenceActiveFrame, UserMeta } from '../../../liveblocks.config' @@ -34,7 +34,7 @@ import { useIsOnSameRemixRoute, } from '../../core/shared/multiplayer' import { assertNever } from '../../core/shared/utils' -import { UtopiaStyles, useColorTheme } from '../../uuiui' +import { Button, UtopiaStyles, useColorTheme } from '../../uuiui' import { notice } from '../common/notice' import type { EditorAction } from '../editor/action-types' import { isLoggedIn } from '../editor/action-types' @@ -315,7 +315,6 @@ MultiplayerCursor.displayName = 'MultiplayerCursor' const remixRouteChangedToastId = 'follow-changed-scene' const FollowingOverlay = React.memo(() => { - const colorTheme = useColorTheme() const dispatch = useDispatch() const room = useRoom() @@ -418,37 +417,68 @@ const FollowingOverlay = React.memo(() => { } }) - if (followed == null || followedUser == null) { - return null - } + const stopFollowing = React.useCallback(() => { + dispatch([switchEditorMode(EditorModes.selectMode(null, false, 'none'))]) + }, [dispatch]) + + const followedUserColor = React.useMemo(() => { + return multiplayerColorFromIndex(followedUser?.colorIndex ?? null) + }, [followedUser]) + return ( -