Spaces:
Running
Running
Upload 10 files
Browse files- src/views/InstructorView.js +41 -0
src/views/InstructorView.js
CHANGED
|
@@ -765,6 +765,47 @@ export function setupInstructorEvents() {
|
|
| 765 |
}
|
| 766 |
})();
|
| 767 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 768 |
// Email/Password Auth Logic
|
| 769 |
if (loginBtn && registerBtn) {
|
| 770 |
// Login Handler
|
|
|
|
| 765 |
}
|
| 766 |
})();
|
| 767 |
|
| 768 |
+
// --- Global Dashboard Buttons (Always Active) ---
|
| 769 |
+
const logoutBtn = document.getElementById('logout-btn');
|
| 770 |
+
if (logoutBtn) {
|
| 771 |
+
logoutBtn.addEventListener('click', async () => {
|
| 772 |
+
if (confirm("確定要登出嗎?")) {
|
| 773 |
+
try {
|
| 774 |
+
await signOutUser();
|
| 775 |
+
// Optional: clear local storage if strictly needed, but auth state change handles UI
|
| 776 |
+
// localStorage.removeItem('vibecoding_instructor_name');
|
| 777 |
+
window.location.reload();
|
| 778 |
+
} catch (e) {
|
| 779 |
+
console.error("Logout failed:", e);
|
| 780 |
+
alert("登出失敗");
|
| 781 |
+
}
|
| 782 |
+
}
|
| 783 |
+
});
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
const btnOpenGallery = document.getElementById('btn-open-gallery');
|
| 787 |
+
if (btnOpenGallery) {
|
| 788 |
+
btnOpenGallery.addEventListener('click', () => {
|
| 789 |
+
window.open('monster_preview.html', '_blank');
|
| 790 |
+
});
|
| 791 |
+
}
|
| 792 |
+
|
| 793 |
+
if (navInstBtn) {
|
| 794 |
+
navInstBtn.addEventListener('click', () => {
|
| 795 |
+
if (confirm("即將離開儀表板前往講師管理頁面,確定嗎?")) {
|
| 796 |
+
window.location.hash = 'instructors';
|
| 797 |
+
}
|
| 798 |
+
});
|
| 799 |
+
}
|
| 800 |
+
|
| 801 |
+
if (navAdminBtn) {
|
| 802 |
+
navAdminBtn.addEventListener('click', () => {
|
| 803 |
+
if (confirm("即將離開儀表板前往題目管理頁面,確定嗎?")) {
|
| 804 |
+
window.location.hash = 'admin';
|
| 805 |
+
}
|
| 806 |
+
});
|
| 807 |
+
}
|
| 808 |
+
|
| 809 |
// Email/Password Auth Logic
|
| 810 |
if (loginBtn && registerBtn) {
|
| 811 |
// Login Handler
|