-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog.html
More file actions
198 lines (170 loc) · 8.19 KB
/
Copy pathcatalog.html
File metadata and controls
198 lines (170 loc) · 8.19 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<link id="stylesheet" rel="stylesheet" type="text/css" href="./css/index1.css">
<link rel="website icon" type="png" href="./image/logo.png">
<script src="./js/mode.js"></script>
<title>Courses Catalog - Study Help</title>
<link rel="stylesheet" href="https://unpkg.com/lenis@1.1.20/dist/lenis.css">
</head>
<body>
<div id="header-component"></div>
<!-- Catalog Page Hero Header -->
<section class="catalog-hero">
<div class="catalog-hero-content">
<h1>Courses Catalog</h1>
<p>Access mid/final papers, slides, lab files, and notes for BRAC University courses.</p>
</div>
</section>
<!-- Main Container -->
<main class="main-container">
<!-- Search and Filter bar side by side -->
<div class="search-filter-bar">
<div class="search-container">
<i class="fa fa-search search-icon"></i>
<input type="text" id="course-search" placeholder="Search for courses (e.g. CSE110, MAT110, Bangla)...">
</div>
<div class="filter-tabs-container">
<div class="filter-tabs">
<button class="tab-btn active" data-filter="all">All Departments</button>
<button class="tab-btn" data-filter="cse">CSE</button>
<button class="tab-btn" data-filter="mns">MNS</button>
<button class="tab-btn" data-filter="others">Others</button>
</div>
</div>
</div>
<!-- Dynamic Course Catalog Grid -->
<div id="course-catalog-grid">
<!-- Loaded dynamically by JS -->
</div>
<!-- Unified Community Section -->
<div class="community-banner">
<div class="community-info">
<h3>Help build the ultimate study resource</h3>
<p>Support your peers by sharing course files, or help us improve the platform with your ideas.</p>
</div>
<div class="community-actions">
<a href="https://drive.google.com/drive/folders/1Im4c1Rmvl3mo7BanixPvcEtwGlMfAa7d?usp=sharing"
target="_blank" class="community-btn primary">
<i class="fa-solid fa-cloud-arrow-up"></i>
<span>Contribute Resources</span>
</a>
<a href="./courses/course.html?id=feedback" target="_blank" class="community-btn secondary">
<i class="fa-solid fa-comment-dots"></i>
<span>Share Feedback</span>
</a>
</div>
</div>
</main>
<div id="footer-component"></div>
<script>
function openFolder(link, target) {
window.open(link, target);
}
</script>
<script src="./js/courses_data.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const searchInput = document.getElementById("course-search");
const tabButtons = document.querySelectorAll(".tab-btn");
// Parse URL query parameter
const urlParams = new URLSearchParams(window.location.search);
const initialSearch = urlParams.get('search');
if (initialSearch && searchInput) {
searchInput.value = decodeURIComponent(initialSearch);
}
function getDepartment(key) {
const k = key.toLowerCase();
if (k.startsWith("cse")) return "cse";
if (k.startsWith("mat") || k.startsWith("phy") || k.startsWith("sta")) return "mns";
return "others";
}
function renderCatalog() {
const query = searchInput.value.toLowerCase().trim();
const activeTab = document.querySelector(".tab-btn.active").getAttribute("data-filter");
const cseContainer = [];
const mnsContainer = [];
const othersContainer = [];
Object.keys(window.coursesData).forEach(key => {
const course = window.coursesData[key];
if (key === "feedback") return; // Skip feedback form
const matchQuery = (course.title && course.title.toLowerCase().includes(query)) ||
(course.subtitle && course.subtitle.toLowerCase().includes(query)) ||
key.toLowerCase().includes(query);
const dept = getDepartment(key);
const matchTab = (activeTab === "all" || activeTab === dept);
if (matchQuery && matchTab) {
const courseCode = course.title || key.toUpperCase();
const courseName = course.subtitle || courseCode;
const cardHTML = `
<div class="course-card" onclick="openFolder('./courses/course.html?id=${key}', '_blank')">
<div class="course-card-content">
<span class="course-badge">${courseCode}</span>
<h4 class="course-name">${courseName}</h4>
</div>
<div class="course-arrow">
<i class="fa-solid fa-chevron-right"></i>
</div>
</div>
`;
if (dept === "cse") cseContainer.push(cardHTML);
else if (dept === "mns") mnsContainer.push(cardHTML);
else othersContainer.push(cardHTML);
}
});
let catalogHTML = "";
if (cseContainer.length > 0) {
catalogHTML += `
<div class="section-title">
<span>COMPUTER SCIENCE & ENGINEERING</span>
<span class="section-count">${cseContainer.length}</span>
</div>
<div class="button-container">${cseContainer.join("")}</div>
`;
}
if (mnsContainer.length > 0) {
catalogHTML += `
<div class="section-title">
<span>MATH & PHYSICS</span>
<span class="section-count">${mnsContainer.length}</span>
</div>
<div class="button-container">${mnsContainer.join("")}</div>
`;
}
if (othersContainer.length > 0) {
catalogHTML += `
<div class="section-title">
<span>OTHERS (RS, ENG, COD, ELECTIVE)</span>
<span class="section-count">${othersContainer.length}</span>
</div>
<div class="button-container">${othersContainer.join("")}</div>
`;
}
if (catalogHTML === "") {
catalogHTML = `<div style="text-align: center; color: var(--text-secondary); font-size: 16px; margin: 80px 0; width: 100%; font-family: 'Poppins', sans-serif;">No matching courses found.</div>`;
}
document.getElementById("course-catalog-grid").innerHTML = catalogHTML;
}
if (searchInput) {
searchInput.addEventListener("input", renderCatalog);
}
tabButtons.forEach(btn => {
btn.addEventListener("click", function () {
tabButtons.forEach(b => b.classList.remove("active"));
this.classList.add("active");
renderCatalog();
});
});
renderCatalog();
});
</script>
<script src="https://unpkg.com/lenis@1.1.20/dist/lenis.min.js"></script>
<script src="./js/lenis_init.js"></script>
<script src="./js/components.js"></script>
</body>
</html>