edusphere-navigator / subject.html
tokey4's picture
make the website much better
41650cf verified
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Subject Details - EduSphere Navigator</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://www.youtube.com/iframe_api"></script>
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
primary: {
50: '#f0f9ff',
100: '#e0f2fe',
200: '#bae6fd',
300: '#7dd3fc',
400: '#38bdf8',
500: '#0ea5e9',
600: '#0284c7',
700: '#0369a1',
800: '#075985',
900: '#0c4a6e',
},
secondary: {
50: '#fdf4ff',
100: '#fae8ff',
200: '#f5d0fe',
300: '#f0abfc',
400: '#e879f9',
500: '#d946ef',
600: '#c026d3',
700: '#a21caf',
800: '#86198f',
900: '#701a75',
}
}
}
}
}
</script>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
<custom-navbar></custom-navbar>
<main class="container mx-auto px-4 py-8">
<!-- Breadcrumb -->
<nav class="flex mb-8" aria-label="Breadcrumb">
<ol class="inline-flex items-center space-x-1 md:space-x-3">
<li class="inline-flex items-center">
<a href="index.html" class="inline-flex items-center text-sm text-gray-400 hover:text-white">
<i data-feather="home" class="w-4 h-4 mr-2"></i>
Home
</a>
</li>
<li>
<div class="flex items-center">
<i data-feather="chevron-right" class="w-4 h-4 text-gray-600"></i>
<a href="#" class="ml-1 text-sm font-medium text-gray-400 hover:text-white md:ml-2">Subjects</a>
</div>
</li>
<li aria-current="page">
<div class="flex items-center">
<i data-feather="chevron-right" class="w-4 h-4 text-gray-600"></i>
<span class="ml-1 text-sm font-medium text-primary-400 md:ml-2" id="subject-title">Loading...</span>
</div>
</li>
</ol>
</nav>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Left Column - Video Player & Chapters -->
<div class="lg:col-span-2 space-y-8">
<!-- Video Player -->
<div class="glass rounded-2xl overflow-hidden">
<div class="p-4 border-b border-gray-800">
<h2 class="text-xl font-bold" id="chapter-title">Select a Chapter</h2>
<p class="text-gray-400 text-sm" id="video-duration">--:--</p>
</div>
<div class="aspect-video bg-black" id="video-player">
<div class="w-full h-full flex items-center justify-center">
<div class="text-center">
<i data-feather="play-circle" class="w-16 h-16 text-gray-600 mx-auto mb-4"></i>
<p class="text-gray-400">Select a chapter to start watching</p>
</div>
</div>
</div>
<div class="p-4 border-t border-gray-800">
<div class="flex justify-between items-center">
<div class="flex gap-2">
<button class="px-4 py-2 bg-primary-600 hover:bg-primary-700 rounded-lg flex items-center gap-2" id="play-btn">
<i data-feather="play" class="w-4 h-4"></i>
Play
</button>
<button class="px-4 py-2 bg-gray-800 hover:bg-gray-700 rounded-lg flex items-center gap-2">
<i data-feather="download" class="w-4 h-4"></i>
Download
</button>
</div>
<div class="flex items-center gap-4">
<button class="p-2 hover:bg-gray-800 rounded-lg">
<i data-feather="thumbs-up"></i>
</button>
<button class="p-2 hover:bg-gray-800 rounded-lg">
<i data-feather="share-2"></i>
</button>
<button class="p-2 hover:bg-gray-800 rounded-lg">
<i data-feather="bookmark"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Chapter List -->
<div class="glass rounded-2xl p-6">
<h2 class="text-2xl font-bold mb-6">Course Chapters</h2>
<div class="space-y-4" id="chapters-list">
<!-- Chapters will be populated by JavaScript -->
</div>
</div>
</div>
<!-- Right Column - Subject Info & Resources -->
<div class="space-y-8">
<!-- Subject Info Card -->
<div class="glass rounded-2xl p-6">
<div class="flex items-center gap-4 mb-6">
<div class="w-16 h-16 rounded-xl bg-gradient-to-br from-primary-500 to-cyan-500 flex items-center justify-center" id="subject-icon">
<i data-feather="book" class="w-8 h-8"></i>
</div>
<div>
<h1 class="text-2xl font-bold" id="subject-name">Subject Name</h1>
<p class="text-gray-400" id="subject-description">Loading description...</p>
</div>
</div>
<div class="space-y-4">
<div>
<div class="flex justify-between text-sm mb-1">
<span>Overall Progress</span>
<span class="font-semibold" id="progress-percent">0%</span>
</div>
<div class="h-2 bg-gray-800 rounded-full overflow-hidden">
<div class="h-full bg-gradient-to-r from-primary-500 to-cyan-500 rounded-full" id="progress-bar"></div>
</div>
</div>
<div class="grid grid-cols-2 gap-4 pt-4 border-t border-gray-800">
<div class="text-center p-3 bg-gray-800/50 rounded-lg">
<div class="text-2xl font-bold" id="chapters-count">0</div>
<div class="text-sm text-gray-400">Chapters</div>
</div>
<div class="text-center p-3 bg-gray-800/50 rounded-lg">
<div class="text-2xl font-bold" id="lessons-count">0</div>
<div class="text-sm text-gray-400">Lessons</div>
</div>
</div>
</div>
</div>
<!-- Resources -->
<div class="glass rounded-2xl p-6">
<h3 class="text-xl font-bold mb-4">Learning Resources</h3>
<div class="space-y-3">
<a href="#" class="flex items-center gap-3 p-3 bg-gray-800/50 rounded-lg hover:bg-gray-800 transition-colors">
<i data-feather="file-text" class="w-5 h-5 text-primary-400"></i>
<span>Course Syllabus (PDF)</span>
</a>
<a href="#" class="flex items-center gap-3 p-3 bg-gray-800/50 rounded-lg hover:bg-gray-800 transition-colors">
<i data-feather="codesandbox" class="w-5 h-5 text-secondary-400"></i>
<span>Practice Exercises</span>
</a>
<a href="#" class="flex items-center gap-3 p-3 bg-gray-800/50 rounded-lg hover:bg-gray-800 transition-colors">
<i data-feather="clipboard" class="w-5 h-5 text-green-400"></i>
<span>Sample Questions</span>
</a>
<a href="#" class="flex items-center gap-3 p-3 bg-gray-800/50 rounded-lg hover:bg-gray-800 transition-colors">
<i data-feather="download-cloud" class="w-5 h-5 text-yellow-400"></i>
<span>Download All Materials</span>
</a>
</div>
</div>
<!-- Instructor -->
<div class="glass rounded-2xl p-6">
<h3 class="text-xl font-bold mb-4">Instructor</h3>
<div class="flex items-center gap-3">
<img src="http://static.photos/people/200x200/1" alt="Instructor" class="w-12 h-12 rounded-full">
<div>
<div class="font-semibold">Dr. Sarah Johnson</div>
<div class="text-sm text-gray-400">Professor of Computer Science</div>
</div>
</div>
<p class="mt-4 text-gray-400 text-sm">
With over 15 years of teaching experience and multiple awards in educational technology.
</p>
</div>
</div>
</div>
</main>
<custom-footer></custom-footer>
<!-- Components -->
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<!-- Subject Page Script -->
<script>
document.addEventListener('DOMContentLoaded', function() {
// Get subject from URL
const urlParams = new URLSearchParams(window.location.search);
const subjectName = urlParams.get('subject');
const subjectsData = window.subjectsData || {};
if (!subjectName || !subjectsData[subjectName]) {
window.location.href = 'index.html';
return;
}
const subject = subjectsData[subjectName];
// Update page title and subject info
document.title = `${subjectName} - EduSphere Navigator`;
document.getElementById('subject-title').textContent = subjectName;
document.getElementById('subject-name').textContent = subjectName;
document.getElementById('subject-description').textContent = subject.description;
document.getElementById('progress-percent').textContent = `${subject.progress}%`;
document.getElementById('progress-bar').style.width = `${subject.progress}%`;
// Update icon and color
const iconDiv = document.getElementById('subject-icon');
if (subject.icon && subject.color) {
iconDiv.innerHTML = `<i data-feather="${subject.icon}" class="w-8 h-8"></i>`;
iconDiv.className = `w-16 h-16 rounded-xl ${subject.color} bg-gradient-to-br flex items-center justify-center`;
}
// Update counts
const chaptersCount = Object.keys(subject.chapters).length;
const lessonsCount = subject.totalLessons || 0;
document.getElementById('chapters-count').textContent = chaptersCount;
document.getElementById('lessons-count').textContent = lessonsCount;
// Populate chapters
const chaptersList = document.getElementById('chapters-list');
chaptersList.innerHTML = '';
Object.entries(subject.chapters).forEach(([chapterName, chapterData], index) => {
const chapterElement = document.createElement('div');
chapterElement.className = 'border border-gray-800 rounded-xl overflow-hidden hover:border-primary-500 transition-colors';
chapterElement.innerHTML = `
<div class="p-4 cursor-pointer" data-chapter="${index}">
<div class="flex justify-between items-center">
<div>
<h3 class="font-semibold">${chapterName}</h3>
<p class="text-sm text-gray-400 mt-1">${chapterData.topics.length} topics • ${chapterData.duration || '--:--'}</p>
</div>
<div class="flex items-center gap-2">
<span class="px-2 py-1 bg-primary-500/20 text-primary-400 text-xs rounded">Chapter ${index + 1}</span>
<i data-feather="chevron-right" class="w-5 h-5 text-gray-500"></i>
</div>
</div>
<div class="mt-3 space-y-2 hidden" id="topics-${index}">
${chapterData.topics.map(topic => `
<div class="flex items-center gap-2 text-sm text-gray-400 pl-4">
<i data-feather="check-circle" class="w-4 h-4 text-green-500"></i>
${topic}
</div>
`).join('')}
</div>
</div>
`;
chapterElement.querySelector('.cursor-pointer').addEventListener('click', () => {
// Toggle topics visibility
const topicsDiv = document.getElementById(`topics-${index}`);
topicsDiv.classList.toggle('hidden');
// Update video player
document.getElementById('chapter-title').textContent = chapterName;
document.getElementById('video-duration').textContent = chapterData.duration || '--:--';
// Load YouTube video
loadYouTubeVideo(chapterData.videoId);
});
chaptersList.appendChild(chapterElement);
});
// Initialize YouTube Player
let player;
function loadYouTubeVideo(videoId) {
const playerDiv = document.getElementById('video-player');
playerDiv.innerHTML = `<div id="youtube-player"></div>`;
if (window.YT && window.YT.Player) {
if (player) player.destroy();
player = new YT.Player('youtube-player', {
height: '100%',
width: '100%',
videoId: videoId,
playerVars: {
'autoplay': 0,
'controls': 1,
'rel': 0,
'modestbranding': 1,
'color': 'white'
}
});
} else {
playerDiv.innerHTML = `
<iframe
width="100%"
height="100%"
src="https://www.youtube.com/embed/${videoId}?rel=0&modestbranding=1&color=white"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
`;
}
// Update play button
const playBtn = document.getElementById('play-btn');
playBtn.innerHTML = '<i data-feather="play" class="w-4 h-4"></i> Play';
playBtn.onclick = () => {
if (player && player.playVideo) {
player.playVideo();
}
};
}
// Initialize first chapter if available
const firstChapter = Object.entries(subject.chapters)[0];
if (firstChapter) {
const [chapterName, chapterData] = firstChapter;
document.getElementById('chapter-title').textContent = chapterName;
document.getElementById('video-duration').textContent = chapterData.duration || '--:--';
loadYouTubeVideo(chapterData.videoId);
}
// Update feather icons
if (window.feather) {
feather.replace();
}
});
</script>
</body>
</html>