feat: add Leren learning page for content generation and feedback, and create TestManager admin component
Some checks failed
On Push to Main / test (push) Has been cancelled
On Push to Main / publish (push) Has been cancelled
On Push to Main / deploy-dev (push) Has been cancelled

This commit is contained in:
RaymondVerhoef
2026-05-14 22:21:39 +02:00
parent 0673122536
commit e223836d7d
2 changed files with 14 additions and 7 deletions

View File

@@ -9,17 +9,25 @@ import { motion, AnimatePresence } from 'framer-motion';
const TestManager = () => {
const [topics, setTopics] = useState([]);
const [questionCounts, setQuestionCounts] = useState({});
const [selectedTopic, setSelectedTopic] = useState(null);
const [questions, setQuestions] = useState([]);
const [loadingTopicId, setLoadingTopicId] = useState(null);
const [error, setError] = useState(null);
const loadData = () => {
const allTopics = storage.get('kb:topics', []);
const loadData = async () => {
const allTopics = await db.getTopics();
setTopics(allTopics);
const counts = {};
await Promise.all(allTopics.map(async t => {
const bank = await getTopicQuestionBank(t.id);
counts[t.id] = bank.length;
}));
setQuestionCounts(counts);
if (selectedTopic) {
setQuestions(getTopicQuestionBank(selectedTopic.id));
setQuestions(await getTopicQuestionBank(selectedTopic.id));
}
};
@@ -157,8 +165,7 @@ const TestManager = () => {
)}
{topics.map(topic => {
const bank = getTopicQuestionBank(topic.id);
const count = bank.length;
const count = questionCounts[topic.id] || 0;
const isLoading = loadingTopicId === topic.id;
return (