Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error404 casi terminado. #12

Merged
merged 17 commits into from
Feb 22, 2024
1 change: 1 addition & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
"react/prop-types": "off",
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
Expand Down
33 changes: 33 additions & 0 deletions frontend/src/Componentes/Botones.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Link } from "react-router-dom";

const Botones = ({ button }) => {
if (!button) {
return;
}
Copy link
Collaborator

@francosang francosang Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este fue lo que te dijo ChatGPT?

Creo que no es necesario, me parece que se puede borrar.
No sería correcto crear un boton que no tiene ruta ni informacion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si eso mismo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acabo de eliminarlo y no tuve ningún problema, tal como me mencionaste. Sin embargo, en el componente de la tarjeta del día, todavía tengo dificultades.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Franco, ya he solucionado el problema. Como mencionaste, un componente vacío puede generar un error. He comentado esa parte del código y eliminado el 'if', y ahora funciona correctamente.


return (
<>
<Link to={button.ruta}>
<button type="button" className="btn btn-dark">
{button.infBoton}
</button>
</Link>
</>
);
};

export default Botones;

// function Botones(props) {
// const { infBoton, ruta } = props;

// return (
// <Link to={ruta}>
// <button type="button" className="btn">
// {infBoton}
// </button>
// </Link>
// );
// }

// export default Botones;
9 changes: 0 additions & 9 deletions frontend/src/Componentes/Botons.jsx

This file was deleted.

10 changes: 2 additions & 8 deletions frontend/src/Componentes/EstilosGenerales.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,12 @@ body {
transition: border-color 0.25s;
}
.btn:hover {
border-color: var(--hoverBorde);
border-color: var(--hoverTexto);
color: var(--hoverTexto);
background-color: var(--fondoNav);
transition: 0.3s;
}
.btn :focus,
.btn :focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}

/* Card */

.card {
width: 400px;
justify-content: center;
}
30 changes: 9 additions & 21 deletions frontend/src/Componentes/Estructura.jsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
import { Route, Routes } from "react-router-dom";
{
/* NavBar */
}
import ListaElMasToto from "./Pagina/ListaElMasToto";
import ListaElMasTonto from "./Pagina/ListaElMasTonto";
import CowboyDelDia from "./Pagina/CowboyDelDia";
{
/* Estadisticas */
}
import EstadisticasElMasToto from "./Pagina/Estadisticas/EstadisticasElMasToto";
import EstadisticasElMasTonto from "./Pagina/Estadisticas/EstadisticasElMasTonto";
import EstadisticasCowboyDelDia from "./Pagina/Estadisticas/EstadisticasCowboyDelDia";
import Proximamente from "./Pagina/Estadisticas/Proximamente";
{
/* Error404 */
}
import Error404 from "./Pagina/Error404/Error404";
import Inicio from "./Inicio";

const Estructura = () => {
return (
<>
<div className="campo">
<Routes>
{/* NavBar */}
<Route path="/" element={<ListaElMasToto />} />
<Route path="/ListaElMasTonto" element={<ListaElMasTonto />} />
<Route path="/CowboyDelDia" element={<CowboyDelDia />} />
<Route path="/ListaElMasToto" element={<ListaElMasToto />} />

{/* Inicio */}
<Route path="/" element={<Inicio /> } />

{/* Estadisticas */}
<Route
path="/EstadisticasElMasToto"
element={<EstadisticasElMasToto />}
/>
<Route
path="/EstadisticasCowboyDelDia"
element={<EstadisticasCowboyDelDia />}
/>
<Route path="/EstadisticasElMasTonto" element={<EstadisticasElMasTonto />} />
<Route path="/EstadisticasCowboyDelDia" element={<EstadisticasCowboyDelDia />} />
<Route path="/Proximamente" element={<Proximamente />} />

{/* Error404 */}
Expand Down
26 changes: 26 additions & 0 deletions frontend/src/Componentes/Inicio.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import TarjetaDia from "./Pagina/InfoTonto/TarjetaDia";

const Inicio = () => {
const tarjeta = {
persona: "Nombre: Jorge",
cantidad: "68",
titulos: "Titulos",
listaTitulos: "lol",
};

return (
<>
<section>
{/* Tarjeta del día del mas tonto */}
<h3 className="tituloH3">Tonto del día de hoy es...</h3>
<TarjetaDia tarjeta={tarjeta} />

{/* Tarjeta del cowboy del día */}
<h3 className="tituloH3">Cowboy del día de hoy es...</h3>
<TarjetaDia />
Copy link
Collaborator

@francosang francosang Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Es mejor no usar el componente tarjeta si no va a tener propiedades y va a estar vacio.
De esta forma te evitas poner el if dentro del componente.

Ademas, no es un uso correcto para el componente.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La idea era incluir los datos del Cowboy del día, pero lamentablemente no pude completarlo a tiempo. Ese es el plan. Pretendo que funcione de manera similar al Tonto del día, pero enfocado en el Cowboy destacado del día.

</section>
</>
);
};

export default Inicio;
9 changes: 5 additions & 4 deletions frontend/src/Componentes/NavBar/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ const NavBar = () => {
>
<ul className="navbar-nav">
<li className="nav-item">
<Link className="nav-link" to="/ListaElMasToto">
El más toto
<Link className="nav-link"
to="/ListaElMasTonto">
El más tonto
</Link>
</li>
<li className="nav-item">
Expand All @@ -61,8 +62,8 @@ const NavBar = () => {
</Link>
<ul className="menuEsta dropdown-menu">
<li>
<Link className="menuEstadisticas dropdown-item" to="EstadisticasElMasToto">
El más toto
<Link className="menuEstadisticas dropdown-item" to="EstadisticasElMasTonto">
El más tonto
</Link>
</li>
<li>
Expand Down
23 changes: 21 additions & 2 deletions frontend/src/Componentes/Pagina/Error404/Error404.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
import Botones from "../../Botones.jsx";
import TarjetaDia from "../InfoTonto/TarjetaDia.jsx";

const Error404 = () => {
const tarjeta = {
persona: "Error 404",
titulos: "¡Alto ahí, forastero!",
listaTitulos:
"Parece que has encontrado un territorio desconocido en el vasto desierto digital. No te preocupes, nuestros sheriff de la red están en camino para guiarte de regreso al pueblo principal. Mientras tanto, ¿por qué no te relajas con un poco de música en nuestro salon virtual?",
boton: "boton",
};

const button = {
ruta: "/",
infBoton: "Inicio"
}

return (
<>
<h2>Error 404</h2>
<div>
<TarjetaDia tarjeta={tarjeta} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creo que para el error 404 no tendriamos que usar el componente Tarjeta.

El componente Tarjeta tiene propiedades exclusivas para un tonto, como un nombre y titulos y una cantidad.
Creo que seria mejor que esta pagina no use este componente y tenga todo el HTML directamente.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Al principio, estaba utilizando HTML plano, como mencionas. Después lo cambié, ¿por qué? Bueno, ¡ni yo mismo lo sé, jaja!

<Botones button={button} />
</div>
</>
);
};

export default Error404;
export default Error404;
14 changes: 0 additions & 14 deletions frontend/src/Componentes/Pagina/Estadisticas.jsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const EstadisticasElMasToto = () => {
const EstadisticasElMasTonto = () => {
return (
<>
<section>
Expand All @@ -8,4 +8,4 @@ const EstadisticasElMasToto = () => {
);
};

export default EstadisticasElMasToto;
export default EstadisticasElMasTonto;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./EstilosEstadisticas.css";
// import MayorMenor from "./MayorMenor";

const ListaElMasToto = () => {
const ListaElMasTonto = () => {
return (
<>
<section>
Expand Down Expand Up @@ -55,4 +55,4 @@ const ListaElMasToto = () => {
);
};

export default ListaElMasToto;
export default ListaElMasTonto;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/* Principal */
.principal {
margin-top: 2rem;
/* margin-top: 2rem; */
}
.principal li {
background-color: var(--fondoNav);
Expand Down Expand Up @@ -51,6 +51,7 @@ span {
.tituloH3 {
text-align: center;
width: 28rem;
margin: 12px
}
.titulosObtenidos {
color: var(--texto);
Expand Down
55 changes: 55 additions & 0 deletions frontend/src/Componentes/Pagina/InfoTonto/ListaParticipantes.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import ListaTitulos from "./ListaTitulos";


const ListaParticipantes = () => {
return (
<>
<ol className="principal list-group list-group-numbered">
<li className="list-group-item d-flex justify-content-between align-items-start">
<div className="logros ms-2 me-auto">
<div className="nombre fw-bold">German</div>
<ListaTitulos />
</div>
<span className="badge">88</span>
</li>
<li className="list-group-item d-flex justify-content-between align-items-start">
<div className="logros ms-2 me-auto">
<div className="nombre fw-bold">Cristian</div>
--Título más reciente.--
</div>
<span className="badge">78</span>
</li>
<li className="list-group-item d-flex justify-content-between align-items-start">
<div className="logros ms-2 me-auto">
<div className="nombre fw-bold">Pablo</div>
--Título más reciente.--
</div>
<span className="badge">75</span>
</li>
<li className="list-group-item d-flex justify-content-between align-items-start">
<div className="logros ms-2 me-auto">
<div className="nombre fw-bold">Franco</div>
--Título más reciente.--
</div>
<span className="badge">75</span>
</li>
<li className="list-group-item d-flex justify-content-between align-items-start">
<div className="logros ms-2 me-auto">
<div className="nombre fw-bold">Marcelo</div>
--Título más reciente.--
</div>
<span className="badge">68</span>
</li>
<li className="list-group-item d-flex justify-content-between align-items-start">
<div className="logros ms-2 me-auto">
<div className="nombre fw-bold">Jorge</div>
--Título más reciente.--
</div>
<span className="badge">68</span>
</li>
</ol>
</>
);
};

export default ListaParticipantes;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ListaTitulos = () => {
</a>
</p>
<div className="collapse " id="collapseExample">
<div className="fondoNav">Navideño, Cumpleañero, Poker Tonto</div>
<div className="fondoNav">...</div>
</div>
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import "../EstilosElMasToto.css";
import "../EstilosElMasTonto.css";

const TarjetaDia = () => {
const TarjetaDia = ({ tarjeta }) => {
if (!tarjeta) {
return;
}
return (
<>
<h3 className="tituloH3">Tonto del día de hoy es...</h3>
<div className="principal card mb-3">
<div className="row g-0">
<div className="fondoNav col-md-4">
Expand All @@ -13,16 +15,16 @@ const TarjetaDia = () => {
alt="Icono cowboys"
/>
</div>
<div className="col-md-8">
<div className="fondoNav col-md-8">
<div className="fondoNav card-body">
<h5 className="nombre card-title">
Nombre: Jorge
<span className="badge float-right">68</span>
{tarjeta.persona}
<span className="badge float-right">{tarjeta.cantidad}</span>
</h5>
<h6 className="fondoNav card-text">Títulos: 6</h6>
<h6 className="fondoNav card-text">{tarjeta.titulos}</h6>
<div>
<p className="titulosObtenidos fondoNav">
Justiciero, Gil trabajador, Poker Tonto, Navideño
{tarjeta.listaTitulos}
</p>
</div>
</div>
Expand Down
32 changes: 32 additions & 0 deletions frontend/src/Componentes/Pagina/ListaElMasTonto.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import TarjetaDia from "./InfoTonto/TarjetaDia";
import ListaParticipantes from "./InfoTonto/ListaParticipantes";

const ListaElMasTonto = () => {
const tarjeta = {
persona: "Nombre: Jorge",
cantidad: "68",
titulos: "Titulos",
listaTitulos: "lol",
};
const LP = {
persona: "Jorge",
cantidad: "68",
};

return (
<>
<section>
{/* Tarjeta del día */}
<h3 className="tituloH3">Tonto del día de hoy es...</h3>
<TarjetaDia tarjeta={tarjeta} />

{/* Lista de participantes */}
<h3 className="tituloH3">Lista de participantes</h3>
<ListaParticipantes LP={LP} />
<ListaParticipantes LP={LP} />
</section>
</>
);
};

export default ListaElMasTonto;
Loading
Loading