Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/components/home/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,29 +256,29 @@ const Home = () => {
<thead>
<tr>
<th
colSpan="6"
colSpan="5"
className={`text-center ${animPhase >= 4 ? 'anim-highscores-bounce' : 'anim-hidden'}`}
style={{ fontSize: '1.5rem', padding: '1rem' }}
>
High Scores
</th>
</tr>
<tr className={animPhase >= 4 ? 'anim-fade-in' : 'anim-hidden'}>
<th className="text-center">Rank</th>
<th className="text-center">#</th>
<th>Player</th>
<th className="text-center">Top Score</th>
<th className="text-center">Best Time</th>
<th className="text-center">Score</th>
<th className="text-center">Time</th>
<th className="text-center">Games</th>
<th className="text-center">Time Total</th>
{/* <th className="text-center">Total</th> */}
</tr>
</thead>
<tbody className={animPhase >= 3 ? '' : 'anim-hidden'}>
{leaderboard.map((player, index) => {
const rank = index + 1;
let medal = null;
if (rank === 1) medal = <span role="img" aria-label="gold medal">🥇 </span>;
else if (rank === 2) medal = <span role="img" aria-label="silver medal">🥈 </span>;
else if (rank === 3) medal = <span role="img" aria-label="bronze medal">🥉 </span>;
if (rank === 1) medal = <span role="img" aria-label="gold medal">🥇</span>;
else if (rank === 2) medal = <span role="img" aria-label="silver medal">🥈</span>;
else if (rank === 3) medal = <span role="img" aria-label="bronze medal">🥉</span>;

const isRevealed = revealedRows.includes(index);
const rowClass = animPhase >= 5
Expand All @@ -287,20 +287,20 @@ const Home = () => {

return (
<tr key={index} className={rowClass}>
<td className="text-center rank-cell">{medal}{rank}</td>
<td>{player.firstName}</td>
<td className="text-center rank-cell">{rank}</td>
<td>{medal}{player.firstName}</td>
<td className="text-center score-cell">{player.highScore}</td>
<td className="text-center time-cell">
{(() => {
const totalSeconds = player.bestTime;
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
const pad = (n) => String(n).padStart(2, '0');
return `${pad(minutes)}:${pad(seconds)}`;
return `${pad(minutes)}m ${pad(seconds)}s`;
})()}
</td>
<td className="text-center">{player.gamesTotal}</td>
<td className="text-center time-cell">
{/* <td className="text-center time-cell">
{(() => {
const totalSeconds = player.timeTotal;
const hours = Math.floor(totalSeconds / 3600);
Expand All @@ -309,7 +309,7 @@ const Home = () => {
const pad = (n) => String(n).padStart(2, '0');
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
})()}
</td>
</td> */}
</tr>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ body:has(.page-wrapper.animating) {
.leaderboard-table .rank-cell {
font-weight: 600;
font-size: 1.1rem;
min-width: 80px;
min-width: 20px;
}

.leaderboard-table .score-cell {
Expand Down