import styled from "@emotion/styled"; import { observer } from "mobx-react"; import React from "react"; import { LIGHT_PRIMARY_THREE } from "../../../shared/colors"; import { ID } from "../../../shared/types"; import { generateRandomColor } from "../../../shared/utils/utils"; import { CurrentUser_me } from "../../graphql/generated/types"; import { SlideshowStore } from "../../platform/SlideshowStore"; type Props = { mouseKey: ID; user: CurrentUser_me; store: SlideshowStore; container: React.RefObject; }; function Mouse(props: Props) { const color = generateRandomColor( props.store.mouseInfo.get(props.mouseKey)!.userId ); const userId = props.store.mouseInfo.get(props.mouseKey)!.userId; const name = props.user.team.users.find((user) => user.id === userId)?.name; return (
{name ? name : "A viewer"}
); } export default observer(Mouse); const Name = styled.div<{ color: string }>` color: ${LIGHT_PRIMARY_THREE}; font-size: 12px; background-color: ${(props) => props.color}; padding: 2px; font-weight: bold; z-index: 99999; pointer-events: none; `; const Svg = styled.svg` z-index: 99999; `;