Spaces:
Running
Running
Upload 10 files
Browse files- src/views/InstructorView.js +32 -2
src/views/InstructorView.js
CHANGED
|
@@ -1485,6 +1485,13 @@ export function setupInstructorEvents() {
|
|
| 1485 |
const container = document.getElementById('prompt-list-container');
|
| 1486 |
const titleEl = document.getElementById('prompt-list-title');
|
| 1487 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1488 |
titleEl.textContent = type === 'student' ? `${title} 的所有提示詞` : `題目:${title} 的所有作品`;
|
| 1489 |
|
| 1490 |
// Reset Anonymous Toggle in List View
|
|
@@ -1773,6 +1780,26 @@ export function setupInstructorEvents() {
|
|
| 1773 |
});
|
| 1774 |
}
|
| 1775 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1776 |
let isAnonymous = false;
|
| 1777 |
|
| 1778 |
window.toggleAnonymous = (btn) => {
|
|
@@ -2149,12 +2176,15 @@ export function setupInstructorEvents() {
|
|
| 2149 |
<tr class="hover:bg-gray-800/50 transition-colors">
|
| 2150 |
<td class="p-3 sticky left-0 bg-gray-900 z-10 border-r border-b border-gray-700 shadow-md">
|
| 2151 |
<div class="flex items-center justify-between">
|
| 2152 |
-
<div class="flex flex-col">
|
| 2153 |
<span class="text-xs text-${color}-400 font-bold uppercase tracking-wider mb-0.5">${c.level}</span>
|
| 2154 |
-
<button onclick="window.openPromptList('challenge', '${c.id}', '${c.title}')" class="font-bold text-white text-sm truncate
|
| 2155 |
${index + 1}. ${c.title}
|
| 2156 |
</button>
|
| 2157 |
</div>
|
|
|
|
|
|
|
|
|
|
| 2158 |
<!-- Stats (Optional) -->
|
| 2159 |
<!-- <span class="text-xs text-gray-500">0%</span> -->
|
| 2160 |
</div>
|
|
|
|
| 1485 |
const container = document.getElementById('prompt-list-container');
|
| 1486 |
const titleEl = document.getElementById('prompt-list-title');
|
| 1487 |
|
| 1488 |
+
// Set Global State for AI Analysis Scope
|
| 1489 |
+
if (type === 'challenge') {
|
| 1490 |
+
window.currentViewingChallengeId = id;
|
| 1491 |
+
} else {
|
| 1492 |
+
window.currentViewingChallengeId = null;
|
| 1493 |
+
}
|
| 1494 |
+
|
| 1495 |
titleEl.textContent = type === 'student' ? `${title} 的所有提示詞` : `題目:${title} 的所有作品`;
|
| 1496 |
|
| 1497 |
// Reset Anonymous Toggle in List View
|
|
|
|
| 1780 |
});
|
| 1781 |
}
|
| 1782 |
|
| 1783 |
+
// Direct Heatmap AI Analysis Link
|
| 1784 |
+
window.analyzeChallenge = (challengeId, challengeTitle) => {
|
| 1785 |
+
if (!localStorage.getItem('vibecoding_gemini_key')) {
|
| 1786 |
+
alert("請先設定 Gemini API Key");
|
| 1787 |
+
return;
|
| 1788 |
+
}
|
| 1789 |
+
// 1. Open the list
|
| 1790 |
+
window.openPromptList('challenge', challengeId, challengeTitle);
|
| 1791 |
+
|
| 1792 |
+
// 2. Trigger analysis logic automatically after slight delay (to ensure DOM render)
|
| 1793 |
+
setTimeout(() => {
|
| 1794 |
+
const btn = document.getElementById('btn-ai-analyze');
|
| 1795 |
+
if (btn && !btn.disabled) {
|
| 1796 |
+
btn.click();
|
| 1797 |
+
} else {
|
| 1798 |
+
console.warn("AI Analyze button not found or disabled");
|
| 1799 |
+
}
|
| 1800 |
+
}, 300);
|
| 1801 |
+
};
|
| 1802 |
+
|
| 1803 |
let isAnonymous = false;
|
| 1804 |
|
| 1805 |
window.toggleAnonymous = (btn) => {
|
|
|
|
| 2176 |
<tr class="hover:bg-gray-800/50 transition-colors">
|
| 2177 |
<td class="p-3 sticky left-0 bg-gray-900 z-10 border-r border-b border-gray-700 shadow-md">
|
| 2178 |
<div class="flex items-center justify-between">
|
| 2179 |
+
<div class="flex flex-col flex-1 min-w-0 mr-2">
|
| 2180 |
<span class="text-xs text-${color}-400 font-bold uppercase tracking-wider mb-0.5">${c.level}</span>
|
| 2181 |
+
<button onclick="window.openPromptList('challenge', '${c.id}', '${c.title}')" class="font-bold text-white text-sm truncate w-full text-left hover:text-cyan-400 transition-colors" title="查看此題目所有作品">
|
| 2182 |
${index + 1}. ${c.title}
|
| 2183 |
</button>
|
| 2184 |
</div>
|
| 2185 |
+
<button onclick="window.analyzeChallenge('${c.id}', '${c.title}')" class="w-8 h-8 rounded-full bg-gradient-to-br from-emerald-600 to-teal-600 hover:from-emerald-500 hover:to-teal-500 text-white flex items-center justify-center shadow-lg border border-emerald-400/30 transition-all transform hover:scale-110 shrink-0" title="✨ AI 選粹 (分析所有作品)">
|
| 2186 |
+
✨
|
| 2187 |
+
</button>
|
| 2188 |
<!-- Stats (Optional) -->
|
| 2189 |
<!-- <span class="text-xs text-gray-500">0%</span> -->
|
| 2190 |
</div>
|