Skip to content

Commit d33c459

Browse files
committed
total hours
1 parent 703f920 commit d33c459

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/components/userLookup.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,18 @@ const UserPlaytime = (props: { id: number }) => {
507507

508508
if (!playtimeData) return "Loading...";
509509

510+
const totalMinutes: number = playtimeData.reduce(
511+
(currentValue, playtime) => playtime.totalMinutes + currentValue,
512+
0
513+
);
514+
510515
return (
511516
<div className="flex flex-col gap-2 mt-2">
517+
{totalMinutes > 0 && (
518+
<div className="underline">
519+
Total: {Math.round((totalMinutes / 60) * 100) / 100} hours
520+
</div>
521+
)}
512522
{playtimeData
513523
.sort((a, b) => b.totalMinutes - a.totalMinutes)
514524
.map((playtime) => (

0 commit comments

Comments
 (0)