import { getClientColor } from "../clients"; import { Avatar } from "../components/Avatar"; import type { GoToCollaboratorComponentProps } from "../components/UserList"; import { eyeIcon, microphoneIcon, microphoneMutedIcon, } from "../components/icons"; import { t } from "../i18n"; import { StoreAction } from "../store"; import type { Collaborator } from "../types"; import { register } from "./register"; import clsx from "clsx"; export const actionGoToCollaborator = register({ name: "goToCollaborator", label: "Go to a collaborator", viewMode: true, trackEvent: { category: "collab" }, perform: (_elements, appState, collaborator: Collaborator) => { if ( !collaborator.socketId || appState.userToFollow?.socketId === collaborator.socketId || collaborator.isCurrentUser ) { return { appState: { ...appState, userToFollow: null, }, storeAction: StoreAction.NONE, }; } return { appState: { ...appState, userToFollow: { socketId: collaborator.socketId, username: collaborator.username || "", }, // Close mobile menu openMenu: appState.openMenu === "canvas" ? null : appState.openMenu, }, storeAction: StoreAction.NONE, }; }, PanelComponent: ({ updateData, data, appState }) => { const { socketId, collaborator, withName, isBeingFollowed } = data as GoToCollaboratorComponentProps; const background = getClientColor(socketId, collaborator); const statusClassNames = clsx({ "is-followed": isBeingFollowed, "is-current-user": collaborator.isCurrentUser === true, "is-speaking": collaborator.isSpeaking, "is-in-call": collaborator.isInCall, "is-muted": collaborator.isMuted, }); const statusIconJSX = collaborator.isInCall ? ( collaborator.isSpeaking ? (