major update
This commit is contained in:
1 parent
266a064330
commit
5ac5626406
8 files changed
+268
-41
No files matched your search
@@ -83,8 +83,13 @@ window.startGame = async function() {
|
||||
}
|
||||
|
||||
try {
|
||||
// Hide student dashboard and typing practice
|
||||
document.getElementById('studentPanel').style.display = 'none';
|
||||
document.getElementById('typingSection').style.display = 'none';
|
||||
|
||||
// Show game section
|
||||
document.getElementById('gameSection').classList.remove('hidden');
|
||||
document.getElementById('gameSection').style.display = 'block';
|
||||
document.getElementById('wordBox').textContent = 'Loading...';
|
||||
document.getElementById('summary')?.classList.add('hidden');
|
||||
document.getElementById('badgeDisplay')?.classList.add('hidden');
|
||||
|
||||
+51
-1
@@ -51,4 +51,54 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
}
|
||||
|
||||
console.log('✅ Application initialized');
|
||||
});
|
||||
});
|
||||
|
||||
// Function to return to student dashboard
|
||||
window.backToStudentDashboard = function() {
|
||||
console.log('🔙 Returning to student dashboard');
|
||||
|
||||
// Hide all sections
|
||||
document.getElementById('gameSection').classList.add('hidden');
|
||||
document.getElementById('gameSection').style.display = 'none';
|
||||
document.getElementById('typingSection').classList.add('hidden');
|
||||
document.getElementById('typingSection').style.display = 'none';
|
||||
|
||||
// Show student panel
|
||||
document.getElementById('studentPanel').classList.remove('hidden');
|
||||
document.getElementById('studentPanel').style.display = 'block';
|
||||
|
||||
// Reset any game/typing state
|
||||
document.getElementById('userInput').value = '';
|
||||
document.getElementById('typingInput').value = '';
|
||||
document.getElementById('wordBox').textContent = '';
|
||||
document.getElementById('typingPrompt').textContent = 'Get ready to type...';
|
||||
document.getElementById('typingFeedback').textContent = '';
|
||||
}
|
||||
|
||||
// Function to change theme (accessible to students)
|
||||
window.changeTheme = function(themeName) {
|
||||
console.log('🎨 Changing theme to:', themeName);
|
||||
|
||||
// Apply the theme
|
||||
applyTheme(themeName);
|
||||
|
||||
// Save the preference in both possible keys
|
||||
localStorage.setItem('selectedTheme', themeName);
|
||||
localStorage.setItem('theme', themeName);
|
||||
|
||||
// Update both theme selects if they exist
|
||||
const adminThemeSelect = document.getElementById('themeSelect');
|
||||
const studentThemeSelect = document.getElementById('studentThemeSelect');
|
||||
|
||||
if (adminThemeSelect) {
|
||||
adminThemeSelect.value = themeName;
|
||||
}
|
||||
if (studentThemeSelect) {
|
||||
studentThemeSelect.value = themeName;
|
||||
}
|
||||
|
||||
// Show toast notification
|
||||
if (typeof showToast === 'function') {
|
||||
showToast(`🎨 Theme changed to ${themeName}`);
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -1,10 +1,14 @@
|
||||
// Modern theme system
|
||||
function applySavedTheme() {
|
||||
const savedTheme = localStorage.getItem('theme') || 'default';
|
||||
const savedTheme = localStorage.getItem('theme') || localStorage.getItem('selectedTheme') || 'default';
|
||||
applyTheme(savedTheme);
|
||||
|
||||
// Update both theme selectors
|
||||
const themeSelector = document.getElementById('themeSelect');
|
||||
const studentThemeSelector = document.getElementById('studentThemeSelect');
|
||||
|
||||
if (themeSelector) themeSelector.value = savedTheme;
|
||||
if (studentThemeSelector) studentThemeSelector.value = savedTheme;
|
||||
}
|
||||
|
||||
function changeTheme(themeName) {
|
||||
|
||||
@@ -12,8 +12,12 @@ window.startTypingPractice = async function() {
|
||||
const user = JSON.parse(localStorage.getItem('loggedInUser'));
|
||||
if (!user) return;
|
||||
|
||||
// Hide student dashboard and game section
|
||||
document.getElementById('studentPanel').style.display = 'none';
|
||||
document.getElementById('gameSection').classList.add('hidden');
|
||||
document.getElementById('gameSection').style.display = 'none';
|
||||
document.getElementById('typingSection').classList.remove('hidden');
|
||||
document.getElementById('typingSection').style.display = 'block';
|
||||
|
||||
const typingPrompt = document.getElementById('typingPrompt');
|
||||
typingPrompt.textContent = 'Loading...';
|
||||
|
||||
@@ -57,6 +57,7 @@ function showStudent() {
|
||||
const studentPanel = document.getElementById('studentPanel');
|
||||
if (studentPanel) {
|
||||
studentPanel.classList.remove('hidden');
|
||||
studentPanel.style.display = 'block';
|
||||
|
||||
// Ensure buttons are visible and functional
|
||||
const gameBtn = document.getElementById('startGameBtn');
|
||||
@@ -67,6 +68,13 @@ function showStudent() {
|
||||
typingBtn.classList.remove('hidden');
|
||||
console.log("✅ Student buttons are now visible");
|
||||
}
|
||||
|
||||
// Update student theme selector to match current theme
|
||||
const savedTheme = localStorage.getItem('theme') || localStorage.getItem('selectedTheme') || 'default';
|
||||
const studentThemeSelect = document.getElementById('studentThemeSelect');
|
||||
if (studentThemeSelect) {
|
||||
studentThemeSelect.value = savedTheme;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user