import { submitPrompt, getChallenges, startChallenge, getUserProgress, getPeerPrompts, resetProgress, toggleLike, subscribeToNotifications, markNotificationRead } from "../services/classroom.js";
// Cache challenges locally
let cachedChallenges = [];
function renderTaskCard(c, userProgress) {
const p = userProgress[c.id] || {};
const isCompleted = p.status === 'completed';
const isStarted = p.status === 'started';
// 1. Completed State: Collapsed with Trophy
if (isCompleted) {
return `
您的提示詞:
${p.submission_prompt}
`;
}
// 2. Started or Not Started
return `
${!isStarted ? `
` : `
`}
`;
}
export async function renderStudentView() {
${['beginner', 'intermediate', 'advanced'].map(level => {
const tasks = levelGroups[level] || [];
const isOpen = level === 'beginner' ? 'open' : '';
// Count completed
const completedCount = tasks.filter(t => userProgress[t.id]?.status === 'completed').length;
return `
${levelNames[level]}
${completedCount === tasks.length && tasks.length > 0 ? 'ALL CLEAR' : ''}
${completedCount} / ${tasks.length}
${tasks.length > 0 ? tasks.map(c => renderTaskCard(c, userProgress)).join('') : '
本區段尚無題目
'}
`;
}).join('')}