League page stylization added
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#league-information-container {
|
#league-information-container {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
background-color: #f0f0f0; /* Example background color */
|
background-color: #f0f0f0; /* Example background color */
|
||||||
|
display: flex;
|
||||||
/* Add any other styling you need for the league information container */
|
/* Add any other styling you need for the league information container */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const fetchLeaguesData = async (req, res, next) => {
|
|||||||
const leagueData = response.data;
|
const leagueData = response.data;
|
||||||
|
|
||||||
// Attach the data to res.locals
|
// Attach the data to res.locals
|
||||||
res.locals.leagues = [{
|
res.locals.league = {
|
||||||
competition: {
|
competition: {
|
||||||
league_id: leagueData.competition.id,
|
league_id: leagueData.competition.id,
|
||||||
league_name: leagueData.competition.name,
|
league_name: leagueData.competition.name,
|
||||||
@@ -31,11 +31,11 @@ const fetchLeaguesData = async (req, res, next) => {
|
|||||||
team_crest: team.team.crest
|
team_crest: team.team.crest
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
}];
|
};
|
||||||
next();
|
next();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching leagues data:', 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
|
next(); // Call next middleware or route handler
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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>
|
<h3>Standings</h3>
|
||||||
<ol>
|
<ol>
|
||||||
{{#each standings}}
|
{{#each league.standings}}
|
||||||
<li>
|
<li>
|
||||||
<span>Position: {{table.league_position}}</span>
|
<span>Position: {{table.league_position}}</span>
|
||||||
<span>Team Name: {{table.team_name}}</span>
|
<span>Team Name: {{table.team_name}}</span>
|
||||||
@@ -26,11 +22,13 @@
|
|||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
|
||||||
{{/each}}
|
</div>
|
||||||
</ul>
|
|
||||||
{{else}}
|
<!-- Container to display top scorers for league <- Split 50% -->
|
||||||
<p>No league data available</p>
|
<div class="container" id="top-scorers-container">
|
||||||
{{/if}}
|
|
||||||
</body>
|
</div>
|
||||||
</html>
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user