From 1a08d76ff1482632e298d4912f7808ccc366b3cd Mon Sep 17 00:00:00 2001 From: David Saez Date: Mon, 20 Nov 2023 16:33:32 -0300 Subject: [PATCH 1/4] feat(Badges) backend for badges added. --- backend/src/controllers/badge.controller.js | 3 ++ backend/src/controllers/badge/createBadge.js | 43 ++++++++++++++++++++ backend/src/models/badge.model.js | 12 ++++++ backend/src/routes/badge.routes.js | 6 +++ backend/src/routes/router.js | 2 + 5 files changed, 66 insertions(+) create mode 100644 backend/src/controllers/badge.controller.js create mode 100644 backend/src/controllers/badge/createBadge.js create mode 100644 backend/src/models/badge.model.js create mode 100644 backend/src/routes/badge.routes.js diff --git a/backend/src/controllers/badge.controller.js b/backend/src/controllers/badge.controller.js new file mode 100644 index 0000000..c9f8ae0 --- /dev/null +++ b/backend/src/controllers/badge.controller.js @@ -0,0 +1,3 @@ +import { createBadge } from "./badge/createBadge"; +// Aquí importamos para exportar las funciones. +module.exports = {createBadge} \ No newline at end of file diff --git a/backend/src/controllers/badge/createBadge.js b/backend/src/controllers/badge/createBadge.js new file mode 100644 index 0000000..d2fa027 --- /dev/null +++ b/backend/src/controllers/badge/createBadge.js @@ -0,0 +1,43 @@ +const Badge = require('../../models/badge.model') + +const createBadge = async (req, res) => { + const { name, url } = await req.body; + + // Validación que estén todos los campos. + if (!name || !url) { + return res.status(404).json({ + msg: "Todos los campos son requeridos", + status: 404, + }); + } + // Fin validación + + // Validación si es que ya está registrado. + const urlBd = await Badge.findOne({url: `${url}`}).exec() + if(urlBd !== null){ + return res.status(409).json({ + msg: "Ya existe una cuenta con este correo.", + status: 409, + }); + } + // Fin Validación + + try { + await Badge.create({ + name: name, + url: url, + }); + res.status(201).json({ + msg: "Insignia creada.", + status: 201, + }); + } catch (err) { + console.log(err); + res.status(500).json({ + msg: "Error al crear una insignia.", + status: 500, + }); + } +}; + +module.exports = {createBadge} \ No newline at end of file diff --git a/backend/src/models/badge.model.js b/backend/src/models/badge.model.js new file mode 100644 index 0000000..d5744a6 --- /dev/null +++ b/backend/src/models/badge.model.js @@ -0,0 +1,12 @@ +const mongoose = require("mongoose"); + +const { Schema } = mongoose; +// Creación de esquema +const badgeSchema = new Schema({ + name: {type: String, require: true}, + url: {type: String, require: true} +}); +// Creación del modelo +const Badge = mongoose.model("Badge", badgeSchema); + +module.exports = Badge; diff --git a/backend/src/routes/badge.routes.js b/backend/src/routes/badge.routes.js new file mode 100644 index 0000000..38451a3 --- /dev/null +++ b/backend/src/routes/badge.routes.js @@ -0,0 +1,6 @@ +const router = require('express').Router() +const {createBadge} = require('../controllers/badge/createBadge') + +router.post('/createBadge', createBadge) + +module.exports = router \ No newline at end of file diff --git a/backend/src/routes/router.js b/backend/src/routes/router.js index 5a1c90c..6875692 100644 --- a/backend/src/routes/router.js +++ b/backend/src/routes/router.js @@ -1,9 +1,11 @@ const router = require("express").Router(); const userRouter = require("../routes/user.routes"); +const badgeRouter = require("../routes/badge.routes"); const authRouter = require("../routes/auth.router"); router.use("/user", userRouter); +router.use("/badge", badgeRouter); router.use("/auth", authRouter); module.exports = router; From c6230cc2ed0c4c50f39e215a0f9a4ee79f8061d9 Mon Sep 17 00:00:00 2001 From: Catalina Date: Mon, 20 Nov 2023 17:27:13 -0300 Subject: [PATCH 2/4] =?UTF-8?q?frontend=20p=C3=A1gina=20Cuenta=20lista?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Cuenta/Cuenta.css | 36 +++++++++++++++---- .../src/components/Cuenta/Cuenta.jsx | 7 +++- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/myboya-project/src/components/Cuenta/Cuenta.css b/myboya-project/src/components/Cuenta/Cuenta.css index 606537f..34e1297 100644 --- a/myboya-project/src/components/Cuenta/Cuenta.css +++ b/myboya-project/src/components/Cuenta/Cuenta.css @@ -1,9 +1,13 @@ .fondoCuenta{ -padding: 50px 260px; +display: flex; +flex-direction: column; +align-items: center; +gap: 1rem; } .containerCuenta{ display: flex; +justify-content: center; gap: 30px; } @@ -35,6 +39,7 @@ width: 200px; .circulosColoresIcono{ display: flex; flex-direction: row; +justify-content: center; gap: 8px; } @@ -110,17 +115,27 @@ line-height: 15px; .containerPuntos{ background-color: #005cb2; border-radius: 50px; -padding: 40px; +padding: 60px; align-items: center; } .img-puntaje{ -width: 60px; +width: 70px; +} + +.puntajePerfil{ +display: flex; +flex-direction: row; +} + +.contenedorpuntajeAcumulado{ +padding-left: 20px; +padding-top: 15px; } .puntajeAcumulado{ font-size: 22px; -line-height: 30px; +line-height: 20px; } .insigniasPerfil{ @@ -132,12 +147,14 @@ flex-direction: row; display: flex; flex-direction: column; align-items: center; +padding-right: 10px; } .misInsignias{ font-size: 22px; line-height: 30px; -padding-top: 50px; +padding-top: 65px; +padding-bottom: 30px; } .cantidadPuntajeAcumulado, .tituloInsignia{ @@ -157,7 +174,14 @@ color: #03E2CC; line-height: 25px; } +.puntosFaltantesInsignia{ +font-size: 18px; +color: #FF8C00; +line-height: 15px; +} + .btn-volver{ +display: flex; background-color: #005cb2; color: white; font-family: 'NATS'; @@ -167,5 +191,5 @@ text-align: center; border: none; border-radius: 50px; cursor: pointer; -margin: 30px; +justify-content: center; } \ No newline at end of file diff --git a/myboya-project/src/components/Cuenta/Cuenta.jsx b/myboya-project/src/components/Cuenta/Cuenta.jsx index dbe9542..107d852 100644 --- a/myboya-project/src/components/Cuenta/Cuenta.jsx +++ b/myboya-project/src/components/Cuenta/Cuenta.jsx @@ -68,27 +68,32 @@ function Cuenta() {
+

PUNTAJE TOTAL ACUMULADO

50 Puntos

+

MIS INSIGNIAS

Aprendiz

-{/*

Consigue 50 puntos

*/} +

Consigue 50 puntos

Principiante

+

Consigue 300 puntos

Intermedio

+

Consigue 1000 puntos

Avanzado

+

Consigue 1500 puntos

From 7bb3177297979886982159fe430f23e8d9f08dd3 Mon Sep 17 00:00:00 2001 From: bastian Date: Tue, 21 Nov 2023 11:51:51 -0300 Subject: [PATCH 3/4] pagina noticia --- .../src/components/Noticias/Noticias.css | 31 ++++++++++++++++--- .../src/components/Noticias/Noticias.jsx | 1 - 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/myboya-project/src/components/Noticias/Noticias.css b/myboya-project/src/components/Noticias/Noticias.css index b34bb68..7632986 100644 --- a/myboya-project/src/components/Noticias/Noticias.css +++ b/myboya-project/src/components/Noticias/Noticias.css @@ -1,17 +1,40 @@ -#contenedorNoticias > img{ +#contenedorNoticias > a { + border-radius: 8px; width: 100%; + max-width: 350px; height: auto; box-shadow: 0px 0px 30px #000; } #contenedorNoticias { + padding: 40px 100px; display: grid; grid-template-columns: repeat( - auto-fit, + 4, minmax(150px, 1fr) ); - gap: 32px; - + gap: 32px; +} + +@media (max-width: 768px){ + #contenedorNoticias { + grid-template-columns: + repeat( + 3, + minmax(150px, 1fr) + ); + } +} + +@media (max-width: 390px) { + #contenedorNoticias { + grid-template-columns: + repeat( + 2, + minmax(150px, 1fr) + ); + padding: 40px 20px; + }; } \ No newline at end of file diff --git a/myboya-project/src/components/Noticias/Noticias.jsx b/myboya-project/src/components/Noticias/Noticias.jsx index cc98c8f..f2dd15e 100644 --- a/myboya-project/src/components/Noticias/Noticias.jsx +++ b/myboya-project/src/components/Noticias/Noticias.jsx @@ -27,7 +27,6 @@ const Noticias = () => { turtles under threat greenpeace imagen - ); } From 7b7536e1e1b868c3566d69a81d666fb76b7d422e Mon Sep 17 00:00:00 2001 From: Catalina Date: Tue, 21 Nov 2023 19:08:01 -0300 Subject: [PATCH 4/4] =?UTF-8?q?detalles=20botones=20y=20enrutado=20a=20p?= =?UTF-8?q?=C3=A1gina=20Cuenta=20-=20InicioQuiz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- myboya-project/src/components/Cuenta/Cuenta.jsx | 2 ++ .../src/components/InicioQuiz/InicioQuiz.css | 6 ++++++ .../src/components/InicioQuiz/InicioQuiz.jsx | 10 +++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/myboya-project/src/components/Cuenta/Cuenta.jsx b/myboya-project/src/components/Cuenta/Cuenta.jsx index 107d852..fe10ce6 100644 --- a/myboya-project/src/components/Cuenta/Cuenta.jsx +++ b/myboya-project/src/components/Cuenta/Cuenta.jsx @@ -12,6 +12,7 @@ function Cuenta() { const navigate = useNavigate(); const jugarQuiz = () => navigate("/playground"); + /* Personalizar color ícono */ const [color, setColor] = useState("#80BACC"); const cambiarColor1 = () => { @@ -43,6 +44,7 @@ function Cuenta() { const nuevoColor = "#E3CE12"; setColor(nuevoColor); }; + /* fin Personalizar color ícono */ return (
diff --git a/myboya-project/src/components/InicioQuiz/InicioQuiz.css b/myboya-project/src/components/InicioQuiz/InicioQuiz.css index 5c0abac..cffc923 100644 --- a/myboya-project/src/components/InicioQuiz/InicioQuiz.css +++ b/myboya-project/src/components/InicioQuiz/InicioQuiz.css @@ -132,7 +132,9 @@ body { border: none; min-width: 17rem; padding-left: 1em; + font-size: 23px; } + .ranking-insigniaa { color: white; display: flex; @@ -144,6 +146,10 @@ body { border: none; min-width: 17rem; padding-left: 1em; + font-size: 23px; + line-height: 22px; + text-align: left; + cursor: pointer; } .datocurioso-contenedor { diff --git a/myboya-project/src/components/InicioQuiz/InicioQuiz.jsx b/myboya-project/src/components/InicioQuiz/InicioQuiz.jsx index cae149c..35737ba 100644 --- a/myboya-project/src/components/InicioQuiz/InicioQuiz.jsx +++ b/myboya-project/src/components/InicioQuiz/InicioQuiz.jsx @@ -9,16 +9,20 @@ const InicioQuiz = () => { const startQuiz = () => navigate("/quiz"); const comoJugar = () => navigate("/instrucciones"); + const cuenta = () => navigate("/cuenta"); return ( <>
-