Initial import
2
.env.example
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# URL del servicio local de generación de imágenes (FastAPI + Diffusers)
|
||||||
|
IMAGE_SERVICE_URL=http://localhost:8001
|
||||||
12
.gitignore
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
node_modules/
|
||||||
|
.vscode/
|
||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
|
.venv/
|
||||||
|
app/node_modules/
|
||||||
|
app/dist/
|
||||||
|
backend/node_modules/
|
||||||
|
web/node_modules/
|
||||||
|
content/generated/**/*.tmp
|
||||||
|
/tmp/
|
||||||
|
__pycache__/
|
||||||
25
README.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Proyecto Lectura Integral
|
||||||
|
|
||||||
|
Aplicación educativa para navegadores + dashboard web para seguir el progreso de lectura (método Doman + Montessori + Reggio Emilia) con generación de contenido mediante un motor local (Diffusers + SD Turbo) integrado al backend NestJS.
|
||||||
|
|
||||||
|
## Estructura inicial
|
||||||
|
- `app/`: webapp React + Vite (TypeScript) para el niño, pensada como PWA usable en cualquier tablet/navegador.
|
||||||
|
- `backend/`: API NestJS + TypeScript con métricas, sincronización y servicio Gemini compartido.
|
||||||
|
- `web/`: dashboard React (Vite + TS) con paneles de progreso y disparadores de contenido para adultos.
|
||||||
|
- `content/`: plantillas de palabras, fonemas, historias y assets reutilizables.
|
||||||
|
- `progreso/`: registros en Markdown con bitácora y TODOs.
|
||||||
|
|
||||||
|
## Variables de entorno
|
||||||
|
- `.env`: define `IMAGE_SERVICE_URL` (ver `.env.example`) para apuntar al servicio FastAPI de generación local (por defecto `http://localhost:8001`).
|
||||||
|
- `app/.env`: configura `VITE_API_BASE_URL` (por defecto `http://localhost:3000`) para que la webapp consuma las imágenes/servicios del backend.
|
||||||
|
|
||||||
|
## Próximos pasos sugeridos
|
||||||
|
1. Afinar contenido inicial (palabras, fonemas, guiones de historias) y generar assets base.
|
||||||
|
2. Conectar apps al backend (auth simple, endpoints de progreso) y compartir tipado vía paquete común.
|
||||||
|
3. Integrar cliente Gemini (texto + imagen) con caché local y panel de revisión.
|
||||||
|
4. Diseñar almacenamiento offline/sincronización en mobile + visualizaciones detalladas en web.
|
||||||
|
|
||||||
|
## Generación automática local
|
||||||
|
- El backend Nest expone `/global-words` y `/global-words/:slug/image`. El primer request a cada imagen llama al servicio local (`image-service`, FastAPI + Diffusers con `stabilityai/sd-turbo`) y cachea el resultado en `content/generated/global-words/`.
|
||||||
|
- Al iniciar `backend` se lanza un prefetch en background para cubrir todas las palabras pre-cargadas sin intervención manual.
|
||||||
|
- La webapp PWA apunta a esas rutas via `VITE_API_BASE_URL` y muestra un reto de asociación palabra-imagen una vez que la ilustración está lista.
|
||||||
1
app/.env.example
Normal file
@@ -0,0 +1 @@
|
|||||||
|
VITE_API_BASE_URL=http://localhost:3000
|
||||||
24
app/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
73
app/README.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# React + TypeScript + Vite
|
||||||
|
|
||||||
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||||
|
|
||||||
|
Currently, two official plugins are available:
|
||||||
|
|
||||||
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
||||||
|
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||||
|
|
||||||
|
## React Compiler
|
||||||
|
|
||||||
|
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
||||||
|
|
||||||
|
## Expanding the ESLint configuration
|
||||||
|
|
||||||
|
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
||||||
|
|
||||||
|
```js
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
extends: [
|
||||||
|
// Other configs...
|
||||||
|
|
||||||
|
// Remove tseslint.configs.recommended and replace with this
|
||||||
|
tseslint.configs.recommendedTypeChecked,
|
||||||
|
// Alternatively, use this for stricter rules
|
||||||
|
tseslint.configs.strictTypeChecked,
|
||||||
|
// Optionally, add this for stylistic rules
|
||||||
|
tseslint.configs.stylisticTypeChecked,
|
||||||
|
|
||||||
|
// Other configs...
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
// other options...
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// eslint.config.js
|
||||||
|
import reactX from 'eslint-plugin-react-x'
|
||||||
|
import reactDom from 'eslint-plugin-react-dom'
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
extends: [
|
||||||
|
// Other configs...
|
||||||
|
// Enable lint rules for React
|
||||||
|
reactX.configs['recommended-typescript'],
|
||||||
|
// Enable lint rules for React DOM
|
||||||
|
reactDom.configs.recommended,
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
// other options...
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
```
|
||||||
23
app/eslint.config.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import js from '@eslint/js'
|
||||||
|
import globals from 'globals'
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
|
import tseslint from 'typescript-eslint'
|
||||||
|
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
extends: [
|
||||||
|
js.configs.recommended,
|
||||||
|
tseslint.configs.recommended,
|
||||||
|
reactHooks.configs.flat.recommended,
|
||||||
|
reactRefresh.configs.vite,
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
13
app/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>app</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
3220
app/package-lock.json
generated
Normal file
30
app/package.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "app",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "tsc -b && vite build",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react": "^19.2.0",
|
||||||
|
"react-dom": "^19.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.39.1",
|
||||||
|
"@types/node": "^24.10.1",
|
||||||
|
"@types/react": "^19.2.5",
|
||||||
|
"@types/react-dom": "^19.2.3",
|
||||||
|
"@vitejs/plugin-react": "^5.1.1",
|
||||||
|
"eslint": "^9.39.1",
|
||||||
|
"eslint-plugin-react-hooks": "^7.0.1",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.24",
|
||||||
|
"globals": "^16.5.0",
|
||||||
|
"typescript": "~5.9.3",
|
||||||
|
"typescript-eslint": "^8.46.4",
|
||||||
|
"vite": "^7.2.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
app/public/vite.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
593
app/src/App.css
Normal file
@@ -0,0 +1,593 @@
|
|||||||
|
@keyframes pulse {
|
||||||
|
0% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-shell {
|
||||||
|
max-width: 1220px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2rem 1.25rem 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
background: linear-gradient(135deg, #0f3c77, #1f5fd8);
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 1.5rem;
|
||||||
|
padding: 2rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.5rem;
|
||||||
|
box-shadow: 0 20px 60px rgba(15, 60, 119, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-top {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
align-self: flex-start;
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.35rem 1rem;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
font-size: clamp(2rem, 4vw, 3.2rem);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-text {
|
||||||
|
margin: 0;
|
||||||
|
max-width: 600px;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color: rgba(255, 255, 255, 0.92);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-tag {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
padding: 0.35rem 0.9rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-card {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-stat {
|
||||||
|
background: rgba(255, 255, 255, 0.18);
|
||||||
|
border-radius: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-stat span {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-panel {
|
||||||
|
margin-top: 2rem;
|
||||||
|
background: #fdfdff;
|
||||||
|
border-radius: 1.5rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
box-shadow: 0 20px 50px rgba(21, 54, 109, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-module {
|
||||||
|
display: grid;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-card {
|
||||||
|
border-radius: 1.4rem;
|
||||||
|
background: linear-gradient(135deg, #fef6d7, #ffd6e8);
|
||||||
|
padding: 1.5rem;
|
||||||
|
display: grid;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.word-letter-row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
margin: 0 0 0.5rem;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.original-word {
|
||||||
|
margin: 0.2rem 0 0.8rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: rgba(15, 35, 68, 0.7);
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-tags {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-figure {
|
||||||
|
margin: 1rem 0;
|
||||||
|
border-radius: 1.2rem;
|
||||||
|
padding: 1rem;
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-emoji {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-figure-media {
|
||||||
|
width: min(260px, 100%);
|
||||||
|
border-radius: 1rem;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
box-shadow: 0 15px 30px rgba(15, 35, 68, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-placeholder {
|
||||||
|
width: 100%;
|
||||||
|
height: 240px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
45deg,
|
||||||
|
rgba(15, 35, 68, 0.08),
|
||||||
|
rgba(15, 35, 68, 0.08) 10px,
|
||||||
|
rgba(15, 35, 68, 0.15) 10px,
|
||||||
|
rgba(15, 35, 68, 0.15) 20px
|
||||||
|
);
|
||||||
|
color: #0f2344;
|
||||||
|
font-weight: 700;
|
||||||
|
border-radius: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-figure-media img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-badge {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
bottom: 10px;
|
||||||
|
background: rgba(15, 35, 68, 0.85);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
padding: 0.25rem 0.8rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-figure p {
|
||||||
|
margin: 0;
|
||||||
|
color: #333f63;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spelling-panel {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 220px;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spelling-label {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0;
|
||||||
|
color: #0f3c77;
|
||||||
|
}
|
||||||
|
|
||||||
|
.letter-row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.4rem;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.letter-card {
|
||||||
|
min-width: 48px;
|
||||||
|
padding: 0.6rem 0.9rem;
|
||||||
|
border-radius: 0.9rem;
|
||||||
|
background: #0f2344;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 1.3rem;
|
||||||
|
font-weight: 800;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 12px 20px rgba(15, 35, 68, 0.25);
|
||||||
|
transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.letter-card:hover {
|
||||||
|
background: #ffb347;
|
||||||
|
color: #09203f;
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 16px 28px rgba(15, 35, 68, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.letter-card.big {
|
||||||
|
min-width: 58px;
|
||||||
|
font-size: clamp(1.6rem, 4vw, 2.4rem);
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-choices {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
||||||
|
gap: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.choice-button {
|
||||||
|
border: none;
|
||||||
|
border-radius: 1rem;
|
||||||
|
padding: 0.9rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
background: rgba(15, 35, 68, 0.08);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.15s ease, background 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.choice-button.correct {
|
||||||
|
background: rgba(15, 145, 84, 0.15);
|
||||||
|
color: #0b6834;
|
||||||
|
}
|
||||||
|
|
||||||
|
.choice-button.incorrect {
|
||||||
|
background: rgba(201, 50, 50, 0.15);
|
||||||
|
color: #862424;
|
||||||
|
}
|
||||||
|
|
||||||
|
.choice-feedback {
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0.4rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.choice-feedback.ok {
|
||||||
|
color: #0b6834;
|
||||||
|
}
|
||||||
|
|
||||||
|
.choice-feedback.oops {
|
||||||
|
color: #a52b2b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip {
|
||||||
|
padding: 0.2rem 0.85rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 600;
|
||||||
|
background: rgba(16, 35, 68, 0.15);
|
||||||
|
color: #0f2344;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-description {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
margin: 0.4rem 0 0;
|
||||||
|
color: #2c3454;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-progress {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-track {
|
||||||
|
width: 100%;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(15, 35, 68, 0.15);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-fill {
|
||||||
|
height: 100%;
|
||||||
|
border-radius: inherit;
|
||||||
|
background: linear-gradient(90deg, #ff7e5f, #feb47b);
|
||||||
|
transition: width 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls-row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-button {
|
||||||
|
border: none;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.65rem 1.4rem;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
background: #fff;
|
||||||
|
color: #0f2344;
|
||||||
|
box-shadow: 0 10px 20px rgba(15, 35, 68, 0.15);
|
||||||
|
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-button:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-button.primary {
|
||||||
|
background: linear-gradient(135deg, #ffb347, #ffcc33);
|
||||||
|
color: #09203f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-button.active {
|
||||||
|
background: #10233f;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speed-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speed-button {
|
||||||
|
border: none;
|
||||||
|
background: rgba(16, 35, 68, 0.12);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.4rem 0.9rem;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speed-button.active {
|
||||||
|
background: #0f3c77;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.global-lists {
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 1.2rem;
|
||||||
|
padding: 1rem;
|
||||||
|
box-shadow: inset 0 0 0 1px rgba(15, 35, 68, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel h3 {
|
||||||
|
margin: 0 0 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-chip {
|
||||||
|
padding: 0.35rem 0.75rem;
|
||||||
|
background: rgba(12, 57, 145, 0.08);
|
||||||
|
border-radius: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.favorites-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.favorite-chip {
|
||||||
|
background: rgba(255, 255, 255, 0.9);
|
||||||
|
border-radius: 0.9rem;
|
||||||
|
padding: 0.35rem 0.8rem;
|
||||||
|
box-shadow: 0 8px 16px rgba(15, 35, 68, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fonética */
|
||||||
|
.phonics-grid {
|
||||||
|
display: grid;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phoneme-scroll {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phoneme-button {
|
||||||
|
border: none;
|
||||||
|
border-radius: 1rem;
|
||||||
|
padding: 0.85rem;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 700;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 15px 30px rgba(85, 106, 168, 0.15);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.15s ease, background 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phoneme-button.active {
|
||||||
|
background: linear-gradient(135deg, #78ffd6, #a8ff78);
|
||||||
|
}
|
||||||
|
|
||||||
|
.phoneme-detail {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 1.2rem;
|
||||||
|
padding: 1.25rem;
|
||||||
|
box-shadow: inset 0 0 0 1px rgba(15, 35, 68, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.syllable-lab {
|
||||||
|
background: linear-gradient(135deg, #eef2ff, #f5f9ff);
|
||||||
|
border-radius: 1.2rem;
|
||||||
|
padding: 1.25rem;
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vowel-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vowel-button {
|
||||||
|
border: none;
|
||||||
|
border-radius: 0.9rem;
|
||||||
|
padding: 0.4rem 0.9rem;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 700;
|
||||||
|
background: rgba(16, 35, 68, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.vowel-button.active {
|
||||||
|
background: #0f3c77;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.syllable-display {
|
||||||
|
font-size: 2.8rem;
|
||||||
|
font-weight: 800;
|
||||||
|
text-align: center;
|
||||||
|
color: #10233f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.track {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.track-item {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 0.85rem;
|
||||||
|
padding: 0.45rem 0.9rem;
|
||||||
|
font-weight: 700;
|
||||||
|
box-shadow: 0 8px 20px rgba(15, 35, 68, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Historias */
|
||||||
|
.story-grid {
|
||||||
|
display: grid;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.story-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.story-card {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 1.2rem;
|
||||||
|
padding: 1rem;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 0 12px 25px rgba(13, 40, 80, 0.08);
|
||||||
|
transition: transform 0.15s ease, border 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.story-card.active {
|
||||||
|
border-color: #ffd347;
|
||||||
|
}
|
||||||
|
|
||||||
|
.story-card h4 {
|
||||||
|
margin: 0 0 0.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.story-detail {
|
||||||
|
background: linear-gradient(135deg, #fff4d9, #ffe7ff);
|
||||||
|
border-radius: 1.2rem;
|
||||||
|
padding: 1.25rem;
|
||||||
|
box-shadow: 0 15px 40px rgba(45, 28, 81, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt-box {
|
||||||
|
background: rgba(255, 255, 255, 0.85);
|
||||||
|
border-radius: 1rem;
|
||||||
|
padding: 0.9rem;
|
||||||
|
margin-top: 0.8rem;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt-actions {
|
||||||
|
margin-top: 0.6rem;
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.note-area {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 1rem;
|
||||||
|
border: none;
|
||||||
|
padding: 0.8rem;
|
||||||
|
font-family: inherit;
|
||||||
|
resize: none;
|
||||||
|
min-height: 90px;
|
||||||
|
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.questions-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.35rem;
|
||||||
|
padding-left: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-pill {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.25rem;
|
||||||
|
padding: 0.3rem 0.7rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
background: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.copied {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #0b6834;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 900px) {
|
||||||
|
.hero {
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.hero-card {
|
||||||
|
max-width: 320px;
|
||||||
|
}
|
||||||
|
}
|
||||||
86
app/src/App.tsx
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import './App.css'
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { ModuleTabs, type ModuleKey } from './components/ModuleTabs'
|
||||||
|
import { GlobalReading } from './modules/GlobalReading'
|
||||||
|
import { PhonicsPlay } from './modules/PhonicsPlay'
|
||||||
|
import { StoryLab } from './modules/StoryLab'
|
||||||
|
import { globalWords, highlightWords } from './data/globalWords'
|
||||||
|
import { phonemeDeck } from './data/phonemes'
|
||||||
|
import { storyPrompts } from './data/stories'
|
||||||
|
import { HelpCenter } from './components/HelpCenter'
|
||||||
|
|
||||||
|
const modules = [
|
||||||
|
{
|
||||||
|
key: 'global' as ModuleKey,
|
||||||
|
title: 'Lectura global',
|
||||||
|
emoji: '🚗',
|
||||||
|
description: 'Tarjetas rápidas estilo Doman con palabras favoritas.',
|
||||||
|
accent: '#ffcc33',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'phonics' as ModuleKey,
|
||||||
|
title: 'Fonética Montessori',
|
||||||
|
emoji: '🔤',
|
||||||
|
description: 'Sílabas táctiles y retos de sonido.',
|
||||||
|
accent: '#87d1ff',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'stories' as ModuleKey,
|
||||||
|
title: 'Historias Reggio',
|
||||||
|
emoji: '📚',
|
||||||
|
description: 'Cuentos personalizados e ideas de conversación.',
|
||||||
|
accent: '#ff8cc6',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const [activeModule, setActiveModule] = useState<ModuleKey>('global')
|
||||||
|
return (
|
||||||
|
<div className="app-shell">
|
||||||
|
<header className="hero">
|
||||||
|
<div className="hero-top">
|
||||||
|
<span className="badge">Doman + Montessori + Reggio Emilia</span>
|
||||||
|
<h1 className="hero-title">Destino Lectura Milo</h1>
|
||||||
|
<p className="hero-text">
|
||||||
|
Tarjetas veloces como autos de carrera, fonética manos a la obra y cuentos con la
|
||||||
|
Bombonera mágica. Todo desde el navegador para cualquier tablet.
|
||||||
|
</p>
|
||||||
|
<div className="hero-tags">
|
||||||
|
{highlightWords.slice(0, 4).map((word) => (
|
||||||
|
<span key={word.palabra} className="hero-tag">
|
||||||
|
{word.palabra}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
<span className="hero-tag">Boca Juniors 💛💙</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="hero-card">
|
||||||
|
<div className="hero-stat">
|
||||||
|
<span>{globalWords.length}</span>
|
||||||
|
palabras listas
|
||||||
|
</div>
|
||||||
|
<div className="hero-stat">
|
||||||
|
<span>{phonemeDeck.length}</span>
|
||||||
|
fonemas táctiles
|
||||||
|
</div>
|
||||||
|
<div className="hero-stat">
|
||||||
|
<span>{storyPrompts.length}</span>
|
||||||
|
historias guía
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<ModuleTabs modules={modules} active={activeModule} onSelect={setActiveModule} />
|
||||||
|
|
||||||
|
<div className="module-panel">
|
||||||
|
{activeModule === 'global' && <GlobalReading />}
|
||||||
|
{activeModule === 'phonics' && <PhonicsPlay />}
|
||||||
|
{activeModule === 'stories' && <StoryLab />}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<HelpCenter />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App
|
||||||
1
app/src/assets/react.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 4.0 KiB |
69
app/src/components/HelpCenter.css
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
.help-center {
|
||||||
|
margin-top: 2.5rem;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 1.5rem;
|
||||||
|
padding: 1.75rem;
|
||||||
|
box-shadow: 0 25px 50px rgba(12, 31, 65, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.helper-emoji {
|
||||||
|
font-size: 2.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-text {
|
||||||
|
margin: 0.35rem 0 0;
|
||||||
|
max-width: 520px;
|
||||||
|
color: #435373;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-grid {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-card {
|
||||||
|
border-radius: 1.2rem;
|
||||||
|
border: 1px solid rgba(20, 40, 80, 0.08);
|
||||||
|
padding: 1.25rem;
|
||||||
|
background: rgba(246, 249, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-card-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.6rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-icon {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-card h3 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-card ul {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 1.2rem;
|
||||||
|
color: #2c3759;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.4rem;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge.secondary {
|
||||||
|
background: rgba(16, 60, 119, 0.08);
|
||||||
|
color: #0f3c77;
|
||||||
|
}
|
||||||
68
app/src/components/HelpCenter.tsx
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import './HelpCenter.css'
|
||||||
|
|
||||||
|
const helpCards = [
|
||||||
|
{
|
||||||
|
emoji: '🚗',
|
||||||
|
title: 'Lectura global',
|
||||||
|
steps: [
|
||||||
|
'Mira la imagen grande y di la palabra en voz alta.',
|
||||||
|
'Toca la palabra correcta entre las opciones para relacionar palabra-imagen.',
|
||||||
|
'Activa “Modo ráfaga” para repasar rápidamente y agrega favoritas para repetirlas más tarde.',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emoji: '🔤',
|
||||||
|
title: 'Fonética Montessori',
|
||||||
|
steps: [
|
||||||
|
'Elige un fonema y haz el gesto Montessori con la boca/manos.',
|
||||||
|
'Combínalo con vocales para crear sílabas y arrástralas al circuito (botón “Agregar al circuito”).',
|
||||||
|
'Usa “Reto relámpago” para mezclar sonidos sorpresa y repetirlos con autos imaginarios.',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
emoji: '📚',
|
||||||
|
title: 'Historias Reggio',
|
||||||
|
steps: [
|
||||||
|
'Selecciona un cuento, lee el escenario y genera prompts para Gemini (texto + imagen).',
|
||||||
|
'Guarda notas de lo que dice el niño y formula preguntas Reggio (“¿Por qué...?”).',
|
||||||
|
'Marca “Listo para Milo” cuando la historia esté aprobada y usa las preguntas para conversar.',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export function HelpCenter() {
|
||||||
|
return (
|
||||||
|
<section className="help-center" aria-labelledby="ayuda-heading">
|
||||||
|
<div className="help-header">
|
||||||
|
<div>
|
||||||
|
<p className="badge secondary">Centro de ayuda</p>
|
||||||
|
<h2 id="ayuda-heading">¿Cómo jugamos?</h2>
|
||||||
|
<p className="help-text">
|
||||||
|
Breve guía para adultos y peques: cada módulo mezcla lectura global, fonética Montessori
|
||||||
|
y conversación Reggio para que Milo aprenda jugando.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<span className="helper-emoji" role="img" aria-label="Guía">
|
||||||
|
🧠✨
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="help-grid">
|
||||||
|
{helpCards.map((card) => (
|
||||||
|
<article key={card.title} className="help-card">
|
||||||
|
<div className="help-card-head">
|
||||||
|
<span className="help-icon" aria-hidden>
|
||||||
|
{card.emoji}
|
||||||
|
</span>
|
||||||
|
<h3>{card.title}</h3>
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
{card.steps.map((step) => (
|
||||||
|
<li key={step}>{step}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</article>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
55
app/src/components/ModuleTabs.css
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
.module-tabs {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin: 1.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-tab {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
border-radius: 1rem;
|
||||||
|
border: 3px solid transparent;
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
box-shadow: 0 10px 30px rgba(16, 35, 68, 0.1);
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: left;
|
||||||
|
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-tab:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 12px 35px rgba(16, 35, 68, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-tab.active {
|
||||||
|
background: #10233f;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-tab.active .module-description {
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-emoji {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-title {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-description {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
margin: 0.15rem 0 0;
|
||||||
|
color: #3d506f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.module-tabs {
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
40
app/src/components/ModuleTabs.tsx
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import './ModuleTabs.css'
|
||||||
|
|
||||||
|
export type ModuleKey = 'global' | 'phonics' | 'stories'
|
||||||
|
|
||||||
|
export interface ModuleDefinition {
|
||||||
|
key: ModuleKey
|
||||||
|
title: string
|
||||||
|
emoji: string
|
||||||
|
description: string
|
||||||
|
accent: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
modules: ModuleDefinition[]
|
||||||
|
active: ModuleKey
|
||||||
|
onSelect: (key: ModuleKey) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ModuleTabs({ modules, active, onSelect }: Props) {
|
||||||
|
return (
|
||||||
|
<div className="module-tabs">
|
||||||
|
{modules.map((module) => (
|
||||||
|
<button
|
||||||
|
key={module.key}
|
||||||
|
className={`module-tab ${active === module.key ? 'active' : ''}`}
|
||||||
|
style={{ borderColor: module.accent }}
|
||||||
|
onClick={() => onSelect(module.key)}
|
||||||
|
>
|
||||||
|
<span className="module-emoji" aria-hidden>
|
||||||
|
{module.emoji}
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<p className="module-title">{module.title}</p>
|
||||||
|
<p className="module-description">{module.description}</p>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
1
app/src/config.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:3000'
|
||||||
19
app/src/data/globalWords.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import rawWords from '@content/palabras-globales.json'
|
||||||
|
import type { GlobalWord, GlobalWordWithSlug } from '../types/content'
|
||||||
|
import { slugify } from '../utils/slug'
|
||||||
|
|
||||||
|
export const globalWords = (rawWords as GlobalWordWithSlug[]).map((word) => ({
|
||||||
|
...word,
|
||||||
|
slug: slugify(word.palabra),
|
||||||
|
}))
|
||||||
|
|
||||||
|
export const wordThemes = Array.from(
|
||||||
|
globalWords.reduce<Map<string, GlobalWord[]>>((acc, word) => {
|
||||||
|
const bucket = acc.get(word.tema) ?? []
|
||||||
|
bucket.push(word)
|
||||||
|
acc.set(word.tema, bucket)
|
||||||
|
return acc
|
||||||
|
}, new Map())
|
||||||
|
).map(([tema, palabras]) => ({ tema, palabras }))
|
||||||
|
|
||||||
|
export const highlightWords = globalWords.slice(0, 6)
|
||||||
6
app/src/data/phonemes.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import rawPhonemes from '@content/fonemas-iniciales.json'
|
||||||
|
import type { PhonemeCard } from '../types/content'
|
||||||
|
|
||||||
|
export const phonemeDeck = rawPhonemes as PhonemeCard[]
|
||||||
|
|
||||||
|
export const defaultPhoneme = phonemeDeck[0]
|
||||||
4
app/src/data/stories.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import rawStories from '@content/historias-tematicas.json'
|
||||||
|
import type { StoryPrompt } from '../types/content'
|
||||||
|
|
||||||
|
export const storyPrompts = rawStories as StoryPrompt[]
|
||||||
31
app/src/index.css
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
:root {
|
||||||
|
font-family: 'Nunito', 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #10233f;
|
||||||
|
background-color: #e7f1ff;
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
*, *::before, *::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
min-height: 100vh;
|
||||||
|
background: radial-gradient(circle at top, #fdf5ff, #e5f2ff 45%, #e8efff 100%);
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
10
app/src/main.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { StrictMode } from 'react'
|
||||||
|
import { createRoot } from 'react-dom/client'
|
||||||
|
import './index.css'
|
||||||
|
import App from './App.tsx'
|
||||||
|
|
||||||
|
createRoot(document.getElementById('root')!).render(
|
||||||
|
<StrictMode>
|
||||||
|
<App />
|
||||||
|
</StrictMode>,
|
||||||
|
)
|
||||||
285
app/src/modules/GlobalReading.tsx
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
|
import { globalWords } from '../data/globalWords'
|
||||||
|
import { API_BASE_URL } from '../config'
|
||||||
|
|
||||||
|
const exposuresGoal = 5
|
||||||
|
const speedOptions = [
|
||||||
|
{ label: 'Suave', ms: 2600 },
|
||||||
|
{ label: 'Normal', ms: 1800 },
|
||||||
|
{ label: 'Turbo', ms: 1100 },
|
||||||
|
]
|
||||||
|
|
||||||
|
const shuffle = <T,>(items: T[]): T[] => {
|
||||||
|
const array = [...items]
|
||||||
|
for (let i = array.length - 1; i > 0; i -= 1) {
|
||||||
|
const j = Math.floor(Math.random() * (i + 1))
|
||||||
|
;[array[i], array[j]] = [array[j], array[i]]
|
||||||
|
}
|
||||||
|
return array
|
||||||
|
}
|
||||||
|
|
||||||
|
const buildChoices = (palabra: string, total = 4) => {
|
||||||
|
const otherWords = globalWords.filter((item) => item.palabra !== palabra).map((item) => item.palabra)
|
||||||
|
const randomOthers = shuffle(otherWords).slice(0, total - 1)
|
||||||
|
return shuffle([palabra, ...randomOthers])
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GlobalReading() {
|
||||||
|
const [currentIndex, setCurrentIndex] = useState(0)
|
||||||
|
const [autoPlay, setAutoPlay] = useState(false)
|
||||||
|
const [speed, setSpeed] = useState(speedOptions[1].ms)
|
||||||
|
const [history, setHistory] = useState<string[]>([])
|
||||||
|
const [favorites, setFavorites] = useState<string[]>([])
|
||||||
|
const [exposures, setExposures] = useState<Record<string, number>>({})
|
||||||
|
const [choices, setChoices] = useState<string[]>(() => buildChoices(globalWords[0].palabra))
|
||||||
|
const [selectedChoice, setSelectedChoice] = useState<string | null>(null)
|
||||||
|
const [isMatchCorrect, setIsMatchCorrect] = useState<boolean | null>(null)
|
||||||
|
const [imageCache, setImageCache] = useState<Record<string, string>>({})
|
||||||
|
const [imageStatus, setImageStatus] = useState<Record<string, 'loading' | 'ready' | 'error'>>({})
|
||||||
|
|
||||||
|
const currentWord = globalWords[currentIndex]
|
||||||
|
const exposureProgress = (exposures[currentWord.palabra] ?? 0) / exposuresGoal
|
||||||
|
|
||||||
|
const advance = useCallback(() => {
|
||||||
|
setCurrentIndex((prevIndex) => {
|
||||||
|
const shownWord = globalWords[prevIndex]
|
||||||
|
setHistory((prev) => {
|
||||||
|
const next = [shownWord.palabra, ...prev.filter((word) => word !== shownWord.palabra)]
|
||||||
|
return next.slice(0, 6)
|
||||||
|
})
|
||||||
|
setExposures((prev) => ({
|
||||||
|
...prev,
|
||||||
|
[shownWord.palabra]: Math.min(exposuresGoal, (prev[shownWord.palabra] ?? 0) + 1),
|
||||||
|
}))
|
||||||
|
return (prevIndex + 1) % globalWords.length
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setChoices(buildChoices(currentWord.palabra))
|
||||||
|
setSelectedChoice(null)
|
||||||
|
setIsMatchCorrect(null)
|
||||||
|
}, [currentWord.palabra])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const slug = currentWord.slug
|
||||||
|
setImageCache((prev) => {
|
||||||
|
if (prev[slug]) return prev
|
||||||
|
const url = `${API_BASE_URL}/global-words/${slug}/image?ts=${Date.now()}`
|
||||||
|
return { ...prev, [slug]: url }
|
||||||
|
})
|
||||||
|
setImageStatus((prev) => {
|
||||||
|
if (prev[slug]) return prev
|
||||||
|
return { ...prev, [slug]: 'loading' }
|
||||||
|
})
|
||||||
|
}, [currentWord.slug])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!autoPlay) return
|
||||||
|
const id = window.setInterval(advance, speed)
|
||||||
|
return () => window.clearInterval(id)
|
||||||
|
}, [autoPlay, advance, speed])
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
setCurrentIndex((prev) => (prev - 1 + globalWords.length) % globalWords.length)
|
||||||
|
}
|
||||||
|
|
||||||
|
const toggleFavorite = () => {
|
||||||
|
setFavorites((prev) =>
|
||||||
|
prev.includes(currentWord.palabra)
|
||||||
|
? prev.filter((word) => word !== currentWord.palabra)
|
||||||
|
: [...prev, currentWord.palabra]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleChoice = (option: string) => {
|
||||||
|
setSelectedChoice(option)
|
||||||
|
setIsMatchCorrect(option === currentWord.palabra)
|
||||||
|
}
|
||||||
|
|
||||||
|
const retryImage = () => {
|
||||||
|
const slug = currentWord.slug
|
||||||
|
const retryUrl = `${API_BASE_URL}/global-words/${slug}/image?ts=${Date.now()}`
|
||||||
|
setImageCache((prev) => ({ ...prev, [slug]: retryUrl }))
|
||||||
|
setImageStatus((prev) => ({ ...prev, [slug]: 'loading' }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleImageLoad = () => {
|
||||||
|
const slug = currentWord.slug
|
||||||
|
setImageStatus((prev) => ({ ...prev, [slug]: 'ready' }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleImageError = () => {
|
||||||
|
const slug = currentWord.slug
|
||||||
|
setImageStatus((prev) => ({ ...prev, [slug]: 'error' }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentImage = imageCache[currentWord.slug]
|
||||||
|
const currentImageStatus = imageStatus[currentWord.slug]
|
||||||
|
const spelledLetters = useMemo(() => {
|
||||||
|
const normalized = currentWord.palabra
|
||||||
|
.normalize('NFD')
|
||||||
|
.replace(/[\u0300-\u036f]/g, '')
|
||||||
|
.replace(/\s+/g, '')
|
||||||
|
return normalized.split('').map((char) => char.toUpperCase())
|
||||||
|
}, [currentWord.palabra])
|
||||||
|
const spelledWord = spelledLetters.join(' ')
|
||||||
|
|
||||||
|
const masteryCount = useMemo(
|
||||||
|
() => Object.values(exposures).filter((count) => count >= exposuresGoal).length,
|
||||||
|
[exposures]
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="global-module">
|
||||||
|
<div className="global-card">
|
||||||
|
<div>
|
||||||
|
<p className="chip">Palabra #{currentIndex + 1}</p>
|
||||||
|
<div className="word-letter-row" aria-label={currentWord.palabra}>
|
||||||
|
{spelledLetters.map((letter, index) => (
|
||||||
|
<span key={`title-${letter}-${index}`} className="letter-card big">
|
||||||
|
{letter}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<p className="original-word">{currentWord.palabra}</p>
|
||||||
|
<div className="global-tags">
|
||||||
|
<span className="chip">{currentWord.categoria}</span>
|
||||||
|
<span className="chip">{currentWord.tema}</span>
|
||||||
|
</div>
|
||||||
|
<div className="global-figure">
|
||||||
|
<div className="global-figure-media">
|
||||||
|
{currentImage ? (
|
||||||
|
<>
|
||||||
|
<img
|
||||||
|
src={currentImage}
|
||||||
|
alt={`Ilustración de ${currentWord.palabra}`}
|
||||||
|
onLoad={handleImageLoad}
|
||||||
|
onError={handleImageError}
|
||||||
|
/>
|
||||||
|
{currentImageStatus !== 'ready' && (
|
||||||
|
<span className="image-badge">
|
||||||
|
{currentImageStatus === 'loading'
|
||||||
|
? 'Generando ilustración...'
|
||||||
|
: 'Error al cargar'}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="image-placeholder">Generando ilustración...</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="spelling-panel">
|
||||||
|
<p className="spelling-label">Así se escribe</p>
|
||||||
|
<div className="letter-row" aria-label={`Letras: ${spelledWord}`}>
|
||||||
|
{spelledLetters.map((letter, index) => (
|
||||||
|
<span key={`panel-${letter}-${index}`} className="letter-card">
|
||||||
|
{letter}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<p className="global-description">{currentWord.descripcion}</p>
|
||||||
|
{currentImageStatus === 'error' && (
|
||||||
|
<button className="control-button" onClick={retryImage}>
|
||||||
|
Reintentar imagen
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="global-choices">
|
||||||
|
{choices.map((option) => (
|
||||||
|
<button
|
||||||
|
key={option}
|
||||||
|
className={`choice-button ${
|
||||||
|
option === selectedChoice
|
||||||
|
? isMatchCorrect
|
||||||
|
? 'correct'
|
||||||
|
: 'incorrect'
|
||||||
|
: ''
|
||||||
|
}`}
|
||||||
|
onClick={() => handleChoice(option)}
|
||||||
|
>
|
||||||
|
{option}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
{selectedChoice && (
|
||||||
|
<p className={`choice-feedback ${isMatchCorrect ? 'ok' : 'oops'}`}>
|
||||||
|
{isMatchCorrect ? '¡Excelente! Encajaste la palabra con la imagen.' : 'Probemos otra vez.'}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<div className="global-progress">
|
||||||
|
<small>
|
||||||
|
Exposiciones: {exposures[currentWord.palabra] ?? 0}/{exposuresGoal}
|
||||||
|
</small>
|
||||||
|
<div className="progress-track" aria-hidden>
|
||||||
|
<div className="progress-fill" style={{ width: `${exposureProgress * 100}%` }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="controls-row">
|
||||||
|
<button className="control-button" onClick={goBack}>
|
||||||
|
← Volver
|
||||||
|
</button>
|
||||||
|
<button className="control-button primary" onClick={advance}>
|
||||||
|
Siguiente →
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`control-button ${autoPlay ? 'active' : ''}`}
|
||||||
|
onClick={() => setAutoPlay((prev) => !prev)}
|
||||||
|
>
|
||||||
|
{autoPlay ? 'Detener ráfaga' : 'Modo ráfaga'}
|
||||||
|
</button>
|
||||||
|
<button className="control-button" onClick={toggleFavorite}>
|
||||||
|
{favorites.includes(currentWord.palabra) ? 'Quitar favorito' : 'Favorito 🚀'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<p style={{ margin: '0 0 0.35rem', fontWeight: 700 }}>Velocidad</p>
|
||||||
|
<div className="speed-buttons">
|
||||||
|
{speedOptions.map((option) => (
|
||||||
|
<button
|
||||||
|
key={option.label}
|
||||||
|
className={`speed-button ${speed === option.ms ? 'active' : ''}`}
|
||||||
|
onClick={() => setSpeed(option.ms)}
|
||||||
|
>
|
||||||
|
{option.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p style={{ margin: 0, fontWeight: 700 }}>
|
||||||
|
Palabras dominadas: {masteryCount}/{globalWords.length}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="global-lists">
|
||||||
|
<div className="panel">
|
||||||
|
<h3>Últimas palabras</h3>
|
||||||
|
<div className="history-list">
|
||||||
|
{history.length === 0 && <span>No hay historial aún.</span>}
|
||||||
|
{history.map((item) => (
|
||||||
|
<span key={item} className="history-chip">
|
||||||
|
{item}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="panel">
|
||||||
|
<h3>Favoritas de Milo</h3>
|
||||||
|
<div className="favorites-grid">
|
||||||
|
{favorites.length === 0 && <span>Toca ⭐ para guardarlas.</span>}
|
||||||
|
{favorites.map((word) => (
|
||||||
|
<span key={word} className="favorite-chip">
|
||||||
|
{word}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
106
app/src/modules/PhonicsPlay.tsx
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import { useMemo, useState } from 'react'
|
||||||
|
import { phonemeDeck, defaultPhoneme } from '../data/phonemes'
|
||||||
|
|
||||||
|
const vowels = ['a', 'e', 'i', 'o', 'u']
|
||||||
|
|
||||||
|
export function PhonicsPlay() {
|
||||||
|
const [selectedPhoneme, setSelectedPhoneme] = useState(defaultPhoneme)
|
||||||
|
const [activeVowel, setActiveVowel] = useState('a')
|
||||||
|
const [track, setTrack] = useState<string[]>([])
|
||||||
|
const [challenge, setChallenge] = useState<string | null>(null)
|
||||||
|
|
||||||
|
const syllable = useMemo(() => {
|
||||||
|
if (!selectedPhoneme) return ''
|
||||||
|
return `${selectedPhoneme.fonema}${activeVowel}`
|
||||||
|
}, [selectedPhoneme, activeVowel])
|
||||||
|
|
||||||
|
const addToTrack = () => {
|
||||||
|
if (!syllable) return
|
||||||
|
setTrack((prev) => [syllable, ...prev].slice(0, 8))
|
||||||
|
}
|
||||||
|
|
||||||
|
const spinChallenge = () => {
|
||||||
|
const randomPhoneme = phonemeDeck[Math.floor(Math.random() * phonemeDeck.length)]
|
||||||
|
const randomVowel = vowels[Math.floor(Math.random() * vowels.length)]
|
||||||
|
setSelectedPhoneme(randomPhoneme)
|
||||||
|
setActiveVowel(randomVowel)
|
||||||
|
setChallenge(`${randomPhoneme.fonema}${randomVowel}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!selectedPhoneme) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="phonics-grid">
|
||||||
|
<div className="phoneme-scroll">
|
||||||
|
{phonemeDeck.map((card) => (
|
||||||
|
<button
|
||||||
|
key={card.fonema}
|
||||||
|
className={`phoneme-button ${
|
||||||
|
card.fonema === selectedPhoneme.fonema ? 'active' : ''
|
||||||
|
}`}
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedPhoneme(card)
|
||||||
|
setChallenge(null)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span style={{ fontSize: '1.5rem' }}>{card.fonema}</span>
|
||||||
|
<small>{card.grafemas.join(', ')}</small>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="phoneme-detail">
|
||||||
|
<h3>Fonema /{selectedPhoneme.fonema}/</h3>
|
||||||
|
<p>
|
||||||
|
<strong>Gesto Montessori:</strong> {selectedPhoneme.gestoMontessori}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Palabras clave:</strong> {selectedPhoneme.palabrasClave.join(', ')}
|
||||||
|
</p>
|
||||||
|
<p>{selectedPhoneme.actividad}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="syllable-lab">
|
||||||
|
<div>
|
||||||
|
<p>Elige una vocal para combinar</p>
|
||||||
|
<div className="vowel-row">
|
||||||
|
{vowels.map((vowel) => (
|
||||||
|
<button
|
||||||
|
key={vowel}
|
||||||
|
className={`vowel-button ${activeVowel === vowel ? 'active' : ''}`}
|
||||||
|
onClick={() => setActiveVowel(vowel)}
|
||||||
|
>
|
||||||
|
{vowel.toUpperCase()}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="syllable-display">{syllable}</div>
|
||||||
|
<div className="controls-row">
|
||||||
|
<button className="control-button primary" onClick={addToTrack}>
|
||||||
|
Agregar al circuito
|
||||||
|
</button>
|
||||||
|
<button className="control-button" onClick={spinChallenge}>
|
||||||
|
Reto relámpago ⚡
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{challenge && (
|
||||||
|
<p>
|
||||||
|
Busca <strong>{challenge}</strong> en los cuentos o arma la ficha correcta para avanzar.
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<div>
|
||||||
|
<p style={{ margin: '0.5rem 0' }}>Trayecto practicado</p>
|
||||||
|
<div className="track">
|
||||||
|
{track.length === 0 && <span>Agrega sílabas para verlas aquí.</span>}
|
||||||
|
{track.map((item, index) => (
|
||||||
|
<span key={`${item}-${index}`} className="track-item">
|
||||||
|
{item}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
117
app/src/modules/StoryLab.tsx
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
import { useMemo, useState } from 'react'
|
||||||
|
import { storyPrompts } from '../data/stories'
|
||||||
|
|
||||||
|
export function StoryLab() {
|
||||||
|
const [selectedStory, setSelectedStory] = useState(storyPrompts[0])
|
||||||
|
const [notes, setNotes] = useState('')
|
||||||
|
const [copied, setCopied] = useState<string | null>(null)
|
||||||
|
const [approvedStories, setApprovedStories] = useState<Set<string>>(new Set())
|
||||||
|
|
||||||
|
const reggioQuestions = useMemo(
|
||||||
|
() => [
|
||||||
|
`¿Por qué crees que ${selectedStory.personajes[0]} se sintió así?`,
|
||||||
|
'¿Qué cambiarías tú en la escena?',
|
||||||
|
'¿Dónde escuchaste algo parecido antes?',
|
||||||
|
],
|
||||||
|
[selectedStory.personajes]
|
||||||
|
)
|
||||||
|
|
||||||
|
const copyPrompt = async (text: string, label: string) => {
|
||||||
|
if (navigator?.clipboard) {
|
||||||
|
await navigator.clipboard.writeText(text)
|
||||||
|
setCopied(label)
|
||||||
|
setTimeout(() => setCopied(null), 1600)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const toggleApproved = (title: string) => {
|
||||||
|
setApprovedStories((prev) => {
|
||||||
|
const updated = new Set(prev)
|
||||||
|
if (updated.has(title)) {
|
||||||
|
updated.delete(title)
|
||||||
|
} else {
|
||||||
|
updated.add(title)
|
||||||
|
}
|
||||||
|
return updated
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="story-grid">
|
||||||
|
<div className="story-list">
|
||||||
|
{storyPrompts.map((story) => (
|
||||||
|
<article
|
||||||
|
key={story.titulo}
|
||||||
|
className={`story-card ${selectedStory.titulo === story.titulo ? 'active' : ''}`}
|
||||||
|
onClick={() => setSelectedStory(story)}
|
||||||
|
>
|
||||||
|
<h4>{story.titulo}</h4>
|
||||||
|
<p style={{ margin: 0, fontSize: '0.9rem' }}>{story.escenario}</p>
|
||||||
|
<p style={{ fontSize: '0.85rem', margin: '0.4rem 0 0' }}>
|
||||||
|
🎯 {story.objetivo}
|
||||||
|
</p>
|
||||||
|
<p style={{ fontSize: '0.8rem', margin: '0.4rem 0 0' }}>
|
||||||
|
👥 {story.personajes.join(', ')}
|
||||||
|
</p>
|
||||||
|
<div className="status-pill" style={{ marginTop: '0.6rem' }}>
|
||||||
|
{approvedStories.has(story.titulo) ? 'Listo para contar ✅' : 'Borrador ✏️'}
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="story-detail">
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||||
|
<div>
|
||||||
|
<h3 style={{ margin: 0 }}>{selectedStory.titulo}</h3>
|
||||||
|
<p style={{ margin: '0.4rem 0' }}>{selectedStory.escenario}</p>
|
||||||
|
</div>
|
||||||
|
<button className="control-button primary" onClick={() => toggleApproved(selectedStory.titulo)}>
|
||||||
|
{approvedStories.has(selectedStory.titulo) ? 'Marcar como borrador' : 'Listo para Milo'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="prompt-box">
|
||||||
|
<strong>Prompt de texto para Gemini</strong>
|
||||||
|
<p style={{ margin: '0.4rem 0' }}>{selectedStory.promptTexto}</p>
|
||||||
|
<div className="prompt-actions">
|
||||||
|
<button className="control-button" onClick={() => copyPrompt(selectedStory.promptTexto, 'texto')}>
|
||||||
|
Copiar texto
|
||||||
|
</button>
|
||||||
|
{copied === 'texto' && <span className="copied">¡Copiado!</span>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="prompt-box">
|
||||||
|
<strong>Prompt de ilustración</strong>
|
||||||
|
<p style={{ margin: '0.4rem 0' }}>{selectedStory.promptImagen}</p>
|
||||||
|
<div className="prompt-actions">
|
||||||
|
<button className="control-button" onClick={() => copyPrompt(selectedStory.promptImagen, 'imagen')}>
|
||||||
|
Copiar imagen
|
||||||
|
</button>
|
||||||
|
{copied === 'imagen' && <span className="copied">¡Copiado!</span>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style={{ marginTop: '1rem' }}>
|
||||||
|
<h4>Preguntas Reggio</h4>
|
||||||
|
<div className="questions-list">
|
||||||
|
{reggioQuestions.map((question) => (
|
||||||
|
<span key={question}>• {question}</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style={{ marginTop: '1rem' }}>
|
||||||
|
<h4>Notas del adulto</h4>
|
||||||
|
<textarea
|
||||||
|
className="note-area"
|
||||||
|
placeholder="Escribe aquí ideas de Milo, palabras que quiere practicar o finales alternativos."
|
||||||
|
value={notes}
|
||||||
|
onChange={(event) => setNotes(event.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
27
app/src/types/content.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
export interface GlobalWord {
|
||||||
|
palabra: string
|
||||||
|
categoria: string
|
||||||
|
tema: string
|
||||||
|
descripcion: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GlobalWordWithSlug extends GlobalWord {
|
||||||
|
slug: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PhonemeCard {
|
||||||
|
fonema: string
|
||||||
|
grafemas: string[]
|
||||||
|
gestoMontessori: string
|
||||||
|
palabrasClave: string[]
|
||||||
|
actividad: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StoryPrompt {
|
||||||
|
titulo: string
|
||||||
|
escenario: string
|
||||||
|
personajes: string[]
|
||||||
|
objetivo: string
|
||||||
|
promptTexto: string
|
||||||
|
promptImagen: string
|
||||||
|
}
|
||||||
7
app/src/utils/slug.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export const slugify = (text: string) =>
|
||||||
|
text
|
||||||
|
.normalize('NFD')
|
||||||
|
.replace(/[\u0300-\u036f]/g, '')
|
||||||
|
.replace(/[^a-zA-Z0-9]+/g, '-')
|
||||||
|
.replace(/^-+|-+$/g, '')
|
||||||
|
.toLowerCase()
|
||||||
33
app/tsconfig.app.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"target": "ES2022",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"types": ["vite/client"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@content/*": ["../content/*"]
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["src", "../content/**/*.json"]
|
||||||
|
}
|
||||||
7
app/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./tsconfig.app.json" },
|
||||||
|
{ "path": "./tsconfig.node.json" }
|
||||||
|
]
|
||||||
|
}
|
||||||
30
app/tsconfig.node.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
"target": "ES2023",
|
||||||
|
"lib": ["ES2023"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"types": ["node"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@content/*": ["../content/*"]
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
||||||
18
app/vite.config.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
server: {
|
||||||
|
fs: {
|
||||||
|
allow: [path.resolve(__dirname, '..')],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@content': path.resolve(__dirname, '../content'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
56
backend/.gitignore
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# compiled output
|
||||||
|
/dist
|
||||||
|
/node_modules
|
||||||
|
/build
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
/coverage
|
||||||
|
/.nyc_output
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
/.idea
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# IDE - VSCode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
|
||||||
|
# dotenv environment variable files
|
||||||
|
.env
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
|
# temp directory
|
||||||
|
.temp
|
||||||
|
.tmp
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
4
backend/.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "all"
|
||||||
|
}
|
||||||
98
backend/README.md
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<p align="center">
|
||||||
|
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
||||||
|
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
||||||
|
|
||||||
|
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||||
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||||
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
||||||
|
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
||||||
|
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
||||||
|
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||||
|
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||||
|
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
|
||||||
|
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||||
|
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
|
||||||
|
</p>
|
||||||
|
<!--[](https://opencollective.com/nest#backer)
|
||||||
|
[](https://opencollective.com/nest#sponsor)-->
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
||||||
|
|
||||||
|
## Project setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compile and run the project
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# development
|
||||||
|
$ npm run start
|
||||||
|
|
||||||
|
# watch mode
|
||||||
|
$ npm run start:dev
|
||||||
|
|
||||||
|
# production mode
|
||||||
|
$ npm run start:prod
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# unit tests
|
||||||
|
$ npm run test
|
||||||
|
|
||||||
|
# e2e tests
|
||||||
|
$ npm run test:e2e
|
||||||
|
|
||||||
|
# test coverage
|
||||||
|
$ npm run test:cov
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
||||||
|
|
||||||
|
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install -g @nestjs/mau
|
||||||
|
$ mau deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
Check out a few resources that may come in handy when working with NestJS:
|
||||||
|
|
||||||
|
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
||||||
|
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
||||||
|
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
||||||
|
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
||||||
|
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
||||||
|
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
||||||
|
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
||||||
|
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||||
|
|
||||||
|
## Stay in touch
|
||||||
|
|
||||||
|
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
||||||
|
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||||
|
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
||||||
35
backend/eslint.config.mjs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// @ts-check
|
||||||
|
import eslint from '@eslint/js';
|
||||||
|
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
||||||
|
import globals from 'globals';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
{
|
||||||
|
ignores: ['eslint.config.mjs'],
|
||||||
|
},
|
||||||
|
eslint.configs.recommended,
|
||||||
|
...tseslint.configs.recommendedTypeChecked,
|
||||||
|
eslintPluginPrettierRecommended,
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
...globals.jest,
|
||||||
|
},
|
||||||
|
sourceType: 'commonjs',
|
||||||
|
parserOptions: {
|
||||||
|
projectService: true,
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-floating-promises': 'warn',
|
||||||
|
'@typescript-eslint/no-unsafe-argument': 'warn',
|
||||||
|
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
8
backend/nest-cli.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/nest-cli",
|
||||||
|
"collection": "@nestjs/schematics",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"compilerOptions": {
|
||||||
|
"deleteOutDir": true
|
||||||
|
}
|
||||||
|
}
|
||||||
9893
backend/package-lock.json
generated
Normal file
74
backend/package.json
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"name": "backend",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "",
|
||||||
|
"author": "",
|
||||||
|
"private": true,
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"scripts": {
|
||||||
|
"build": "nest build",
|
||||||
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
|
"start": "nest start",
|
||||||
|
"start:dev": "nest start --watch",
|
||||||
|
"start:debug": "nest start --debug --watch",
|
||||||
|
"start:prod": "node dist/main",
|
||||||
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||||
|
"test": "jest",
|
||||||
|
"test:watch": "jest --watch",
|
||||||
|
"test:cov": "jest --coverage",
|
||||||
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||||
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@google/generative-ai": "^0.24.1",
|
||||||
|
"@nestjs/common": "^11.0.1",
|
||||||
|
"@nestjs/core": "^11.0.1",
|
||||||
|
"@nestjs/platform-express": "^11.0.1",
|
||||||
|
"dotenv": "^17.2.3",
|
||||||
|
"reflect-metadata": "^0.2.2",
|
||||||
|
"rxjs": "^7.8.1",
|
||||||
|
"undici": "^7.16.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/eslintrc": "^3.2.0",
|
||||||
|
"@eslint/js": "^9.18.0",
|
||||||
|
"@nestjs/cli": "^11.0.0",
|
||||||
|
"@nestjs/schematics": "^11.0.0",
|
||||||
|
"@nestjs/testing": "^11.0.1",
|
||||||
|
"@types/express": "^5.0.0",
|
||||||
|
"@types/jest": "^30.0.0",
|
||||||
|
"@types/node": "^22.10.7",
|
||||||
|
"@types/supertest": "^6.0.2",
|
||||||
|
"eslint": "^9.18.0",
|
||||||
|
"eslint-config-prettier": "^10.0.1",
|
||||||
|
"eslint-plugin-prettier": "^5.2.2",
|
||||||
|
"globals": "^16.0.0",
|
||||||
|
"jest": "^30.0.0",
|
||||||
|
"prettier": "^3.4.2",
|
||||||
|
"source-map-support": "^0.5.21",
|
||||||
|
"supertest": "^7.0.0",
|
||||||
|
"ts-jest": "^29.2.5",
|
||||||
|
"ts-loader": "^9.5.2",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"tsconfig-paths": "^4.2.0",
|
||||||
|
"typescript": "^5.7.3",
|
||||||
|
"typescript-eslint": "^8.20.0"
|
||||||
|
},
|
||||||
|
"jest": {
|
||||||
|
"moduleFileExtensions": [
|
||||||
|
"js",
|
||||||
|
"json",
|
||||||
|
"ts"
|
||||||
|
],
|
||||||
|
"rootDir": "src",
|
||||||
|
"testRegex": ".*\\.spec\\.ts$",
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.(t|j)s$": "ts-jest"
|
||||||
|
},
|
||||||
|
"collectCoverageFrom": [
|
||||||
|
"**/*.(t|j)s"
|
||||||
|
],
|
||||||
|
"coverageDirectory": "../coverage",
|
||||||
|
"testEnvironment": "node"
|
||||||
|
}
|
||||||
|
}
|
||||||
22
backend/src/app.controller.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
import { AppController } from './app.controller';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
|
||||||
|
describe('AppController', () => {
|
||||||
|
let appController: AppController;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const app: TestingModule = await Test.createTestingModule({
|
||||||
|
controllers: [AppController],
|
||||||
|
providers: [AppService],
|
||||||
|
}).compile();
|
||||||
|
|
||||||
|
appController = app.get<AppController>(AppController);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('root', () => {
|
||||||
|
it('should return "Hello World!"', () => {
|
||||||
|
expect(appController.getHello()).toBe('Hello World!');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
12
backend/src/app.controller.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Controller, Get } from '@nestjs/common';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
|
||||||
|
@Controller()
|
||||||
|
export class AppController {
|
||||||
|
constructor(private readonly appService: AppService) {}
|
||||||
|
|
||||||
|
@Get()
|
||||||
|
getHello(): string {
|
||||||
|
return this.appService.getHello();
|
||||||
|
}
|
||||||
|
}
|
||||||
12
backend/src/app.module.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { AppController } from './app.controller';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
import { GlobalWordsModule } from './global-words/global-words.module';
|
||||||
|
import { ImageEngineModule } from './image-engine/image-engine.module';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [ImageEngineModule, GlobalWordsModule],
|
||||||
|
controllers: [AppController],
|
||||||
|
providers: [AppService],
|
||||||
|
})
|
||||||
|
export class AppModule {}
|
||||||
8
backend/src/app.service.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AppService {
|
||||||
|
getHello(): string {
|
||||||
|
return 'Hello World!';
|
||||||
|
}
|
||||||
|
}
|
||||||
12
backend/src/global-words/global-word.interface.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export interface GlobalWord {
|
||||||
|
palabra: string;
|
||||||
|
categoria: string;
|
||||||
|
tema: string;
|
||||||
|
descripcion: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WordWithAsset extends GlobalWord {
|
||||||
|
slug: string;
|
||||||
|
imageUrl: string | null;
|
||||||
|
imageStatus: 'ready' | 'pending';
|
||||||
|
}
|
||||||
44
backend/src/global-words/global-words.controller.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import {
|
||||||
|
Controller,
|
||||||
|
Get,
|
||||||
|
Param,
|
||||||
|
Post,
|
||||||
|
Res,
|
||||||
|
StreamableFile,
|
||||||
|
HttpStatus,
|
||||||
|
HttpCode,
|
||||||
|
} from '@nestjs/common';
|
||||||
|
import type { Response } from 'express';
|
||||||
|
import { createReadStream } from 'node:fs';
|
||||||
|
import { GlobalWordsService } from './global-words.service';
|
||||||
|
|
||||||
|
@Controller('global-words')
|
||||||
|
export class GlobalWordsController {
|
||||||
|
constructor(private readonly globalWordsService: GlobalWordsService) {}
|
||||||
|
|
||||||
|
@Get()
|
||||||
|
async getWords() {
|
||||||
|
return this.globalWordsService.listWords();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post('prefetch')
|
||||||
|
@HttpCode(HttpStatus.ACCEPTED)
|
||||||
|
async prefetchAll() {
|
||||||
|
this.globalWordsService.prefetchAll();
|
||||||
|
return { status: 'scheduled' };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(':slug/generate')
|
||||||
|
async generateForWord(@Param('slug') slug: string) {
|
||||||
|
await this.globalWordsService.ensureImage(slug);
|
||||||
|
return { slug, status: 'ready' };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get(':slug/image')
|
||||||
|
async getImage(@Param('slug') slug: string, @Res({ passthrough: true }) res: Response) {
|
||||||
|
const asset = await this.globalWordsService.ensureImage(slug);
|
||||||
|
res.setHeader('Content-Type', asset.mimeType);
|
||||||
|
const file = createReadStream(asset.path);
|
||||||
|
return new StreamableFile(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
backend/src/global-words/global-words.module.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { GlobalWordsController } from './global-words.controller';
|
||||||
|
import { GlobalWordsService } from './global-words.service';
|
||||||
|
import { ImageEngineModule } from '../image-engine/image-engine.module';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [ImageEngineModule],
|
||||||
|
controllers: [GlobalWordsController],
|
||||||
|
providers: [GlobalWordsService],
|
||||||
|
exports: [GlobalWordsService],
|
||||||
|
})
|
||||||
|
export class GlobalWordsModule {}
|
||||||
150
backend/src/global-words/global-words.service.ts
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
import { Injectable, Logger, NotFoundException, OnModuleInit } from '@nestjs/common';
|
||||||
|
import { promises as fs } from 'node:fs';
|
||||||
|
import * as path from 'node:path';
|
||||||
|
import type { GlobalWord, WordWithAsset } from './global-word.interface';
|
||||||
|
import { ImageEngineService } from '../image-engine/image-engine.service';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class GlobalWordsService implements OnModuleInit {
|
||||||
|
private readonly logger = new Logger(GlobalWordsService.name);
|
||||||
|
private readonly repoRoot = path.resolve(process.cwd(), '..');
|
||||||
|
private readonly contentRoot = path.join(this.repoRoot, 'content');
|
||||||
|
private readonly wordsPath = path.join(this.contentRoot, 'palabras-globales.json');
|
||||||
|
private readonly assetsDir = path.join(this.contentRoot, 'generated', 'global-words');
|
||||||
|
private wordsCache: GlobalWord[] | null = null;
|
||||||
|
|
||||||
|
constructor(private readonly imageEngine: ImageEngineService) {}
|
||||||
|
|
||||||
|
async onModuleInit() {
|
||||||
|
await fs.mkdir(this.assetsDir, { recursive: true });
|
||||||
|
// Lanzamos prefetch en background.
|
||||||
|
this.prefetchAll().catch((error) =>
|
||||||
|
this.logger.error('No se pudieron precargar todas las imágenes', error as Error),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async loadWords(): Promise<GlobalWord[]> {
|
||||||
|
if (!this.wordsCache) {
|
||||||
|
const raw = await fs.readFile(this.wordsPath, 'utf8');
|
||||||
|
this.wordsCache = JSON.parse(raw) as GlobalWord[];
|
||||||
|
}
|
||||||
|
return this.wordsCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
private slugify(text: string) {
|
||||||
|
return text
|
||||||
|
.normalize('NFD')
|
||||||
|
.replace(/[\u0300-\u036f]/g, '')
|
||||||
|
.replace(/[^a-zA-Z0-9]+/g, '-')
|
||||||
|
.replace(/^-+|-+$/g, '')
|
||||||
|
.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly mimeByExtension: Record<string, string> = {
|
||||||
|
png: 'image/png',
|
||||||
|
webp: 'image/webp',
|
||||||
|
jpg: 'image/jpeg',
|
||||||
|
jpeg: 'image/jpeg',
|
||||||
|
svg: 'image/svg+xml',
|
||||||
|
};
|
||||||
|
|
||||||
|
private async resolveExistingAsset(slug: string) {
|
||||||
|
for (const ext of Object.keys(this.mimeByExtension)) {
|
||||||
|
const candidate = path.join(this.assetsDir, `${slug}.${ext}`);
|
||||||
|
try {
|
||||||
|
await fs.access(candidate);
|
||||||
|
return { path: candidate, mimeType: this.mimeByExtension[ext] };
|
||||||
|
} catch {
|
||||||
|
// keep iterating
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildPrompt(word: GlobalWord) {
|
||||||
|
return `Ilustración infantil estilo acuarela, vibrante y amigable para niños pequeños. Palabra clave: "${word.palabra}". Tema: ${word.tema}. Categoría: ${word.categoria}. Descripción: ${word.descripcion}. Usa los colores azul y oro si es un elemento de fútbol o autos. Fondo suave, detalles simples.`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async listWords(): Promise<WordWithAsset[]> {
|
||||||
|
const words = await this.loadWords();
|
||||||
|
return Promise.all(
|
||||||
|
words.map(async (word) => {
|
||||||
|
const slug = this.slugify(word.palabra);
|
||||||
|
const existing = await this.resolveExistingAsset(slug);
|
||||||
|
return {
|
||||||
|
...word,
|
||||||
|
slug,
|
||||||
|
imageUrl: existing ? `/global-words/${slug}/image` : null,
|
||||||
|
imageStatus: existing ? 'ready' : 'pending',
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async findWordBySlug(slug: string): Promise<GlobalWord & { slug: string }> {
|
||||||
|
const words = await this.loadWords();
|
||||||
|
const found = words
|
||||||
|
.map((word) => ({ ...word, slug: this.slugify(word.palabra) }))
|
||||||
|
.find((word) => word.slug === slug);
|
||||||
|
if (!found) {
|
||||||
|
throw new NotFoundException(`No existe la palabra con slug ${slug}`);
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
async ensureImage(slug: string) {
|
||||||
|
const word = await this.findWordBySlug(slug);
|
||||||
|
const existing = await this.resolveExistingAsset(slug);
|
||||||
|
if (existing) {
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
this.logger.log(`Generando imagen para ${word.palabra}`);
|
||||||
|
const prompt = this.buildPrompt(word);
|
||||||
|
try {
|
||||||
|
const asset = await this.imageEngine.generate(word, slug, prompt);
|
||||||
|
return asset;
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.warn(
|
||||||
|
`No se pudo generar ${word.palabra} con el motor local, usando placeholder. Motivo: ${
|
||||||
|
(error as Error).message
|
||||||
|
}`,
|
||||||
|
);
|
||||||
|
const svgBuffer = this.buildPlaceholder(word);
|
||||||
|
const filePath = path.join(this.assetsDir, `${slug}.svg`);
|
||||||
|
await fs.writeFile(filePath, svgBuffer);
|
||||||
|
return { path: filePath, mimeType: this.mimeByExtension.svg };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async prefetchAll() {
|
||||||
|
const words = await this.loadWords();
|
||||||
|
for (const word of words) {
|
||||||
|
const slug = this.slugify(word.palabra);
|
||||||
|
if (await this.resolveExistingAsset(slug)) continue;
|
||||||
|
await this.ensureImage(slug);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 400)); // evita saturar API
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildPlaceholder(word: GlobalWord) {
|
||||||
|
const background = word.categoria === 'fútbol' ? '#13347a' : '#ffe6b3';
|
||||||
|
const accent = word.categoria === 'fútbol' ? '#f7c948' : '#1967d2';
|
||||||
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||||
|
<stop offset="0%" stop-color="${background}" stop-opacity="0.9"/>
|
||||||
|
<stop offset="100%" stop-color="${accent}" stop-opacity="0.9"/>
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<rect width="512" height="512" fill="url(#grad)" rx="42" ry="42"/>
|
||||||
|
<text x="50%" y="45%" font-size="120" font-family="Nunito, Arial" font-weight="800" text-anchor="middle" fill="#ffffff">${word.palabra}</text>
|
||||||
|
<text x="50%" y="62%" font-size="36" font-family="Nunito, Arial" text-anchor="middle" fill="#ffffff" opacity="0.85">${word.categoria}</text>
|
||||||
|
<foreignObject x="56" y="320" width="400" height="160">
|
||||||
|
<div xmlns="http://www.w3.org/1999/xhtml" style="font-size:28px;font-family:Nunito,Arial;text-align:center;color:#fff;">
|
||||||
|
${word.descripcion}
|
||||||
|
</div>
|
||||||
|
</foreignObject>
|
||||||
|
</svg>`;
|
||||||
|
return Buffer.from(svg);
|
||||||
|
}
|
||||||
|
}
|
||||||
8
backend/src/image-engine/image-engine.module.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { ImageEngineService } from './image-engine.service';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
providers: [ImageEngineService],
|
||||||
|
exports: [ImageEngineService],
|
||||||
|
})
|
||||||
|
export class ImageEngineModule {}
|
||||||
49
backend/src/image-engine/image-engine.service.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
|
import { fetch } from 'undici';
|
||||||
|
import type { GlobalWord } from '../global-words/global-word.interface';
|
||||||
|
|
||||||
|
interface GenerateResponse {
|
||||||
|
path: string;
|
||||||
|
mimeType?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ImageEngineService {
|
||||||
|
private readonly logger = new Logger(ImageEngineService.name);
|
||||||
|
private readonly baseUrl = process.env.IMAGE_SERVICE_URL ?? 'http://localhost:8001';
|
||||||
|
|
||||||
|
async generate(word: GlobalWord, slug: string, prompt: string) {
|
||||||
|
const response = await fetch(`${this.baseUrl}/generate`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({
|
||||||
|
prompt,
|
||||||
|
slug,
|
||||||
|
negative_prompt: 'text, watermark, logo, disfigured, deformed',
|
||||||
|
width: 640,
|
||||||
|
height: 512,
|
||||||
|
steps: 4,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text();
|
||||||
|
this.logger.error(
|
||||||
|
`Image service error ${response.status}: ${errorText}`,
|
||||||
|
);
|
||||||
|
throw new Error(
|
||||||
|
`Image service responded with ${response.status}: ${errorText}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = (await response.json()) as GenerateResponse;
|
||||||
|
if (!data?.path) {
|
||||||
|
throw new Error('Image service did not return a file path');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
path: data.path,
|
||||||
|
mimeType: data.mimeType ?? 'image/png',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
15
backend/src/main.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { config } from 'dotenv';
|
||||||
|
import * as path from 'node:path';
|
||||||
|
import { NestFactory } from '@nestjs/core';
|
||||||
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
|
config({ path: path.resolve(process.cwd(), '..', '.env') });
|
||||||
|
|
||||||
|
async function bootstrap() {
|
||||||
|
const app = await NestFactory.create(AppModule);
|
||||||
|
app.enableCors({
|
||||||
|
origin: process.env.CLIENT_ORIGIN ?? true,
|
||||||
|
});
|
||||||
|
await app.listen(process.env.PORT ?? 3000);
|
||||||
|
}
|
||||||
|
bootstrap();
|
||||||
25
backend/test/app.e2e-spec.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
import { INestApplication } from '@nestjs/common';
|
||||||
|
import request from 'supertest';
|
||||||
|
import { App } from 'supertest/types';
|
||||||
|
import { AppModule } from './../src/app.module';
|
||||||
|
|
||||||
|
describe('AppController (e2e)', () => {
|
||||||
|
let app: INestApplication<App>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const moduleFixture: TestingModule = await Test.createTestingModule({
|
||||||
|
imports: [AppModule],
|
||||||
|
}).compile();
|
||||||
|
|
||||||
|
app = moduleFixture.createNestApplication();
|
||||||
|
await app.init();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('/ (GET)', () => {
|
||||||
|
return request(app.getHttpServer())
|
||||||
|
.get('/')
|
||||||
|
.expect(200)
|
||||||
|
.expect('Hello World!');
|
||||||
|
});
|
||||||
|
});
|
||||||
9
backend/test/jest-e2e.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"moduleFileExtensions": ["js", "json", "ts"],
|
||||||
|
"rootDir": ".",
|
||||||
|
"testEnvironment": "node",
|
||||||
|
"testRegex": ".e2e-spec.ts$",
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.(t|j)s$": "ts-jest"
|
||||||
|
}
|
||||||
|
}
|
||||||
4
backend/tsconfig.build.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
||||||
|
}
|
||||||
25
backend/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "nodenext",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
|
"resolvePackageJsonExports": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"declaration": true,
|
||||||
|
"removeComments": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"target": "ES2023",
|
||||||
|
"sourceMap": true,
|
||||||
|
"outDir": "./dist",
|
||||||
|
"baseUrl": "./",
|
||||||
|
"incremental": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"strictBindCallApply": false,
|
||||||
|
"noFallthroughCasesInSwitch": false
|
||||||
|
}
|
||||||
|
}
|
||||||
72
content/fonemas-iniciales.json
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"fonema": "m",
|
||||||
|
"grafemas": ["m"],
|
||||||
|
"gestoMontessori": "labios cerrados vibran",
|
||||||
|
"palabrasClave": ["mamá", "motor", "mano"],
|
||||||
|
"actividad": "Armar tarjetas magnéticas con 'm' + vocales para crear 'ma', 'me', 'mi', aplicando control de error visual."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "p",
|
||||||
|
"grafemas": ["p"],
|
||||||
|
"gestoMontessori": "soplar con labios cerrados",
|
||||||
|
"palabrasClave": ["papá", "pelota", "pista"],
|
||||||
|
"actividad": "Juego de soplar fichas con 'p' hacia un arco mini, pronunciando cada sílaba antes de patear."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "l",
|
||||||
|
"grafemas": ["l"],
|
||||||
|
"gestoMontessori": "lengua toca dientes superiores",
|
||||||
|
"palabrasClave": ["luz", "lento", "lateral"],
|
||||||
|
"actividad": "Construir 'la', 'le', 'li' con letras rugosas y mover autos según la sílaba leída."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "b",
|
||||||
|
"grafemas": ["b", "v"],
|
||||||
|
"gestoMontessori": "labios se juntan, sonido suave",
|
||||||
|
"palabrasClave": ["Boca", "bola", "bocina"],
|
||||||
|
"actividad": "Clasificar imágenes azul/amarillo según comiencen con 'b' o 'v', comentando diferencias."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "t",
|
||||||
|
"grafemas": ["t"],
|
||||||
|
"gestoMontessori": "lengua detrás de los dientes",
|
||||||
|
"palabrasClave": ["tigre", "tren", "taco"],
|
||||||
|
"actividad": "Girar ruleta de tacos y formar sílabas 'ta','te','ti' antes de patear al arco."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "r",
|
||||||
|
"grafemas": ["r"],
|
||||||
|
"gestoMontessori": "vibración suave",
|
||||||
|
"palabrasClave": ["ruta", "rueda", "ritmo"],
|
||||||
|
"actividad": "Camino sensorial donde cada tramo tiene 'ra','re','ri'; avanzar con auto al pronunciar."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "rr",
|
||||||
|
"grafemas": ["rr"],
|
||||||
|
"gestoMontessori": "vibración fuerte",
|
||||||
|
"palabrasClave": ["carro", "perro", "torre"],
|
||||||
|
"actividad": "Hacer vibrar el sonido con motores de juguete y comparar 'r' vs 'rr'."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "ch",
|
||||||
|
"grafemas": ["ch"],
|
||||||
|
"gestoMontessori": "dientes juntos, aire suave",
|
||||||
|
"palabrasClave": ["chico", "chasis", "chancha"],
|
||||||
|
"actividad": "Rompecabezas de autos donde cada pieza tiene 'cha','che','chi' para ordenar."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "s",
|
||||||
|
"grafemas": ["s", "c"],
|
||||||
|
"gestoMontessori": "aire continuo",
|
||||||
|
"palabrasClave": ["sol", "sonrisa", "campeón"],
|
||||||
|
"actividad": "Trazar caminos con arena formando 'sa','se','si' y guiar un auto sobre ellos."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fonema": "f",
|
||||||
|
"grafemas": ["f"],
|
||||||
|
"gestoMontessori": "dientes sobre labio inferior",
|
||||||
|
"palabrasClave": ["fútbol", "freno", "familia"],
|
||||||
|
"actividad": "Cartas con 'fa','fe','fi' que se usan para desbloquear jugadas en un tablero tipo partido."
|
||||||
|
}
|
||||||
|
]
|
||||||
BIN
content/generated/global-words/abrazo.png
Normal file
|
After Width: | Height: | Size: 667 KiB |
BIN
content/generated/global-words/agua.png
Normal file
|
After Width: | Height: | Size: 671 KiB |
BIN
content/generated/global-words/amigo.png
Normal file
|
After Width: | Height: | Size: 664 KiB |
BIN
content/generated/global-words/arbol.png
Normal file
|
After Width: | Height: | Size: 672 KiB |
BIN
content/generated/global-words/arco.png
Normal file
|
After Width: | Height: | Size: 655 KiB |
BIN
content/generated/global-words/arena.png
Normal file
|
After Width: | Height: | Size: 689 KiB |
BIN
content/generated/global-words/auto.png
Normal file
|
After Width: | Height: | Size: 610 KiB |
BIN
content/generated/global-words/avion.png
Normal file
|
After Width: | Height: | Size: 690 KiB |
BIN
content/generated/global-words/azul.png
Normal file
|
After Width: | Height: | Size: 703 KiB |
BIN
content/generated/global-words/boca.png
Normal file
|
After Width: | Height: | Size: 709 KiB |
BIN
content/generated/global-words/bocina.png
Normal file
|
After Width: | Height: | Size: 679 KiB |
BIN
content/generated/global-words/campeon.png
Normal file
|
After Width: | Height: | Size: 708 KiB |
BIN
content/generated/global-words/cancha.png
Normal file
|
After Width: | Height: | Size: 675 KiB |
BIN
content/generated/global-words/casa.png
Normal file
|
After Width: | Height: | Size: 659 KiB |
BIN
content/generated/global-words/coche.png
Normal file
|
After Width: | Height: | Size: 662 KiB |
BIN
content/generated/global-words/cuento.png
Normal file
|
After Width: | Height: | Size: 656 KiB |
BIN
content/generated/global-words/dulce.png
Normal file
|
After Width: | Height: | Size: 689 KiB |
BIN
content/generated/global-words/energia.png
Normal file
|
After Width: | Height: | Size: 640 KiB |
BIN
content/generated/global-words/equipo.png
Normal file
|
After Width: | Height: | Size: 690 KiB |
BIN
content/generated/global-words/feliz.png
Normal file
|
After Width: | Height: | Size: 663 KiB |
BIN
content/generated/global-words/freno.png
Normal file
|
After Width: | Height: | Size: 654 KiB |
BIN
content/generated/global-words/gol.png
Normal file
|
After Width: | Height: | Size: 664 KiB |
BIN
content/generated/global-words/lento.png
Normal file
|
After Width: | Height: | Size: 688 KiB |
BIN
content/generated/global-words/leon.png
Normal file
|
After Width: | Height: | Size: 706 KiB |
BIN
content/generated/global-words/libro.png
Normal file
|
After Width: | Height: | Size: 656 KiB |
BIN
content/generated/global-words/lluvia.png
Normal file
|
After Width: | Height: | Size: 639 KiB |
BIN
content/generated/global-words/luz.png
Normal file
|
After Width: | Height: | Size: 674 KiB |
BIN
content/generated/global-words/magia.png
Normal file
|
After Width: | Height: | Size: 621 KiB |
BIN
content/generated/global-words/mama.png
Normal file
|
After Width: | Height: | Size: 644 KiB |
BIN
content/generated/global-words/manana.png
Normal file
|
After Width: | Height: | Size: 707 KiB |
BIN
content/generated/global-words/motor.png
Normal file
|
After Width: | Height: | Size: 635 KiB |
BIN
content/generated/global-words/musica.png
Normal file
|
After Width: | Height: | Size: 677 KiB |
BIN
content/generated/global-words/noche.png
Normal file
|
After Width: | Height: | Size: 689 KiB |
BIN
content/generated/global-words/nube.png
Normal file
|
After Width: | Height: | Size: 661 KiB |
BIN
content/generated/global-words/papa.png
Normal file
|
After Width: | Height: | Size: 642 KiB |
BIN
content/generated/global-words/parque.png
Normal file
|
After Width: | Height: | Size: 717 KiB |
BIN
content/generated/global-words/pelota.png
Normal file
|
After Width: | Height: | Size: 601 KiB |
BIN
content/generated/global-words/pista.png
Normal file
|
After Width: | Height: | Size: 654 KiB |
BIN
content/generated/global-words/playa.png
Normal file
|
After Width: | Height: | Size: 592 KiB |
BIN
content/generated/global-words/rapido.png
Normal file
|
After Width: | Height: | Size: 664 KiB |
BIN
content/generated/global-words/ritmo.png
Normal file
|
After Width: | Height: | Size: 660 KiB |
BIN
content/generated/global-words/rojo.png
Normal file
|
After Width: | Height: | Size: 656 KiB |
BIN
content/generated/global-words/rueda.png
Normal file
|
After Width: | Height: | Size: 637 KiB |
BIN
content/generated/global-words/ruta.png
Normal file
|
After Width: | Height: | Size: 637 KiB |