From 856edd6065e1a03202b40b02f34f2938a9f6aab1 Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Tue, 23 Apr 2024 20:53:03 -0600 Subject: [PATCH 1/5] Rough implementation of logos in navigation bar added --- ProjectSourceCode/src/index.js | 2 +- ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ProjectSourceCode/src/index.js b/ProjectSourceCode/src/index.js index 7894c9b..e04f54a 100644 --- a/ProjectSourceCode/src/index.js +++ b/ProjectSourceCode/src/index.js @@ -303,6 +303,7 @@ app.post('/favteam/add', async (req, res, next) => { return res.status(500).json({ error: 'Error adding favorite team' }); } }); + app.post('/favteam/remove', async (req, res) => { try { const { userID, teamID } = req.body; @@ -355,7 +356,6 @@ async function getFavoriteTeamsForUser(userId) { } } - // ***************************************************** // // ***************************************************** diff --git a/ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs b/ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs index 66404ef..e9c7058 100644 --- a/ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs +++ b/ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs @@ -41,6 +41,12 @@ +
+ {{#each fav_teams}} + + {{/each}} +
+
Your Image
From 6fdb1d5f741741aa6f8bc87c63203c6141031cae Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Tue, 23 Apr 2024 21:03:56 -0600 Subject: [PATCH 2/5] Logos in navigation bar implemented with stylesheet modifications --- .../css/navigation-bar/navigation-bar.css | 21 +++++++++++++++++++ .../src/views/partials/navigation-bar/nav.hbs | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ProjectSourceCode/src/resources/css/navigation-bar/navigation-bar.css b/ProjectSourceCode/src/resources/css/navigation-bar/navigation-bar.css index d87951c..505c36a 100644 --- a/ProjectSourceCode/src/resources/css/navigation-bar/navigation-bar.css +++ b/ProjectSourceCode/src/resources/css/navigation-bar/navigation-bar.css @@ -33,6 +33,27 @@ font-size: 30px; } +#favorite-teams-container { + margin-right: 25px; + + a { + text-decoration: none; + } + + img { + width: 28px; + height: auto; + margin: 0 4px; + cursor: pointer; + + transition: width 0.3s ease; /* Adding transition for smooth effect */ + } + + img:hover { + width: 32px; + } +} + #user { width: 25px; cursor: pointer; diff --git a/ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs b/ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs index e9c7058..3c222c6 100644 --- a/ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs +++ b/ProjectSourceCode/src/views/partials/navigation-bar/nav.hbs @@ -43,7 +43,9 @@
{{#each fav_teams}} - + + + {{/each}}
From 4d8a87ed5750355bd4f6ca3a74b994c7d68ab2e4 Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Tue, 23 Apr 2024 21:18:34 -0600 Subject: [PATCH 3/5] Links added to each team in live score cards --- .../scoreboard-header/game-card.css | 9 +++++++-- .../navigation-bar/current-match-information.js | 2 ++ .../scoreboard-header/game-card.hbs | 16 ++++++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ProjectSourceCode/src/resources/css/navigation-bar/scoreboard-header/game-card.css b/ProjectSourceCode/src/resources/css/navigation-bar/scoreboard-header/game-card.css index 111da45..f9452c2 100644 --- a/ProjectSourceCode/src/resources/css/navigation-bar/scoreboard-header/game-card.css +++ b/ProjectSourceCode/src/resources/css/navigation-bar/scoreboard-header/game-card.css @@ -13,7 +13,6 @@ overflow: hidden; /* Hide the overflowing skewed content */ transform: skewX(-20deg); /* Skew the banner to create a triangular side */ transition: transform 0.3s ease, box-shadow 0.3s ease; /* Transition for smooth transformation and box-shadow */ - cursor: pointer; /* Change cursor to pointer on hover */ transition: transform 0.4s ease; /* Add transition for smooth effect */ } @@ -61,11 +60,17 @@ /* Container for each team in card's information */ .team { - display: flex; /* Keeps all items in a row */ align-items: center; /* Center items vertically */ padding: 5px; } +.team a { + color: black; + display: flex; + text-decoration: none; + margin: 0; +} + .team p { margin: 0; /* Remove default margin */ diff --git a/ProjectSourceCode/src/resources/middleware/navigation-bar/current-match-information.js b/ProjectSourceCode/src/resources/middleware/navigation-bar/current-match-information.js index 251ac68..a57a137 100644 --- a/ProjectSourceCode/src/resources/middleware/navigation-bar/current-match-information.js +++ b/ProjectSourceCode/src/resources/middleware/navigation-bar/current-match-information.js @@ -35,10 +35,12 @@ const fetchMatchesData = async (req, res, next) => { // Extract relevant data from the API response const matches = response.data.matches.map(match => ({ homeTeam: { + teamID: match.homeTeam.id, name: match.homeTeam.tla, crest: match.homeTeam.crest, }, awayTeam: { + teamID: match.awayTeam.id, name: match.awayTeam.tla, crest: match.awayTeam.crest, }, diff --git a/ProjectSourceCode/src/views/partials/navigation-bar/scoreboard-header/game-card.hbs b/ProjectSourceCode/src/views/partials/navigation-bar/scoreboard-header/game-card.hbs index db34089..b078c07 100644 --- a/ProjectSourceCode/src/views/partials/navigation-bar/scoreboard-header/game-card.hbs +++ b/ProjectSourceCode/src/views/partials/navigation-bar/scoreboard-header/game-card.hbs @@ -6,15 +6,19 @@
- {{ homeTeam.name }} Crest -

{{ homeTeam.name }}

-

{{ score.homeScore }}

+ + {{ homeTeam.name }} Crest +

{{ homeTeam.name }}

+

{{ score.homeScore }}

+
- {{ awayTeam.name }} Crest -

{{ awayTeam.name }}

-

{{ score.awayScore }}

+ + {{ awayTeam.name }} Crest +

{{ awayTeam.name }}

+

{{ score.awayScore }}

+
From 66a91a662134671ce4f2613364fcb575fd900890 Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Tue, 23 Apr 2024 21:25:53 -0600 Subject: [PATCH 4/5] Fix to favorites button code so page is refreshed each time it's clicked --- .../resources/js/club-page/favorite-button.js | 31 +++++++++++-------- .../js/club-page/refresh-for-favorite.js | 0 .../src/views/partials/footer.hbs | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 ProjectSourceCode/src/resources/js/club-page/refresh-for-favorite.js diff --git a/ProjectSourceCode/src/resources/js/club-page/favorite-button.js b/ProjectSourceCode/src/resources/js/club-page/favorite-button.js index 5697a60..3d0651c 100644 --- a/ProjectSourceCode/src/resources/js/club-page/favorite-button.js +++ b/ProjectSourceCode/src/resources/js/club-page/favorite-button.js @@ -8,10 +8,9 @@ document.addEventListener("DOMContentLoaded", function() { var teamLogo = document.getElementById("teamLogo").value; if (favoriteButton.src.includes("/favorited.png")) { - removeFavoriteTeam(userID, teamID) - } - else { - addFavoriteTeam(userID, teamID, teamName, teamLogo) + removeFavoriteTeam(userID, teamID); + } else { + addFavoriteTeam(userID, teamID, teamName, teamLogo); } }); } @@ -35,16 +34,19 @@ async function addFavoriteTeam(userID, teamID, teamName, teamLogo){ if (!response.ok) { throw new Error('Failed to add favorite team'); } - //Changes button if favorite team is added// - console.log('New favorite team added successfully.'); - var favoriteButton = document.getElementById("club-favorite-button"); - favoriteButton.src = "/img/club-page/favorited.png"; + + if (response.status === 200) { + console.log('New favorite team added successfully.'); + var favoriteButton = document.getElementById("club-favorite-button"); + favoriteButton.src = "/img/club-page/favorited.png"; + location.reload(); // Refresh the page + } } catch (error) { console.error('Error adding favorite team:', error); - } } + async function removeFavoriteTeam(userID, teamID) { try { const response = await fetch('/favteam/remove', { @@ -57,10 +59,13 @@ async function removeFavoriteTeam(userID, teamID) { teamID: teamID }) }); - console.log('Favorite team removed successfully.'); - //Change button source// - var favoriteButton = document.getElementById("club-favorite-button"); - favoriteButton.src = "/img/club-page/unfavorited.png"; + + if (response.status === 200) { + console.log('Favorite team removed successfully.'); + var favoriteButton = document.getElementById("club-favorite-button"); + favoriteButton.src = "/img/club-page/unfavorited.png"; + location.reload(); // Refresh the page + } } catch (error) { console.error('Error removing favorite team:', error); diff --git a/ProjectSourceCode/src/resources/js/club-page/refresh-for-favorite.js b/ProjectSourceCode/src/resources/js/club-page/refresh-for-favorite.js new file mode 100644 index 0000000..e69de29 diff --git a/ProjectSourceCode/src/views/partials/footer.hbs b/ProjectSourceCode/src/views/partials/footer.hbs index dcdbd58..d652968 100644 --- a/ProjectSourceCode/src/views/partials/footer.hbs +++ b/ProjectSourceCode/src/views/partials/footer.hbs @@ -19,6 +19,6 @@ - + \ No newline at end of file From 48b378d184d6bd3555676cf912230100d416f305 Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Tue, 23 Apr 2024 21:34:15 -0600 Subject: [PATCH 5/5] Competition logos added --- .../css/generated-pages/club-pages/club-page-styling.css | 5 +++++ ProjectSourceCode/src/views/pages/clubs-page.hbs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ProjectSourceCode/src/resources/css/generated-pages/club-pages/club-page-styling.css b/ProjectSourceCode/src/resources/css/generated-pages/club-pages/club-page-styling.css index c421220..596d237 100644 --- a/ProjectSourceCode/src/resources/css/generated-pages/club-pages/club-page-styling.css +++ b/ProjectSourceCode/src/resources/css/generated-pages/club-pages/club-page-styling.css @@ -15,4 +15,9 @@ #club-favorite-button:hover { cursor: pointer; +} + +#competition-logo { + width: 60px; + margin-right: 10px; } \ No newline at end of file diff --git a/ProjectSourceCode/src/views/pages/clubs-page.hbs b/ProjectSourceCode/src/views/pages/clubs-page.hbs index ebb3aef..f5e1425 100644 --- a/ProjectSourceCode/src/views/pages/clubs-page.hbs +++ b/ProjectSourceCode/src/views/pages/clubs-page.hbs @@ -81,11 +81,13 @@ Name + {{#each club.runningCompetitions}} + {{name}} {{/each}}