36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
function checkAndShowTutorial() {
|
|
const currentUser = sessionStorage.getItem("loggedInUser") || "guest";
|
|
const tutorialKey = 'tutorialSeen_' + currentUser;
|
|
|
|
console.log(`[Tutorial Check] User: ${currentUser}`);
|
|
console.log(`[Tutorial Check] Key: ${tutorialKey}`);
|
|
|
|
const hasSeenTutorial = localStorage.getItem(tutorialKey);
|
|
console.log(`[Tutorial Check] Status Seen: ${hasSeenTutorial}`);
|
|
|
|
const tutorialOverlay = document.getElementById('tutorial-overlay');
|
|
|
|
if (!hasSeenTutorial && tutorialOverlay) {
|
|
tutorialOverlay.style.display = 'flex';
|
|
}
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
checkAndShowTutorial();
|
|
|
|
const closeTutorialBtn = document.getElementById('close-tutorial');
|
|
const tutorialOverlay = document.getElementById('tutorial-overlay');
|
|
|
|
if (closeTutorialBtn) {
|
|
closeTutorialBtn.addEventListener('click', () => {
|
|
|
|
const currentUser = sessionStorage.getItem("loggedInUser") || "guest";
|
|
const tutorialKey = 'tutorialSeen_' + currentUser;
|
|
|
|
if (tutorialOverlay) tutorialOverlay.style.display = 'none';
|
|
localStorage.setItem(tutorialKey, 'true');
|
|
});
|
|
}
|
|
});
|
|
|
|
window.checkTutorial = checkAndShowTutorial; |