Spaces:
Running
Running
Upload 9 files
Browse files- src/views/InstructorView.js +19 -0
src/views/InstructorView.js
CHANGED
|
@@ -133,7 +133,11 @@ export async function renderInstructorView() {
|
|
| 133 |
<div id="create-room-container" class="flex items-center space-x-2">
|
| 134 |
<input type="text" id="rejoin-room-code" placeholder="代碼" class="bg-gray-900 border border-gray-700 text-white px-3 py-2 rounded-lg w-20 text-center focus:outline-none focus:border-cyan-500">
|
| 135 |
<button id="rejoin-room-btn" class="bg-gray-700 hover:bg-gray-600 text-white px-3 py-2 rounded-lg">重回</button>
|
|
|
|
| 136 |
<button id="create-room-btn" class="bg-purple-600 hover:bg-purple-500 text-white font-bold px-4 py-2 rounded-lg shadow-lg">開房</button>
|
|
|
|
|
|
|
|
|
|
| 137 |
</div>
|
| 138 |
</div>
|
| 139 |
</header>
|
|
@@ -585,6 +589,21 @@ export function setupInstructorEvents() {
|
|
| 585 |
window.open('monster_preview.html', '_blank');
|
| 586 |
});
|
| 587 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
createBtn.addEventListener('click', async () => {
|
| 589 |
try {
|
| 590 |
createBtn.disabled = true;
|
|
|
|
| 133 |
<div id="create-room-container" class="flex items-center space-x-2">
|
| 134 |
<input type="text" id="rejoin-room-code" placeholder="代碼" class="bg-gray-900 border border-gray-700 text-white px-3 py-2 rounded-lg w-20 text-center focus:outline-none focus:border-cyan-500">
|
| 135 |
<button id="rejoin-room-btn" class="bg-gray-700 hover:bg-gray-600 text-white px-3 py-2 rounded-lg">重回</button>
|
| 136 |
+
|
| 137 |
<button id="create-room-btn" class="bg-purple-600 hover:bg-purple-500 text-white font-bold px-4 py-2 rounded-lg shadow-lg">開房</button>
|
| 138 |
+
<button id="logout-btn" class="bg-red-800 hover:bg-red-700 text-white font-bold px-4 py-2 rounded-lg shadow-lg border border-red-600/50" title="登出">
|
| 139 |
+
🚪
|
| 140 |
+
</button>
|
| 141 |
</div>
|
| 142 |
</div>
|
| 143 |
</header>
|
|
|
|
| 589 |
window.open('monster_preview.html', '_blank');
|
| 590 |
});
|
| 591 |
|
| 592 |
+
// Logout Logic
|
| 593 |
+
document.getElementById('logout-btn').addEventListener('click', () => {
|
| 594 |
+
if (confirm('確定要登出講師模式嗎? (將會回到首頁)')) {
|
| 595 |
+
sessionStorage.removeItem('vibecoding_instructor_auth');
|
| 596 |
+
sessionStorage.removeItem('vibecoding_instructor_in_room');
|
| 597 |
+
sessionStorage.removeItem('vibecoding_admin_referer');
|
| 598 |
+
// We can optionally clear room history or keep it
|
| 599 |
+
// localStorage.removeItem('vibecoding_instructor_room');
|
| 600 |
+
|
| 601 |
+
// Clear hash to trigger main router back to Landing or default
|
| 602 |
+
window.location.hash = '';
|
| 603 |
+
window.location.reload();
|
| 604 |
+
}
|
| 605 |
+
});
|
| 606 |
+
|
| 607 |
createBtn.addEventListener('click', async () => {
|
| 608 |
try {
|
| 609 |
createBtn.disabled = true;
|