Spaces:
Running
Running
Upload 9 files
Browse files- src/views/StudentView.js +9 -9
src/views/StudentView.js
CHANGED
|
@@ -391,8 +391,8 @@ export function setupStudentEvents() {
|
|
| 391 |
};
|
| 392 |
|
| 393 |
window.submitLevel = async (challengeId) => {
|
| 394 |
-
const input = document.getElementById(`input
|
| 395 |
-
const errorMsg = document.getElementById(`error
|
| 396 |
const prompt = input.value;
|
| 397 |
const roomCode = localStorage.getItem('vibecoding_room_code');
|
| 398 |
const userId = localStorage.getItem('vibecoding_user_id');
|
|
@@ -438,7 +438,7 @@ export function setupStudentEvents() {
|
|
| 438 |
const newCardHTML = renderTaskCard(challenge, newProgress);
|
| 439 |
|
| 440 |
// 3. Replace in DOM
|
| 441 |
-
const oldCard = document.getElementById(`card
|
| 442 |
if (oldCard) {
|
| 443 |
oldCard.outerHTML = newCardHTML;
|
| 444 |
} else {
|
|
@@ -505,12 +505,12 @@ function renderPeerModal() {
|
|
| 505 |
let optionsHtml = '<option value="" disabled selected>選擇題目...</option>';
|
| 506 |
if (cachedChallenges.length > 0) {
|
| 507 |
optionsHtml += cachedChallenges.map(c =>
|
| 508 |
-
`<
|
| 509 |
).join('');
|
| 510 |
}
|
| 511 |
|
| 512 |
return `
|
| 513 |
-
<
|
| 514 |
<div class="bg-gray-800 rounded-2xl w-full max-w-md h-[80vh] flex flex-col border border-gray-700 shadow-2xl">
|
| 515 |
<div class="p-6 border-b border-gray-700 flex justify-between items-center">
|
| 516 |
<h3 class="text-xl font-bold text-white">同學的成功提示詞</h3>
|
|
@@ -527,7 +527,7 @@ function renderPeerModal() {
|
|
| 527 |
<div class="text-center text-gray-500 mt-10">請選擇一個題目來查看</div>
|
| 528 |
</div>
|
| 529 |
</div>
|
| 530 |
-
</div
|
| 531 |
`;
|
| 532 |
}
|
| 533 |
|
|
@@ -563,7 +563,7 @@ window.loadPeerPrompts = async (challengeId) => {
|
|
| 563 |
const isLiked = p.likedBy && p.likedBy.includes(currentUserId);
|
| 564 |
|
| 565 |
return `
|
| 566 |
-
<
|
| 567 |
<div class="flex items-center justify-between mb-2">
|
| 568 |
<div class="flex items-center space-x-2">
|
| 569 |
<div class="w-6 h-6 rounded-full bg-cyan-600 flex items-center justify-center text-xs font-bold text-white">
|
|
@@ -582,11 +582,11 @@ window.loadPeerPrompts = async (challengeId) => {
|
|
| 582 |
</button>
|
| 583 |
</div>
|
| 584 |
<p class="text-gray-300 font-mono text-sm bg-black/20 p-3 rounded-lg border border-gray-700/50 whitespace-pre-wrap">${p.prompt}</p>
|
| 585 |
-
</div
|
| 586 |
`}).join('');
|
| 587 |
|
| 588 |
// Attach challenge title for notification context
|
| 589 |
-
window.currentPeerChallengeTitle = document.querySelector(`#peer
|
| 590 |
};
|
| 591 |
|
| 592 |
// Like Handler
|
|
|
|
| 391 |
};
|
| 392 |
|
| 393 |
window.submitLevel = async (challengeId) => {
|
| 394 |
+
const input = document.getElementById(`input-${challengeId}`);
|
| 395 |
+
const errorMsg = document.getElementById(`error-${challengeId}`);
|
| 396 |
const prompt = input.value;
|
| 397 |
const roomCode = localStorage.getItem('vibecoding_room_code');
|
| 398 |
const userId = localStorage.getItem('vibecoding_user_id');
|
|
|
|
| 438 |
const newCardHTML = renderTaskCard(challenge, newProgress);
|
| 439 |
|
| 440 |
// 3. Replace in DOM
|
| 441 |
+
const oldCard = document.getElementById(`card-${challengeId}`);
|
| 442 |
if (oldCard) {
|
| 443 |
oldCard.outerHTML = newCardHTML;
|
| 444 |
} else {
|
|
|
|
| 505 |
let optionsHtml = '<option value="" disabled selected>選擇題目...</option>';
|
| 506 |
if (cachedChallenges.length > 0) {
|
| 507 |
optionsHtml += cachedChallenges.map(c =>
|
| 508 |
+
`<option value="${c.id}">[${c.level}] ${c.title}</option>`
|
| 509 |
).join('');
|
| 510 |
}
|
| 511 |
|
| 512 |
return `
|
| 513 |
+
<div id="peer-modal" class="fixed inset-0 bg-black bg-opacity-80 backdrop-blur-sm hidden flex items-center justify-center z-50 p-4">
|
| 514 |
<div class="bg-gray-800 rounded-2xl w-full max-w-md h-[80vh] flex flex-col border border-gray-700 shadow-2xl">
|
| 515 |
<div class="p-6 border-b border-gray-700 flex justify-between items-center">
|
| 516 |
<h3 class="text-xl font-bold text-white">同學的成功提示詞</h3>
|
|
|
|
| 527 |
<div class="text-center text-gray-500 mt-10">請選擇一個題目來查看</div>
|
| 528 |
</div>
|
| 529 |
</div>
|
| 530 |
+
</div>
|
| 531 |
`;
|
| 532 |
}
|
| 533 |
|
|
|
|
| 563 |
const isLiked = p.likedBy && p.likedBy.includes(currentUserId);
|
| 564 |
|
| 565 |
return `
|
| 566 |
+
<div class="bg-gray-700/30 p-4 rounded-xl border border-gray-600">
|
| 567 |
<div class="flex items-center justify-between mb-2">
|
| 568 |
<div class="flex items-center space-x-2">
|
| 569 |
<div class="w-6 h-6 rounded-full bg-cyan-600 flex items-center justify-center text-xs font-bold text-white">
|
|
|
|
| 582 |
</button>
|
| 583 |
</div>
|
| 584 |
<p class="text-gray-300 font-mono text-sm bg-black/20 p-3 rounded-lg border border-gray-700/50 whitespace-pre-wrap">${p.prompt}</p>
|
| 585 |
+
</div>
|
| 586 |
`}).join('');
|
| 587 |
|
| 588 |
// Attach challenge title for notification context
|
| 589 |
+
window.currentPeerChallengeTitle = document.querySelector(`#peer-challenge-select option[value="${challengeId}"]`).text;
|
| 590 |
};
|
| 591 |
|
| 592 |
// Like Handler
|