Spaces:
Running
Running
Commit Β·
f806771
1
Parent(s): e6c9de8
Fix Python module navigation: dashboard now hides when cards are clicked
Browse files- Python/index.html +22 -13
Python/index.html
CHANGED
|
@@ -57,7 +57,7 @@
|
|
| 57 |
|
| 58 |
/* Dashboard */
|
| 59 |
.dashboard {
|
| 60 |
-
display:
|
| 61 |
}
|
| 62 |
|
| 63 |
.modules-grid {
|
|
@@ -455,7 +455,8 @@
|
|
| 455 |
}
|
| 456 |
];
|
| 457 |
|
| 458 |
-
const MODULE_CONTENT = {
|
|
|
|
| 459 |
concepts: `
|
| 460 |
<div class="section">
|
| 461 |
<h2>Python Data Structures for DS</h2>
|
|
@@ -2855,9 +2856,9 @@ data = [np.random.randn(<span class="number">1000000</span>) <span class="keywor
|
|
| 2855 |
function showModule(moduleId) {
|
| 2856 |
const module = modules.find(m => m.id === moduleId);
|
| 2857 |
const content = MODULE_CONTENT[moduleId];
|
| 2858 |
-
|
| 2859 |
document.getElementById('dashboard').classList.remove('active');
|
| 2860 |
-
|
| 2861 |
const moduleHTML = `
|
| 2862 |
<div class="module active" id="module-${moduleId}">
|
| 2863 |
<button class="btn-back" onclick="backToDashboard()">β Back to Dashboard</button>
|
|
@@ -2867,9 +2868,9 @@ data = [np.random.randn(<span class="number">1000000</span>) <span class="keywor
|
|
| 2867 |
</header>
|
| 2868 |
|
| 2869 |
<div class="tabs">
|
| 2870 |
-
<button class="tab-btn active" onclick="switchTab('${moduleId}', 'concepts')">π Key Concepts</button>
|
| 2871 |
-
<button class="tab-btn" onclick="switchTab('${moduleId}', 'code')">π» Code Examples</button>
|
| 2872 |
-
<button class="tab-btn" onclick="switchTab('${moduleId}', 'interview')">π― Interview Questions</button>
|
| 2873 |
</div>
|
| 2874 |
|
| 2875 |
<div id="${moduleId}-concepts" class="tab active">${content.concepts}</div>
|
|
@@ -2877,18 +2878,25 @@ data = [np.random.randn(<span class="number">1000000</span>) <span class="keywor
|
|
| 2877 |
<div id="${moduleId}-interview" class="tab">${content.interview}</div>
|
| 2878 |
</div>
|
| 2879 |
`;
|
| 2880 |
-
|
| 2881 |
document.getElementById('modulesContainer').innerHTML = moduleHTML;
|
| 2882 |
}
|
| 2883 |
|
| 2884 |
// Switch tabs
|
| 2885 |
-
function switchTab(moduleId, tabName) {
|
| 2886 |
const moduleEl = document.getElementById(`module-${moduleId}`);
|
| 2887 |
-
|
| 2888 |
// Update tab buttons
|
| 2889 |
moduleEl.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active'));
|
| 2890 |
-
|
| 2891 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2892 |
// Update tab content
|
| 2893 |
moduleEl.querySelectorAll('.tab').forEach(tab => tab.classList.remove('active'));
|
| 2894 |
document.getElementById(`${moduleId}-${tabName}`).classList.add('active');
|
|
@@ -2904,4 +2912,5 @@ data = [np.random.randn(<span class="number">1000000</span>) <span class="keywor
|
|
| 2904 |
renderDashboard();
|
| 2905 |
</script>
|
| 2906 |
</body>
|
| 2907 |
-
|
|
|
|
|
|
| 57 |
|
| 58 |
/* Dashboard */
|
| 59 |
.dashboard {
|
| 60 |
+
display: none;
|
| 61 |
}
|
| 62 |
|
| 63 |
.modules-grid {
|
|
|
|
| 455 |
}
|
| 456 |
];
|
| 457 |
|
| 458 |
+
const MODULE_CONTENT = {
|
| 459 |
+
"python-fundamentals": {
|
| 460 |
concepts: `
|
| 461 |
<div class="section">
|
| 462 |
<h2>Python Data Structures for DS</h2>
|
|
|
|
| 2856 |
function showModule(moduleId) {
|
| 2857 |
const module = modules.find(m => m.id === moduleId);
|
| 2858 |
const content = MODULE_CONTENT[moduleId];
|
| 2859 |
+
|
| 2860 |
document.getElementById('dashboard').classList.remove('active');
|
| 2861 |
+
|
| 2862 |
const moduleHTML = `
|
| 2863 |
<div class="module active" id="module-${moduleId}">
|
| 2864 |
<button class="btn-back" onclick="backToDashboard()">β Back to Dashboard</button>
|
|
|
|
| 2868 |
</header>
|
| 2869 |
|
| 2870 |
<div class="tabs">
|
| 2871 |
+
<button class="tab-btn active" onclick="switchTab('${moduleId}', 'concepts', event)">π Key Concepts</button>
|
| 2872 |
+
<button class="tab-btn" onclick="switchTab('${moduleId}', 'code', event)">π» Code Examples</button>
|
| 2873 |
+
<button class="tab-btn" onclick="switchTab('${moduleId}', 'interview', event)">π― Interview Questions</button>
|
| 2874 |
</div>
|
| 2875 |
|
| 2876 |
<div id="${moduleId}-concepts" class="tab active">${content.concepts}</div>
|
|
|
|
| 2878 |
<div id="${moduleId}-interview" class="tab">${content.interview}</div>
|
| 2879 |
</div>
|
| 2880 |
`;
|
| 2881 |
+
|
| 2882 |
document.getElementById('modulesContainer').innerHTML = moduleHTML;
|
| 2883 |
}
|
| 2884 |
|
| 2885 |
// Switch tabs
|
| 2886 |
+
function switchTab(moduleId, tabName, e) {
|
| 2887 |
const moduleEl = document.getElementById(`module-${moduleId}`);
|
| 2888 |
+
|
| 2889 |
// Update tab buttons
|
| 2890 |
moduleEl.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active'));
|
| 2891 |
+
if (e && e.target) {
|
| 2892 |
+
e.target.classList.add('active');
|
| 2893 |
+
} else {
|
| 2894 |
+
// Fallback: find the button by tab name
|
| 2895 |
+
const tabNames = ['concepts', 'code', 'interview'];
|
| 2896 |
+
const idx = tabNames.indexOf(tabName);
|
| 2897 |
+
if (idx !== -1) moduleEl.querySelectorAll('.tab-btn')[idx]?.classList.add('active');
|
| 2898 |
+
}
|
| 2899 |
+
|
| 2900 |
// Update tab content
|
| 2901 |
moduleEl.querySelectorAll('.tab').forEach(tab => tab.classList.remove('active'));
|
| 2902 |
document.getElementById(`${moduleId}-${tabName}`).classList.add('active');
|
|
|
|
| 2912 |
renderDashboard();
|
| 2913 |
</script>
|
| 2914 |
</body>
|
| 2915 |
+
|
| 2916 |
+
</html>
|