fix(api): fix api integration for quest map and adjacent components

This commit is contained in:
shafin-r
2026-03-01 12:57:54 +06:00
parent c7f0183956
commit 2eaf77e13c
12 changed files with 2039 additions and 618 deletions

View File

@ -261,7 +261,7 @@ const TARGETED_XP = 15;
const TARGETED_SCORE = 15;
const TargetedResults = ({ onFinish }: { onFinish: () => void }) => {
const { userMetrics, setUserMetrics } = useExamConfigStore();
const { userMetrics } = useExamConfigStore();
const previousXP = userMetrics.xp ?? 0;
const gainedXP = TARGETED_XP;
const levelMinXP = Math.floor(previousXP / 100) * 100;
@ -269,14 +269,6 @@ const TargetedResults = ({ onFinish }: { onFinish: () => void }) => {
const currentLevel = Math.floor(previousXP / 100) + 1;
const displayXP = useCountUp(gainedXP);
useEffect(() => {
setUserMetrics({
xp: previousXP,
questions: 0,
streak: 0,
});
}, []);
return (
<div className="results-screen">
<style>{STYLES}</style>
@ -397,20 +389,12 @@ export const Results = () => {
const navigate = useNavigate();
const results = useResults((s) => s.results);
const clearResults = useResults((s) => s.clearResults);
const { setUserMetrics, payload } = useExamConfigStore();
const { payload } = useExamConfigStore();
const isTargeted = payload?.mode === "TARGETED";
useEffect(() => {
if (results)
setUserMetrics({
xp: results.total_xp,
questions: results.correct_count,
streak: 0,
});
}, [results]);
function handleFinishExam() {
useExamConfigStore.getState().clearPayload();
clearResults();
navigate("/student/home");
}