Pstee
Pstee
import { BarChart, Bar, XAxis, YAxis, Tooltip, PieChart, Pie, Cell } from
'recharts';
function Stats() {
const [playerPPG, setPlayerPPG] = useState([]);
const [gamesWonData, setGamesWonData] = useState([]);
useEffect(() => {
fetch('http://localhost:8000/api/stats')
.then((res) => res.json())
.then((data) => {
setPlayerPPG(data.playerPPG);
setGamesWonData(data.gamesWon);
})
.catch((error) => console.error('Error fetching stats:', error));
}, []);
return (
<div className="statsboard">
<h2>Rutgers Players PPG</h2>
<BarChart width={500} height={300} data={playerPPG}>
<XAxis dataKey="player" />
<YAxis />
<Tooltip />
<Bar dataKey="ppg" fill="#8884d8" />
</BarChart>
function Rewards() {
const [points, setPoints] = useState(0);
const [nextRewardThreshold, setNextRewardThreshold] = useState(100);
useEffect(() => {
// Example fetch for user points
fetch('http://localhost:8000/api/user-points')
.then((res) => res.json())
.then((data) => {
setPoints(data.points);
setNextRewardThreshold(data.nextRewardThreshold);
})
.catch((error) => console.error('Error fetching points:', error));
}, []);
const rewPercent = points / nextRewardThreshold;
return (
<div className="rewardsodo">
<h2>Rewards</h2>
<div className="rewardsm">
<GaugeChart
id="rewardsm"
nrOfLevels={20}
percent={rewPercent}
textColor="#000000"
colors={['#FF5F6D', '#FFC371']}
/>
</div>
<p>{nextRewardThreshold - points} points until your next reward!</p>
<div className="rewards-list">
<p>Possible Rewards:</p>
<ul>
<li>Priority Seating</li>
<li>Keychain</li>
<li>Rutgers Sticker</li>
</ul>
</div>
</div>
);
}