League page stylization added

This commit is contained in:
Lucas Patenaude
2024-04-13 15:58:02 -06:00
parent 5644bd1b28
commit c35f242d27
3 changed files with 37 additions and 38 deletions

View File

@@ -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 */
}

View File

@@ -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
}
};

View File

@@ -1,24 +1,20 @@
<!-- pages/league.hbs -->
<div class="container" id="league-page-body">
<!-- Container for all league information (logo, name, country, etc. ) <- top 100px -->
<div class="container" id="league-information-container">
<img src="{{league.competition.league_emblem}}" alt="{{league.competition.league_name}} Emblem">
<h2>{{league.competition.league_name}}</h2>
</div>
<!-- Container to display all stats for league <- bottom rest of the container -->
<div class="container" id="league-stats-container">
<!-- Container to display league table <- split 50% -->
<div class="container" id="league-table-container">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>League Information</title>
</head>
<body>
<h1>League Information</h1>
<p>League ID: {{leagueID}}</p>
{{#if leagues}}
<ul>
{{#each leagues}}
<li>
<h2>{{competition.league_name}}</h2>
<img src="{{competition.league_emblem}}" alt="{{competition.league_name}} Emblem">
<h3>Standings</h3>
<ol>
{{#each standings}}
{{#each league.standings}}
<li>
<span>Position: {{table.league_position}}</span>
<span>Team Name: {{table.team_name}}</span>
@@ -26,11 +22,13 @@
</li>
{{/each}}
</ol>
</li>
{{/each}}
</ul>
{{else}}
<p>No league data available</p>
{{/if}}
</body>
</html>
</div>
<!-- Container to display top scorers for league <- Split 50% -->
<div class="container" id="top-scorers-container">
</div>
</div>
</div>