import type React from "react"; import { ListItem, ListItemText, Typography, Box, useTheme, } from "@mui/material"; import { LoadedGame } from "@/types/game"; import TimeControlChip from "./timeControlChip"; import MovesNbChip from "./movesNbChip"; import DateChip from "./dateChip"; import GameResultChip from "./gameResultChip"; interface Props { game: LoadedGame; onClick?: () => void; perspectiveUserColor: "white" | "black"; } export const GameItem: React.FC = ({ game, onClick, perspectiveUserColor, }) => { const theme = useTheme(); const { white, black, result, timeControl, date, movesNb } = game; const whiteWon = result === "1-0"; const blackWon = result === "0-1"; return ( {formatPlayerName(white)} ({white.rating}) vs {formatPlayerName(black)} ({black.rating}) } secondary={ } sx={{ mr: 2 }} /> {/* { e.stopPropagation(); window.open(url, "_blank"); }} size="small" sx={{ color: theme.palette.primary.main, "&:hover": { backgroundColor: theme.palette.action.hover, transform: "scale(1.1)", }, transition: "all 0.2s ease-in-out", }} > */} ); }; const formatPlayerName = (player: LoadedGame["white"]) => { return player.title ? `${player.title} ${player.name}` : player.name; };