Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eco_project/backend/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ <h2>Community</h2>
<li><a href="camera.html">Publish Videos/Photos</a></li>
<li><a href="forest_seeds.html">Forest Seeds Promotion</a></li>
<li><a href="chat.html">Join the Chat</a></li>
<li><a href="sports.html">Watch Sports</a></li>
</ul>
</section>
<section id="ai-agent">
Expand Down
11 changes: 11 additions & 0 deletions eco_project/backend/static/sports.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#channel-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}

.channel {
border: 1px solid #ccc;
padding: 15px;
border-radius: 5px;
}
30 changes: 30 additions & 0 deletions eco_project/backend/static/sports.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sports - Environment Protection</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="sports.css">
</head>
<body>
<header>
<h1>Sports TV</h1>
<nav>
<a href="index.html">Home</a>
</nav>
</header>
<main>
<section id="sports-channels">
<h2>Leagues</h2>
<div id="channel-container">
<!-- Channel content will go here -->
</div>
</section>
</main>
<footer>
<p>&copy; 2025 Environment Protection Initiative</p>
</footer>
<script src="sports.js"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions eco_project/backend/static/sports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
document.addEventListener('DOMContentLoaded', () => {
const channelContainer = document.getElementById('channel-container');

fetch('https://www.thesportsdb.com/api/v1/json/123/all_leagues.php')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
if (!data.leagues || data.leagues.length === 0) {
channelContainer.innerHTML = '<p>No leagues found.</p>';
return;
}
data.leagues.forEach(league => {
const leagueElement = document.createElement('div');
leagueElement.classList.add('channel');
leagueElement.innerHTML = `
<h3>${league.strLeague}</h3>
<p><strong>Sport:</strong> ${league.strSport}</p>
`;
channelContainer.appendChild(leagueElement);
});
})
.catch(error => {
console.error('There has been a problem with your fetch operation:', error);
channelContainer.innerHTML = '<p>Could not fetch league data. Please try again later.</p>';
});
});
Loading