2026-04-21 11:30:07 +02:00
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2026-04-19 09:25:58 +02:00
|
|
|
import { useMemo } from 'react';
|
2026-04-21 11:30:07 +02:00
|
|
|
import { StatRow } from './StatRow';
|
|
|
|
|
import { object } from 'prop-types';
|
2026-04-19 09:25:58 +02:00
|
|
|
|
2026-04-21 11:30:07 +02:00
|
|
|
export const BonusPoints = ({ game }) => {
|
2026-04-19 09:25:58 +02:00
|
|
|
const hasBonuspoints = useMemo(
|
|
|
|
|
() => 0 < game?.redBonusPoints
|
|
|
|
|
|| 0 < game?.blueBonusPoints
|
|
|
|
|
|| game?.redBonusStats?.blindHits
|
|
|
|
|
|| game?.blueBonusStats?.blindHits,
|
|
|
|
|
[
|
|
|
|
|
game?.blueBonusPoints,
|
|
|
|
|
game?.blueBonusStats?.blindHits,
|
|
|
|
|
game?.redBonusPoints,
|
|
|
|
|
game?.redBonusStats?.blindHits,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const hasRedNoBonuses = useMemo(
|
|
|
|
|
() => !game.redBonusStats?.blindHits
|
|
|
|
|
&& !game.redBonusStats?.chainBest
|
|
|
|
|
&& !game.redBonusStats?.edgeMines
|
|
|
|
|
&& !game.redBonusStats?.lastMineHits
|
|
|
|
|
&& !game.redBonusStats?.biggestReveal,
|
|
|
|
|
[
|
|
|
|
|
game.redBonusStats?.biggestReveal,
|
|
|
|
|
game.redBonusStats?.blindHits,
|
|
|
|
|
game.redBonusStats?.chainBest,
|
|
|
|
|
game.redBonusStats?.edgeMines,
|
|
|
|
|
game.redBonusStats?.lastMineHits,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const hasBlueNoBonuses = useMemo(
|
|
|
|
|
() => !game.blueBonusStats?.blindHits
|
|
|
|
|
&& !game.blueBonusStats?.chainBest
|
|
|
|
|
&& !game.blueBonusStats?.edgeMines
|
|
|
|
|
&& !game.blueBonusStats?.lastMineHits
|
|
|
|
|
&& !game.blueBonusStats?.biggestReveal,
|
|
|
|
|
[
|
|
|
|
|
game.blueBonusStats?.biggestReveal,
|
|
|
|
|
game.blueBonusStats?.blindHits,
|
|
|
|
|
game.blueBonusStats?.chainBest,
|
|
|
|
|
game.blueBonusStats?.edgeMines,
|
|
|
|
|
game.blueBonusStats?.lastMineHits,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
2026-04-21 11:30:07 +02:00
|
|
|
if (!hasBonuspoints) return '';
|
2026-04-19 09:25:58 +02:00
|
|
|
|
|
|
|
|
return (
|
2026-04-21 11:30:07 +02:00
|
|
|
<div className="bd-bonus">
|
|
|
|
|
<div className="bd-bonus__grid">
|
|
|
|
|
<div className="bd-bonus__column bd-bonus__column--red">
|
|
|
|
|
<span className="bd-bonus__heading">
|
|
|
|
|
<i className="fa fa-star" /> Red Bonus Statistics
|
2026-04-19 09:25:58 +02:00
|
|
|
</span>
|
2026-04-21 11:30:07 +02:00
|
|
|
<div className="bd-bonus__rows">
|
|
|
|
|
<StatRow icon="fa-star" label="Total Bonus Points" value={(game.redBonusPoints ?? 0).toFixed(1)} valueColor="#ffd700" />
|
|
|
|
|
{0 < game.redBonusStats?.blindHits && (
|
|
|
|
|
<StatRow icon="fa-bullseye" label="Blind hits" value={game.redBonusStats.blindHits} />
|
|
|
|
|
)}
|
|
|
|
|
{0 < game.redBonusStats?.chainBest && (
|
|
|
|
|
<StatRow icon="fa-link" label="Best chain" value={game.redBonusStats.chainBest} />
|
|
|
|
|
)}
|
|
|
|
|
{0 < game.redBonusStats?.edgeMines && (
|
|
|
|
|
<StatRow icon="fa-border-all" label="Edge mines" value={game.redBonusStats.edgeMines} />
|
|
|
|
|
)}
|
|
|
|
|
{0 < game.redBonusStats?.lastMineHits && (
|
|
|
|
|
<StatRow icon="fa-hourglass-end" label="Endgame mines" value={game.redBonusStats.lastMineHits} />
|
|
|
|
|
)}
|
|
|
|
|
{0 < game.redBonusStats?.biggestReveal && (
|
|
|
|
|
<StatRow icon="fa-expand" label="Biggest reveal" value={game.redBonusStats.biggestReveal} />
|
|
|
|
|
)}
|
|
|
|
|
{hasRedNoBonuses && (
|
|
|
|
|
<StatRow icon="fa-minus-circle" label="Status" value="No bonuses" valueColor="rgba(255,255,255,0.3)" />
|
|
|
|
|
)}
|
2026-04-19 09:25:58 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-04-21 11:30:07 +02:00
|
|
|
<div className="bd-bonus__column bd-bonus__column--blue">
|
|
|
|
|
<span className="bd-bonus__heading">
|
|
|
|
|
<i className="fa fa-star" /> Blue Bonus Statistics
|
2026-04-19 09:25:58 +02:00
|
|
|
</span>
|
2026-04-21 11:30:07 +02:00
|
|
|
<div className="bd-bonus__rows">
|
|
|
|
|
<StatRow icon="fa-star" label="Total Bonus Points" value={(game.blueBonusPoints ?? 0).toFixed(1)} valueColor="#ffd700" />
|
|
|
|
|
{0 < game.blueBonusStats?.blindHits && (
|
|
|
|
|
<StatRow icon="fa-bullseye" label="Blind hits" value={game.blueBonusStats.blindHits} />
|
|
|
|
|
)}
|
|
|
|
|
{0 < game.blueBonusStats?.chainBest && (
|
|
|
|
|
<StatRow icon="fa-link" label="Best chain" value={game.blueBonusStats.chainBest} />
|
|
|
|
|
)}
|
|
|
|
|
{0 < game.blueBonusStats?.edgeMines && (
|
|
|
|
|
<StatRow icon="fa-border-all" label="Edge mines" value={game.blueBonusStats.edgeMines} />
|
|
|
|
|
)}
|
|
|
|
|
{0 < game.blueBonusStats?.lastMineHits && (
|
|
|
|
|
<StatRow icon="fa-hourglass-end" label="Endgame mines" value={game.blueBonusStats.lastMineHits} />
|
|
|
|
|
)}
|
|
|
|
|
{0 < game.blueBonusStats?.biggestReveal && (
|
|
|
|
|
<StatRow icon="fa-expand" label="Biggest reveal" value={game.blueBonusStats.biggestReveal} />
|
|
|
|
|
)}
|
|
|
|
|
{hasBlueNoBonuses && (
|
|
|
|
|
<StatRow icon="fa-minus-circle" label="Status" value="No bonuses" valueColor="rgba(255,255,255,0.3)" />
|
|
|
|
|
)}
|
2026-04-19 09:25:58 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2026-04-21 11:30:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BonusPoints.propTypes = {
|
|
|
|
|
game: object.isRequired,
|
|
|
|
|
};
|