From c35f242d27271e56446a7aef8665e7ffc1dcf8b3 Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Sat, 13 Apr 2024 15:58:02 -0600 Subject: [PATCH] League page stylization added --- .../resources/css/league-page/league-page.css | 1 + .../get-current-league-information.js | 6 +- .../src/views/pages/league-page.hbs | 68 +++++++++---------- 3 files changed, 37 insertions(+), 38 deletions(-) diff --git a/ProjectSourceCode/src/resources/css/league-page/league-page.css b/ProjectSourceCode/src/resources/css/league-page/league-page.css index 38a1182..9ab91a6 100644 --- a/ProjectSourceCode/src/resources/css/league-page/league-page.css +++ b/ProjectSourceCode/src/resources/css/league-page/league-page.css @@ -7,6 +7,7 @@ #league-information-container { height: 100px; background-color: #f0f0f0; /* Example background color */ + display: flex; /* Add any other styling you need for the league information container */ } diff --git a/ProjectSourceCode/src/resources/routes/league-pages/get-current-league-information.js b/ProjectSourceCode/src/resources/routes/league-pages/get-current-league-information.js index 3c5e1dc..5e2e20d 100644 --- a/ProjectSourceCode/src/resources/routes/league-pages/get-current-league-information.js +++ b/ProjectSourceCode/src/resources/routes/league-pages/get-current-league-information.js @@ -17,7 +17,7 @@ const fetchLeaguesData = async (req, res, next) => { const leagueData = response.data; // Attach the data to res.locals - res.locals.leagues = [{ + res.locals.league = { competition: { league_id: leagueData.competition.id, league_name: leagueData.competition.name, @@ -31,11 +31,11 @@ const fetchLeaguesData = async (req, res, next) => { team_crest: team.team.crest }, })), - }]; + }; next(); } catch (error) { console.error('Error fetching leagues data:', error); - res.locals.leagues = []; // Set an empty array if there's an error + res.locals.league = null; // Set to null if there's an error next(); // Call next middleware or route handler } }; diff --git a/ProjectSourceCode/src/views/pages/league-page.hbs b/ProjectSourceCode/src/views/pages/league-page.hbs index fe94979..f6f0eb1 100644 --- a/ProjectSourceCode/src/views/pages/league-page.hbs +++ b/ProjectSourceCode/src/views/pages/league-page.hbs @@ -1,36 +1,34 @@ - +
- - - - - - League Information - - -

League Information

-

League ID: {{leagueID}}

- {{#if leagues}} - - {{else}} -

No league data available

- {{/if}} - - + +
+ {{league.competition.league_name}} Emblem +

{{league.competition.league_name}}

+
+ + +
+ + +
+ +

Standings

+
    + {{#each league.standings}} +
  1. + Position: {{table.league_position}} + Team Name: {{table.team_name}} + {{table.team_name}} Crest +
  2. + {{/each}} +
+ +
+ + +
+ +
+ +
+
\ No newline at end of file