Skip to content

Commit

Permalink
total hours
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Nov 2, 2024
1 parent 703f920 commit d33c459
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/userLookup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,18 @@ const UserPlaytime = (props: { id: number }) => {

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

const totalMinutes: number = playtimeData.reduce(
(currentValue, playtime) => playtime.totalMinutes + currentValue,
0
);

return (
<div className="flex flex-col gap-2 mt-2">
{totalMinutes > 0 && (
<div className="underline">
Total: {Math.round((totalMinutes / 60) * 100) / 100} hours
</div>
)}
{playtimeData
.sort((a, b) => b.totalMinutes - a.totalMinutes)
.map((playtime) => (
Expand Down

0 comments on commit d33c459

Please sign in to comment.