File size: 8,744 Bytes
4d45ff8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Module | Python Pathfinder</title>
    <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>
</head>
<body class="bg-gray-50 min-h-screen">
    <custom-navbar></custom-navbar>
    
    <main class="container mx-auto px-4 py-8">
        <div class="flex flex-col md:flex-row gap-8">
            <custom-sidebar id="module-sidebar"></custom-sidebar>
            
            <div class="flex-1">
                <div class="bg-white p-6 rounded-xl shadow-md mb-8">
                    <div class="flex items-center justify-between mb-6">
                        <div>
                            <h1 class="text-3xl font-bold text-blue-700" id="module-title">Python Basics</h1>
                            <p class="text-gray-600" id="module-description">Introduction to fundamental Python concepts</p>
                        </div>
                        <div class="flex items-center">
                            <span class="text-sm font-medium text-gray-500 mr-3">Progress: <span id="module-progress">0%</span></span>
                            <div class="w-24 bg-gray-200 rounded-full h-2.5">
                                <div class="bg-blue-600 h-2.5 rounded-full" id="progress-bar" style="width: 0%"></div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
                        <div class="flex items-center">
                            <div class="bg-blue-100 p-2 rounded-lg mr-3">
                                <i data-feather="clock" class="text-blue-600" width="16"></i>
                            </div>
                            <span class="text-sm text-gray-600" id="module-duration">20 min</span>
                        </div>
                        <div class="flex items-center">
                            <div class="bg-purple-100 p-2 rounded-lg mr-3">
                                <i data-feather="book-open" class="text-purple-600" width="16"></i>
                            </div>
                            <span class="text-sm text-gray-600" id="module-lessons">5 lessons</span>
                        </div>
                        <div class="flex items-center">
                            <div class="bg-green-100 p-2 rounded-lg mr-3">
                                <i data-feather="check-circle" class="text-green-600" width="16"></i>
                            </div>
                            <span class="text-sm text-gray-600" id="module-completed">0 completed</span>
                        </div>
                        <div class="flex items-center">
                            <div class="bg-yellow-100 p-2 rounded-lg mr-3">
                                <i data-feather="award" class="text-yellow-600" width="16"></i>
                            </div>
                            <span class="text-sm text-gray-600" id="module-level">Beginner</span>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                    <div class="border-b border-gray-200 px-6 py-4 bg-gray-50">
                        <h2 class="text-lg font-semibold text-gray-800">Lessons</h2>
                    </div>
                    <div id="lessons-container" class="divide-y divide-gray-200">
                        <!-- Lessons will be dynamically inserted here -->
                    </div>
                </div>
            </div>
        </div>
    </main>

    <custom-footer></custom-footer>

    <script src="components/navbar.js"></script>
    <script src="components/footer.js"></script>
    <script src="components/sidebar.js"></script>
    <script src="script.js"></script>
    <script>
        // Module page specific script
        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();
            
            // Parse URL parameters
            const urlParams = new URLSearchParams(window.location.search);
            const moduleId = urlParams.get('id');
            
            // Fetch module data based on ID
            fetchModuleData(moduleId).then(module => {
                document.getElementById('module-title').textContent = module.title;
                document.getElementById('module-description').textContent = module.description;
                document.getElementById('module-duration').textContent = module.duration;
                document.getElementById('module-lessons').textContent = `${module.lessons.length} lessons`;
                document.getElementById('module-level').textContent = module.level;
                
                // Render lessons
                const container = document.getElementById('lessons-container');
                module.lessons.forEach((lesson, index) => {
                    const lessonElement = document.createElement('div');
                    lessonElement.className = 'px-6 py-4 hover:bg-gray-50';
                    lessonElement.innerHTML = `
                        <div class="flex items-center justify-between">
                            <div class="flex items-center">
                                <span class="text-gray-500 mr-4 w-8 text-center">${index + 1}</span>
                                <h3 class="font-medium text-gray-800">${lesson.title}</h3>
                            </div>
                            <div class="flex items-center">
                                <span class="text-sm text-gray-500 mr-4">${lesson.duration}</span>
                                <button class="text-blue-600 hover:text-blue-800 font-medium"
                                    onclick="startLesson('${moduleId}', ${index})">
                                    Start
                                </button>
                            </div>
                        </div>
                    `;
                    container.appendChild(lessonElement);
                });
                
                // Update sidebar to show current module
                const sidebar = document.getElementById('module-sidebar');
                if (sidebar) {
                    sidebar.setAttribute('path', module.path);
                }
            });
        });
        
        function fetchModuleData(moduleId) {
            // This would be replaced with actual API call
            const modules = {
                'py-basics': {
                    title: 'Python Basics',
                    description: 'Introduction to fundamental Python concepts',
                    duration: '20 min',
                    level: 'Beginner',
                    path: 'beginner',
                    lessons: [
                        { title: 'Variables and Data Types', duration: '5 min' },
                        { title: 'Basic Operations', duration: '4 min' },
                        { title: 'Strings and Formatting', duration: '6 min' },
                        { title: 'Basic Input/Output', duration: '5 min' }
                    ]
                },
                'oop': {
                    title: 'Object-Oriented Python',
                    description: 'Learn classes and objects in Python',
                    duration: '30 min',
                    level: 'Intermediate',
                    path: 'intermediate',
                    lessons: [
                        { title: 'Classes and Objects', duration: '8 min' },
                        { title: 'Inheritance', duration: '7 min' },
                        { title: 'Polymorphism', duration: '8 min' },
                        { title: 'Magic Methods', duration: '7 min' }
                    ]
                }
            };
            
            return Promise.resolve(modules[moduleId] || modules['py-basics']);
        }
        
        function startLesson(moduleId, lessonIndex) {
            // Store progress in localStorage
            const progressKey = `module-${moduleId}-progress`;
            const currentProgress = parseInt(localStorage.getItem(progressKey) || '0');
            if (lessonIndex > currentProgress) {
                localStorage.setItem(progressKey, lessonIndex.toString());
            }
            
            // Redirect to lesson page (would be implemented)
            alert(`Starting lesson ${lessonIndex + 1} of module ${moduleId}`);
        }
    </script>
</body>
</html>