import React, { useState } from 'react'; import { Data } from "../../models/game"; import { Menu, Portal } from '@chakra-ui/react'; import GameThumbnail from "./GameThumbnail"; import { Box, useDisclosure } from "@chakra-ui/react"; import GameThumbnailSlide from "./GameThumbnailSlide"; import { playStatusValues } from "../../componentUtils/SelectValues"; import agent from "../../api/agent"; import { Link } from "react-router-dom"; interface Props { game: Data } const GameThumbnailContextMenu = ({ game }: Props) => { const { open: isOpen, onToggle } = useDisclosure() const [playState, setPlayState] = useState(game.accessedBy[0].playStatus) const gameLink = game.steamId.length > 1 ? game.steamId : game._id const rightClick = async (label: string, playStatus: string) => { try { setPlayState(playStatus) await agent.Games.playStatus(game._id, { accessedBy: [{ playStatus }] }) } catch (err) { console.error(`${label}: ${err}`) } } let mql = window.matchMedia('(max-width: 768px)'); return (