34 lines
901 B
TypeScript
34 lines
901 B
TypeScript
"use client"
|
|
|
|
import { speak } from "@/lib/speech"
|
|
|
|
export interface CPAExerciseProps {
|
|
value: number
|
|
stage: "concrete" | "pictoric" | "abstract"
|
|
onCorrect: () => void
|
|
onIncorrect: () => void
|
|
}
|
|
|
|
export function generateCPAItems(value: number, stage: string): Array<{ emoji: string; id: number }> {
|
|
const pool = ["🍎", "🐱", "⭐", "🌸", "🎈", "🐶", "🍪", "🌈", "🦋", "🧸"]
|
|
return Array.from({ length: value }, (_, i) => ({
|
|
emoji: pool[i % pool.length],
|
|
id: i,
|
|
}))
|
|
}
|
|
|
|
export function speakCPAInstruction(value: number, stage: string) {
|
|
if (stage === "concrete") {
|
|
speak(`Tocá ${value} ${getItemName(value)}`)
|
|
} else if (stage === "pictoric") {
|
|
speak(`¿Cuántos hay? Señalá el número`)
|
|
} else {
|
|
speak(`¿Este número es el ${value}?`)
|
|
}
|
|
}
|
|
|
|
function getItemName(n: number): string {
|
|
if (n === 1) return "elemento"
|
|
return "elementos"
|
|
}
|