Lashtw commited on
Commit
0cfd792
·
verified ·
1 Parent(s): 3feabdb

Upload 8 files

Browse files
Files changed (1) hide show
  1. src/views/InstructorView.js +25 -10
src/views/InstructorView.js CHANGED
@@ -119,6 +119,10 @@ export async function renderInstructorView() {
119
  <button id="btn-compare-prompts" class="bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-500 hover:to-purple-500 text-white font-bold py-3 px-8 rounded-full shadow-2xl flex items-center space-x-2 transition-all transform hover:scale-105 disabled:opacity-50 disabled:cursor-not-allowed" disabled>
120
  <span>🔍 比較已選項目 (0/3)</span>
121
  </button>
 
 
 
 
122
  </div>
123
  </div>
124
 
@@ -854,6 +858,11 @@ export function setupInstructorEvents() {
854
  const titleEl = document.getElementById('prompt-list-title');
855
 
856
  titleEl.textContent = type === 'student' ? `${title} 的所有提示詞` : `題目:${title} 的所有作品`;
 
 
 
 
 
857
  container.innerHTML = '';
858
  modal.classList.remove('hidden');
859
 
@@ -927,9 +936,6 @@ export function setupInstructorEvents() {
927
  <button onclick="window.confirmReset('${p.studentId}', '${p.challengeId}', '${p.title}')" class="px-2 py-1 bg-red-900/30 hover:bg-red-800 text-red-400 rounded transition-colors text-xs border border-red-800/50" title="退回重做">
928
  退回
929
  </button>
930
- <button onclick="window.broadcastPrompt('${p.studentId}', '${p.challengeId}')" class="px-2 py-1 bg-cyan-900/30 hover:bg-cyan-800 text-cyan-400 rounded transition-colors text-xs border border-cyan-800/50" title="投放此作品">
931
- 投放
932
- </button>
933
  </div>
934
  </div>
935
  `;
@@ -1021,7 +1027,8 @@ export function setupInstructorEvents() {
1021
  }
1022
  });
1023
 
1024
- openComparisonView(dataToCompare);
 
1025
  });
1026
  }
1027
 
@@ -1046,17 +1053,25 @@ export function setupInstructorEvents() {
1046
  });
1047
  };
1048
 
1049
- window.openComparisonView = (items) => {
1050
  const modal = document.getElementById('comparison-modal');
1051
  const grid = document.getElementById('comparison-grid');
1052
 
1053
- // Reset Anonymous State
1054
- isAnonymous = false;
1055
  const anonBtn = document.getElementById('btn-anonymous-toggle');
 
 
1056
  if (anonBtn) {
1057
- anonBtn.textContent = '👀 隱藏姓名';
1058
- anonBtn.classList.remove('bg-purple-700');
1059
- anonBtn.classList.add('bg-gray-700');
 
 
 
 
 
 
1060
  }
1061
 
1062
  // Setup Grid Rows (Vertical Stacking)
 
119
  <button id="btn-compare-prompts" class="bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-500 hover:to-purple-500 text-white font-bold py-3 px-8 rounded-full shadow-2xl flex items-center space-x-2 transition-all transform hover:scale-105 disabled:opacity-50 disabled:cursor-not-allowed" disabled>
120
  <span>🔍 比較已選項目 (0/3)</span>
121
  </button>
122
+ <label class="flex items-center space-x-2 bg-gray-800 px-4 rounded-full border border-gray-600 cursor-pointer hover:bg-gray-700 transition">
123
+ <input type="checkbox" id="list-anonymous-toggle" class="w-5 h-5 rounded border-gray-500 text-purple-600 focus:ring-purple-500 bg-gray-900">
124
+ <span class="text-gray-300 select-none">隱藏姓名</span>
125
+ </label>
126
  </div>
127
  </div>
128
 
 
858
  const titleEl = document.getElementById('prompt-list-title');
859
 
860
  titleEl.textContent = type === 'student' ? `${title} 的所有提示詞` : `題目:${title} 的所有作品`;
861
+
862
+ // Reset Anonymous Toggle in List View
863
+ const anonCheck = document.getElementById('list-anonymous-toggle');
864
+ if (anonCheck) anonCheck.checked = false;
865
+
866
  container.innerHTML = '';
867
  modal.classList.remove('hidden');
868
 
 
936
  <button onclick="window.confirmReset('${p.studentId}', '${p.challengeId}', '${p.title}')" class="px-2 py-1 bg-red-900/30 hover:bg-red-800 text-red-400 rounded transition-colors text-xs border border-red-800/50" title="退回重做">
937
  退回
938
  </button>
 
 
 
939
  </div>
940
  </div>
941
  `;
 
1027
  }
1028
  });
1029
 
1030
+ const isAnon = document.getElementById('list-anonymous-toggle')?.checked || false;
1031
+ openComparisonView(dataToCompare, isAnon);
1032
  });
1033
  }
1034
 
 
1053
  });
1054
  };
1055
 
1056
+ window.openComparisonView = (items, initialAnonymous = false) => {
1057
  const modal = document.getElementById('comparison-modal');
1058
  const grid = document.getElementById('comparison-grid');
1059
 
1060
+ // Apply Anonymous State
1061
+ isAnonymous = initialAnonymous;
1062
  const anonBtn = document.getElementById('btn-anonymous-toggle');
1063
+
1064
+ // Update Toggle UI to match state
1065
  if (anonBtn) {
1066
+ if (isAnonymous) {
1067
+ anonBtn.textContent = '🙈 顯示姓名';
1068
+ anonBtn.classList.add('bg-purple-700');
1069
+ anonBtn.classList.remove('bg-gray-700');
1070
+ } else {
1071
+ anonBtn.textContent = '👀 隱藏姓名';
1072
+ anonBtn.classList.remove('bg-purple-700');
1073
+ anonBtn.classList.add('bg-gray-700');
1074
+ }
1075
  }
1076
 
1077
  // Setup Grid Rows (Vertical Stacking)