mirror of
https://github.com/gabehf/Prittee.git
synced 2026-03-07 21:48:14 -08:00
Merge pull request #1 from Romejanic/main
Feat: Calculate total points from post list
This commit is contained in:
commit
69152263e8
1 changed files with 2 additions and 1 deletions
|
|
@ -37,6 +37,7 @@ export default function Profile() {
|
|||
{(value) => {
|
||||
let [ user, posts ] = value
|
||||
user = user.user
|
||||
const totalPoints = user.total_points > 0 ? user.total_points : posts.reduce((n, p) => n + p.points, 0);
|
||||
return(
|
||||
<Box className='flex flex-col items-center'>
|
||||
<Box className='flex flex-row justify-around items-center' width={480}>
|
||||
|
|
@ -45,7 +46,7 @@ export default function Profile() {
|
|||
</Box>
|
||||
<Box>
|
||||
<h2 className="text-2xl font-bold mb-2">{user.player_name}</h2>
|
||||
<p>Total Points: {user.total_points}</p>
|
||||
<p>Total Points: {totalPoints}</p>
|
||||
<p>Posts: {posts.length}</p>
|
||||
</Box>
|
||||
</Box>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue