/** * This file is part of the SplendidBear Websites' projects. * * Copyright (c) 2026 @ www.splendidbear.org * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import React from 'react'; import { BarChart } from '@mui/x-charts/BarChart'; import { LineChart } from '@mui/x-charts/LineChart'; import { PieChart } from '@mui/x-charts/PieChart'; import { createTheme, ThemeProvider } from '@mui/material/styles'; import { shape, arrayOf, number, string } from 'prop-types'; const darkTheme = createTheme({ palette: { mode: 'dark', background: { paper: 'transparent' }, }, typography: { fontFamily: '\'Rajdhani\', sans-serif', }, }); const WIN_COLOR = '#5ee89a'; const LOSS_COLOR = '#f67d52'; const DRAW_COLOR = '#95cff5'; const MINES_COLOR = '#f67d52'; const BONUS_COLOR = '#ffd700'; const axisStyle = { tickLabelStyle: { fill: 'rgba(255,255,255,0.4)', fontSize: 11, fontFamily: '\'Rajdhani\', sans-serif' }, labelStyle: { fill: 'rgba(255,255,255,0.4)', fontSize: 11, fontFamily: '\'Rajdhani\', sans-serif' }, }; export default function ProfileCharts({ chartData }) { const { months, wins, losses, draws, pieWins, pieLosses, pieDraws, recentGames } = chartData; const total = pieWins + pieLosses + pieDraws; const hasBars = wins.some(v => 0 < v) || losses.some(v => 0 < v) || draws.some(v => 0 < v); const hasRecent = recentGames && (recentGames.mines?.some(v => 0 < v) || recentGames.bonus?.some(v => 0 < v)); return (
{0 < total && (

Result Breakdown

)} {hasBars && (

Activity (6 months)

)} {hasRecent && (

Last {recentGames.labels.length} games — mines & bonus

)}
); } ProfileCharts.propTypes = { chartData: shape({ months: arrayOf(string).isRequired, wins: arrayOf(number).isRequired, losses: arrayOf(number).isRequired, draws: arrayOf(number).isRequired, pieWins: number.isRequired, pieLosses: number.isRequired, pieDraws: number.isRequired, recentGames: shape({ labels: arrayOf(string).isRequired, mines: arrayOf(number).isRequired, bonus: arrayOf(number).isRequired, }).isRequired, }).isRequired, };