Skip to content

Commit

Permalink
ok finished
Browse files Browse the repository at this point in the history
  • Loading branch information
shimupan committed Dec 3, 2024
1 parent 6f5d5f6 commit 5070e4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Auth/Profile/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ class="friend-name"><?php echo htmlspecialchars($friend['username']); ?></a>
<tbody>
<?php while ($pred = $predictions->fetch_assoc()): ?>
<tr class="<?php echo $pred['points_earned'] >= 0 ? 'table-success' : 'table-danger'; ?> clickable-row"
onclick="window.location.href='../../Game/game.php?game_id=<?php echo $pred['game_id']; ?>'">
data-game-id="<?php echo $pred['game_id']; ?>"
onclick="window.location.href='/ITWS-2110-F24-WinShare/Game/game.php?game_id=<?php echo $pred['game_id']; ?>'">
<td><?php echo date('M j, Y', strtotime($pred['prediction_time'])); ?></td>
<td><?php echo htmlspecialchars($pred['home_team']) . " vs " . htmlspecialchars($pred['away_team']); ?></td>
<td><?php echo htmlspecialchars($pred['winner_name']); ?></td>
Expand Down
13 changes: 13 additions & 0 deletions Auth/Profile/src/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,29 @@ document.addEventListener('DOMContentLoaded', function() {
const init = () => {
animateStats();
initFriendSearch();

// Update the click handler for rows
document.querySelectorAll('.clickable-row').forEach(row => {
row.addEventListener('click', function(e) {
const gameId = this.getAttribute('onclick').match(/game_id=([^']+)/)[1];
if (gameId) {
window.location.href = `/ITWS-2110-F24-WinShare/Game/game.php?game_id=${gameId}`;
}
});
});
};

init();
initPendingRequests();

// Remove this section as we're handling clicks differently now
/*
document.querySelectorAll('.clickable-row').forEach(row => {
row.addEventListener('click', function() {
window.location.href = this.dataset.href;
});
});
*/
});

function initPendingRequests() {
Expand Down

0 comments on commit 5070e4d

Please sign in to comment.