Compare commits
13 Commits
c8da692662
...
9e722b1af7
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e722b1af7 | |||
| 7190f3971f | |||
| 747a9dd06b | |||
| 4def004bd6 | |||
| cf8a14c51a | |||
| 835b8e332b | |||
| 66acfb27d0 | |||
| 4cb4faff1b | |||
| d65b7fcb91 | |||
| a6a78d9381 | |||
| 050d5e49c4 | |||
| 2cc13ce4ed | |||
| 8caaeeaef0 |
@@ -0,0 +1,141 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<title>Trivial - Lobby</title>
|
||||||
|
|
||||||
|
<link
|
||||||
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||||
|
rel="stylesheet">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="css/index.css">
|
||||||
|
<link rel="stylesheet" href="css/buscadorSala.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include_once("cabecera.php");
|
||||||
|
?>
|
||||||
|
|
||||||
|
<main class="container py-5">
|
||||||
|
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-play-kahoot btn-crear-sala"
|
||||||
|
data-bs-toggle="modal"
|
||||||
|
data-bs-target="#modalCrearSala">
|
||||||
|
<span>+</span>
|
||||||
|
Crear sala
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
id="contenedorSalas"
|
||||||
|
class="row justify-content-center g-4">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
id="modalCrearSala"
|
||||||
|
tabindex="-1"
|
||||||
|
aria-labelledby="modalCrearSalaLabel"
|
||||||
|
aria-hidden="true">
|
||||||
|
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
|
||||||
|
<div class="modal-content modal-kahoot">
|
||||||
|
|
||||||
|
<div class="modal-header modal-kahoot-header">
|
||||||
|
<h5
|
||||||
|
class="modal-title"
|
||||||
|
id="modalCrearSalaLabel">
|
||||||
|
Crear sala
|
||||||
|
</h5>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn-close btn-close-white"
|
||||||
|
data-bs-dismiss="modal"
|
||||||
|
aria-label="Cerrar">
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body p-4">
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label
|
||||||
|
for="nombreSala"
|
||||||
|
class="form-label">
|
||||||
|
Nombre de la sala
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="nombreSala"
|
||||||
|
class="form-control input-kahoot"
|
||||||
|
name="nombreSala"
|
||||||
|
placeholder="Ej. Noche de Trivial">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label
|
||||||
|
for="nombreEquipo1"
|
||||||
|
class="form-label">
|
||||||
|
|
||||||
|
Nombre del equipo 1
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="nombreEquipo1"
|
||||||
|
name="nombreEquipo1"
|
||||||
|
class="form-control input-kahoot"
|
||||||
|
placeholder="Ej. Los cerebritos">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label
|
||||||
|
for="nombreEquipo2"
|
||||||
|
class="form-label">
|
||||||
|
Nombre del equipo 2
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="nombreEquipo2"
|
||||||
|
name="nombreEquipo2"
|
||||||
|
class="form-control input-kahoot"
|
||||||
|
placeholder="Ej. Los campeones">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-secondary"
|
||||||
|
data-bs-dismiss="modal">
|
||||||
|
Cancelar
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-kahoot-login"
|
||||||
|
id="btnCrearSala">
|
||||||
|
Crear sala
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script
|
||||||
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js">
|
||||||
|
</script>
|
||||||
|
<script src="js/lobbyDummy.js"></script>
|
||||||
|
<script src="js/buscadorSala.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
+310
@@ -0,0 +1,310 @@
|
|||||||
|
<?php
|
||||||
|
if (session_status() === PHP_SESSION_NONE) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprobación de sesión
|
||||||
|
$isLoggedIn = isset($_SESSION['usuario']) && !empty($_SESSION['usuario']);
|
||||||
|
$username = $isLoggedIn ? $_SESSION['usuario'] : '';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Bootstrap 5 CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<!-- FontAwesome para iconos -->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
|
||||||
|
<!-- Google Fonts para estilo Kahoot -->
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="/css/index.css">
|
||||||
|
<style>
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--kahoot-purple: #46178f;
|
||||||
|
--kahoot-blue: #1368ce;
|
||||||
|
--kahoot-red: #e21b3c;
|
||||||
|
--kahoot-yellow: #ffa602;
|
||||||
|
--kahoot-green: #26890c;
|
||||||
|
--kahoot-green-hover: #1f6f09;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Fredoka', sans-serif;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-kahoot {
|
||||||
|
background-color: var(--kahoot-purple);
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.8rem;
|
||||||
|
color: #fff !important;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-kahoot-login {
|
||||||
|
background-color: var(--kahoot-blue);
|
||||||
|
color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 4px solid #0c4891;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-kahoot-login:hover {
|
||||||
|
background-color: #0f56ab;
|
||||||
|
color: white;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-kahoot-register {
|
||||||
|
background-color: var(--kahoot-green);
|
||||||
|
color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 4px solid var(--kahoot-green-hover);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-kahoot-register:hover {
|
||||||
|
background-color: #2bb00f;
|
||||||
|
color: white;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-btn {
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
color: white;
|
||||||
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||||
|
border-radius: 50px;
|
||||||
|
padding: 8px 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-btn:hover,
|
||||||
|
.user-dropdown-btn:focus,
|
||||||
|
.user-dropdown-btn.show {
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
color: white;
|
||||||
|
border-color: #fff;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu {
|
||||||
|
border-radius: 15px;
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 10px 25px rgba(0,0,0,0.2);
|
||||||
|
padding: 10px;
|
||||||
|
min-width: 200px;
|
||||||
|
margin-top: 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu .dropdown-item {
|
||||||
|
border-radius: 10px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 10px 15px;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu .dropdown-item:hover {
|
||||||
|
background-color: #f0eafb;
|
||||||
|
color: var(--kahoot-purple);
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu .dropdown-item.logout-item {
|
||||||
|
color: var(--kahoot-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu .dropdown-item.logout-item:hover {
|
||||||
|
background-color: #fde8ea;
|
||||||
|
color: var(--kahoot-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-play-kahoot {
|
||||||
|
background-color: var(--kahoot-green);
|
||||||
|
color: white;
|
||||||
|
font-size: 2.2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
width: 100%;
|
||||||
|
padding: 30px 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 8px solid var(--kahoot-green-hover);
|
||||||
|
box-shadow: 0 8px 15px rgba(0,0,0,0.2);
|
||||||
|
transition: all 0.1s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-play-kahoot:hover {
|
||||||
|
background-color: #2bb00f;
|
||||||
|
color: white;
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 12px 20px rgba(0,0,0,0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-play-kahoot:active {
|
||||||
|
transform: translateY(4px);
|
||||||
|
border-bottom: 2px solid var(--kahoot-green-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ranking-card {
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ranking-header {
|
||||||
|
background-color: var(--kahoot-yellow);
|
||||||
|
color: #333;
|
||||||
|
padding: 15px 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trophy-icon {
|
||||||
|
font-size: 3rem;
|
||||||
|
color: var(--kahoot-yellow);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Estilos modales */
|
||||||
|
.modal-content {
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-kahoot py-3 mb-4">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">
|
||||||
|
<i class="fa-solid fa-gamepad me-2"></i>TRIVIAGMÁTICO
|
||||||
|
</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="navbarContent">
|
||||||
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0"></ul>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
<?php if ($isLoggedIn): ?>
|
||||||
|
<!-- Menú desplegable cuando la sesión está iniciada -->
|
||||||
|
<div class="dropdown">
|
||||||
|
<button class="btn user-dropdown-btn dropdown-toggle d-flex align-items-center gap-2"
|
||||||
|
type="button"
|
||||||
|
id="userDropdown"
|
||||||
|
data-bs-toggle="dropdown"
|
||||||
|
aria-expanded="false">
|
||||||
|
<i class="fa-solid fa-circle-user fa-lg text-warning"></i>
|
||||||
|
<span><?= htmlspecialchars($username) ?></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-end user-dropdown-menu" aria-labelledby="userDropdown">
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item d-flex align-items-center gap-2" href="perfil.php">
|
||||||
|
<i class="fa-solid fa-user text-primary"></i> Perfil
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item logout-item d-flex align-items-center gap-2" href="logout.php">
|
||||||
|
<i class="fa-solid fa-right-from-bracket"></i> Cerrar Sesión
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<!-- Botones que abren los modales cuando NO hay sesión iniciada -->
|
||||||
|
<button type="button" class="btn btn-kahoot-login rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#modalLogin">
|
||||||
|
<i class="fa-solid fa-right-to-bracket me-1"></i> Iniciar Sesión
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-kahoot-register rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#modalRegistro">
|
||||||
|
<i class="fa-solid fa-user-plus me-1"></i> Registrarse
|
||||||
|
</button>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- MODAL DE LOGIN -->
|
||||||
|
<div class="modal fade" id="modalLogin" tabindex="-1" aria-labelledby="loginModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content border-dark">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5 fw-bold" id="loginModalLabel">
|
||||||
|
<i class="fa-solid fa-right-to-bracket text-primary me-2"></i>Iniciar sesión
|
||||||
|
</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="formLogin">
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input type="email" class="form-control border-dark" id="loginEmail" name="email" placeholder="Correo electrónico" required>
|
||||||
|
<label for="loginEmail">Correo electrónico</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input type="password" class="form-control border-dark" id="loginPassword" name="password" placeholder="Contraseña" required>
|
||||||
|
<label for="loginPassword">Contraseña</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" id="recordar" name="recordar" type="checkbox" />
|
||||||
|
<label for="recordar" class="small">Recuérdeme durante 10 días</label>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="orden" value="validar">
|
||||||
|
</form>
|
||||||
|
<div id="errorLogin" class="text-danger fw-bold mt-2"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary rounded-pill px-3" data-bs-dismiss="modal">Cancelar</button>
|
||||||
|
<button type="button" class="btn btn-primary rounded-pill px-4" id="botonAceptarLogin">Entrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- MODAL DE REGISTRO -->
|
||||||
|
<div class="modal fade" id="modalRegistro" tabindex="-1" aria-labelledby="registroModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content border-dark">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5 fw-bold" id="registroModalLabel">
|
||||||
|
<i class="fa-solid fa-user-plus text-success me-2"></i>Registrarse
|
||||||
|
</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="formRegistro">
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input type="text" class="form-control border-dark" id="regNombre" name="nombre" placeholder="Nombre" required>
|
||||||
|
<label for="regNombre">Nombre</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input type="email" class="form-control border-dark" id="regEmail" name="email" placeholder="Correo electrónico" required>
|
||||||
|
<label for="regEmail">Correo electrónico</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input type="password" class="form-control border-dark" id="regPassword" name="password" placeholder="Contraseña" required>
|
||||||
|
<label for="regPassword">Contraseña</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating mb-3">
|
||||||
|
<input type="password" class="form-control border-dark" id="regPasswordConfirm" name="passwordConfirm" placeholder="Confirmar contraseña" required>
|
||||||
|
<label for="regPasswordConfirm">Confirmar contraseña</label>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="orden" value="registrar">
|
||||||
|
</form>
|
||||||
|
<div id="errorRegistro" class="text-danger fw-bold mt-2"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary rounded-pill px-3" data-bs-dismiss="modal">Cancelar</button>
|
||||||
|
<button type="button" class="btn btn-success rounded-pill px-4" id="botonAceptarRegistro">Registrarse</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
.btn-crear-sala {
|
||||||
|
width: auto;
|
||||||
|
min-width: 280px;
|
||||||
|
padding: 18px 35px;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
border-radius: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sala {
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
|
||||||
|
overflow: hidden;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sala-header {
|
||||||
|
background-color: var(--kahoot-purple);
|
||||||
|
color: white;
|
||||||
|
padding: 15px 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sala-body {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.equipos {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.equipo {
|
||||||
|
width: 50%;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 15px;
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.equipo h6 {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jugadores {
|
||||||
|
flex-grow: 1;
|
||||||
|
min-height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jugador {
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-unirse {
|
||||||
|
border: none;
|
||||||
|
border-bottom: 3px solid #0c4891;
|
||||||
|
background-color: var(--kahoot-blue);
|
||||||
|
color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-unirse:hover {
|
||||||
|
background-color: #0f56ab;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-kahoot {
|
||||||
|
border: none;
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-kahoot-header {
|
||||||
|
background-color: var(--kahoot-purple);
|
||||||
|
color: white;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-kahoot {
|
||||||
|
border: 2px solid #ddd;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-kahoot:focus {
|
||||||
|
border-color: var(--kahoot-purple);
|
||||||
|
box-shadow: 0 0 0 3px rgba(70, 23, 143, 0.15);
|
||||||
|
}
|
||||||
+142
@@ -0,0 +1,142 @@
|
|||||||
|
:root {
|
||||||
|
--kahoot-purple: #46178f;
|
||||||
|
--kahoot-blue: #1368ce;
|
||||||
|
--kahoot-red: #e21b3c;
|
||||||
|
--kahoot-yellow: #ffa602;
|
||||||
|
--kahoot-green: #26890c;
|
||||||
|
--kahoot-green-hover: #1f6f09;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Fredoka", sans-serif;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-kahoot {
|
||||||
|
background-color: var(--kahoot-purple);
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.8rem;
|
||||||
|
color: #fff !important;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-kahoot-login {
|
||||||
|
background-color: var(--kahoot-blue);
|
||||||
|
color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 4px solid #0c4891;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-kahoot-login:hover {
|
||||||
|
background-color: #0f56ab;
|
||||||
|
color: white;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Estilos del Dropdown de usuario */
|
||||||
|
.user-dropdown-btn {
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
color: white;
|
||||||
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||||
|
border-radius: 50px;
|
||||||
|
padding: 8px 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-btn:hover,
|
||||||
|
.user-dropdown-btn:focus,
|
||||||
|
.user-dropdown-btn.show {
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
color: white;
|
||||||
|
border-color: #fff;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu {
|
||||||
|
border-radius: 15px;
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
||||||
|
padding: 10px;
|
||||||
|
min-width: 200px;
|
||||||
|
margin-top: 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu .dropdown-item {
|
||||||
|
border-radius: 10px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 10px 15px;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu .dropdown-item:hover {
|
||||||
|
background-color: #f0eafb;
|
||||||
|
color: var(--kahoot-purple);
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu .dropdown-item.logout-item {
|
||||||
|
color: var(--kahoot-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-dropdown-menu .dropdown-item.logout-item:hover {
|
||||||
|
background-color: #fde8ea;
|
||||||
|
color: var(--kahoot-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-play-kahoot {
|
||||||
|
background-color: var(--kahoot-green);
|
||||||
|
color: white;
|
||||||
|
font-size: 2.2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
width: 100%;
|
||||||
|
padding: 30px 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 8px solid var(--kahoot-green-hover);
|
||||||
|
box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
|
||||||
|
transition: all 0.1s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-play-kahoot:hover {
|
||||||
|
background-color: #2bb00f;
|
||||||
|
color: white;
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 12px 20px rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-play-kahoot:active {
|
||||||
|
transform: translateY(4px);
|
||||||
|
border-bottom: 2px solid var(--kahoot-green-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ranking-card {
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ranking-header {
|
||||||
|
background-color: var(--kahoot-yellow);
|
||||||
|
color: #333;
|
||||||
|
padding: 15px 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trophy-icon {
|
||||||
|
font-size: 3rem;
|
||||||
|
color: var(--kahoot-yellow);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
+403
@@ -0,0 +1,403 @@
|
|||||||
|
/* ========================================= */
|
||||||
|
/* PERFIL */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.perfil-container {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1050px;
|
||||||
|
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
padding: 40px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* TARJETA DEL PERFIL */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.perfil-card {
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
border-radius: 20px;
|
||||||
|
|
||||||
|
box-shadow:
|
||||||
|
0 8px 20px rgba(0, 0, 0, 0.08);
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* CABECERA DEL PERFIL */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.perfil-header {
|
||||||
|
background-color: var(--kahoot-purple);
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
font-size: 2rem;
|
||||||
|
|
||||||
|
font-weight: 700;
|
||||||
|
|
||||||
|
text-shadow:
|
||||||
|
2px 2px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* CONTENIDO */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.perfil-content {
|
||||||
|
padding: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* NOMBRE */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.nombre {
|
||||||
|
color: var(--kahoot-purple);
|
||||||
|
|
||||||
|
font-size: 2.5rem;
|
||||||
|
|
||||||
|
font-weight: 700;
|
||||||
|
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* FOTO */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.foto-container {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 180px;
|
||||||
|
height: 180px;
|
||||||
|
|
||||||
|
object-fit: cover;
|
||||||
|
|
||||||
|
border: 6px solid white;
|
||||||
|
|
||||||
|
box-shadow:
|
||||||
|
0 5px 15px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* BOTÓN CAMBIAR FOTO */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.btn-foto {
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
right: -5px;
|
||||||
|
bottom: 5px;
|
||||||
|
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
background-color: var(--kahoot-blue);
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
border-bottom: 5px solid #0c4891;
|
||||||
|
|
||||||
|
font-size: 24px;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btn-foto:hover {
|
||||||
|
background-color: #0f56ab;
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
transform: translateY(-3px);
|
||||||
|
|
||||||
|
box-shadow:
|
||||||
|
0 5px 10px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btn-foto:active {
|
||||||
|
transform: translateY(3px);
|
||||||
|
|
||||||
|
border-bottom: 2px solid #0c4891;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* FORMULARIO NOMBRE */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.formulario-nombre {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
|
||||||
|
border-radius: 20px;
|
||||||
|
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
max-width: 400px;
|
||||||
|
|
||||||
|
margin: 25px auto 0;
|
||||||
|
|
||||||
|
box-shadow:
|
||||||
|
0 5px 12px rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.formulario-nombre label {
|
||||||
|
color: var(--kahoot-purple);
|
||||||
|
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* INPUT */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.formulario-nombre .form-control {
|
||||||
|
border-radius: 12px;
|
||||||
|
|
||||||
|
padding: 11px 15px;
|
||||||
|
|
||||||
|
border: 2px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.formulario-nombre .form-control:focus {
|
||||||
|
border-color: var(--kahoot-blue);
|
||||||
|
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 3px rgba(19, 104, 206, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* BOTÓN CAMBIAR NOMBRE */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.btn-perfil-cambiar {
|
||||||
|
background-color: var(--kahoot-green);
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
font-weight: 700;
|
||||||
|
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
border-bottom: 5px solid var(--kahoot-green-hover);
|
||||||
|
|
||||||
|
border-radius: 12px;
|
||||||
|
|
||||||
|
padding: 10px 18px;
|
||||||
|
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btn-perfil-cambiar:hover {
|
||||||
|
background-color: #2bb00f;
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btn-perfil-cambiar:active {
|
||||||
|
transform: translateY(3px);
|
||||||
|
|
||||||
|
border-bottom-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* BOTÓN BORRAR */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.btn-perfil-borrar {
|
||||||
|
background-color: var(--kahoot-red);
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
font-weight: 700;
|
||||||
|
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
border-bottom: 5px solid #a9142d;
|
||||||
|
|
||||||
|
border-radius: 12px;
|
||||||
|
|
||||||
|
padding: 10px 18px;
|
||||||
|
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btn-perfil-borrar:hover {
|
||||||
|
background-color: #c91635;
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btn-perfil-borrar:active {
|
||||||
|
transform: translateY(3px);
|
||||||
|
|
||||||
|
border-bottom-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* ESTADÍSTICAS */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.estadisticas {
|
||||||
|
background-color: var(--kahoot-purple);
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
border-radius: 20px;
|
||||||
|
|
||||||
|
padding: 30px;
|
||||||
|
|
||||||
|
min-height: 350px;
|
||||||
|
|
||||||
|
box-shadow:
|
||||||
|
0 8px 20px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.estadisticas h2 {
|
||||||
|
font-size: 2rem;
|
||||||
|
|
||||||
|
font-weight: 700;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
margin-bottom: 30px;
|
||||||
|
|
||||||
|
text-shadow:
|
||||||
|
2px 2px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* ESTADÍSTICAS INDIVIDUALES */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
.estadistica {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
border-radius: 12px;
|
||||||
|
|
||||||
|
padding: 15px;
|
||||||
|
|
||||||
|
margin-bottom: 15px;
|
||||||
|
|
||||||
|
font-size: 1.2rem;
|
||||||
|
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
box-shadow:
|
||||||
|
0 4px 8px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.estadistica-victorias {
|
||||||
|
background-color: var(--kahoot-green);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.estadistica-derrotas {
|
||||||
|
background-color: var(--kahoot-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.estadistica-aciertos {
|
||||||
|
background-color: var(--kahoot-yellow);
|
||||||
|
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ========================================= */
|
||||||
|
/* RESPONSIVE */
|
||||||
|
/* ========================================= */
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
|
||||||
|
.perfil-container {
|
||||||
|
padding: 25px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.perfil-content {
|
||||||
|
padding: 30px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.nombre {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 150px;
|
||||||
|
height: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.estadisticas {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.formulario-nombre {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btn-perfil-cambiar,
|
||||||
|
.btn-perfil-borrar {
|
||||||
|
padding: 9px 12px;
|
||||||
|
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
// Usuario logueado (CAMBIAR A NULL PARA CERRAR SESIÓN)
|
||||||
|
$_SESSION['usuario'] = "Alexis";
|
||||||
|
|
||||||
|
$isLoggedIn = isset($_SESSION['usuario']);
|
||||||
|
$username = $isLoggedIn ? $_SESSION['usuario'] : '';
|
||||||
|
|
||||||
|
|
||||||
|
include 'cabecera.php';
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="es-ES">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Proyecto Trivial</title>
|
<title>Triviagmático</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div class="container my-5">
|
||||||
|
<div class="row justify-content-center align-items-center g-4">
|
||||||
|
|
||||||
|
<!-- Botón Jugar (solo se muestra si está logueado) -->
|
||||||
|
<?php if ($isLoggedIn): ?>
|
||||||
|
<div class="col-12 col-lg-5 col-xl-4">
|
||||||
|
<a href="buscadorSala.php" class="btn btn-play-kahoot" id="btnJugar">
|
||||||
|
<i class="fa-solid fa-play"></i>
|
||||||
|
<span>¡JUGAR!</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<!-- Ranking -->
|
||||||
|
<div class="col-12 <?= $isLoggedIn ? 'col-lg-7 col-xl-8' : 'col-lg-8' ?>">
|
||||||
|
<div class="card ranking-card">
|
||||||
|
<div class="ranking-header">
|
||||||
|
<h3 class="m-0"><i class="fa-solid fa-trophy me-2"></i> RANKING GLOBAL DE JUGADORES</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<!-- Div datos de ranking -->
|
||||||
|
<div id="ranking-container" class="ranking-placeholder text-center p-4">
|
||||||
|
<i class="fa-solid fa-medal trophy-icon"></i>
|
||||||
|
<h4 class="fw-bold text-secondary">Cargando clasificación...</h4>
|
||||||
|
<p class="text-muted mb-0">Los mejores equipos y jugadores aparecerán aquí pronto.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- JS de Bootstrap -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
const btnCrearSala = document.getElementById("btnCrearSala");
|
||||||
|
|
||||||
|
const nombreSala = document.getElementById("nombreSala");
|
||||||
|
const nombreEquipo1 = document.getElementById("nombreEquipo1");
|
||||||
|
const nombreEquipo2 = document.getElementById("nombreEquipo2");
|
||||||
|
|
||||||
|
btnCrearSala.addEventListener("click", function () {
|
||||||
|
limpiarErrores();
|
||||||
|
|
||||||
|
const sala = nombreSala.value.trim();
|
||||||
|
const equipo1 = nombreEquipo1.value.trim();
|
||||||
|
const equipo2 = nombreEquipo2.value.trim();
|
||||||
|
|
||||||
|
let formularioValido = true;
|
||||||
|
|
||||||
|
if (sala === "") {
|
||||||
|
mostrarError(nombreSala, "El nombre de la sala es obligatorio.");
|
||||||
|
|
||||||
|
formularioValido = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (equipo1 === "") {
|
||||||
|
mostrarError(nombreEquipo1, "El nombre del equipo 1 es obligatorio.");
|
||||||
|
|
||||||
|
formularioValido = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (equipo2 === "") {
|
||||||
|
mostrarError(nombreEquipo2, "El nombre del equipo 2 es obligatorio.");
|
||||||
|
|
||||||
|
formularioValido = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formularioValido) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Sala:", sala);
|
||||||
|
console.log("Equipo 1:", equipo1);
|
||||||
|
console.log("Equipo 2:", equipo2);
|
||||||
|
|
||||||
|
|
||||||
|
const idSala = 1;
|
||||||
|
|
||||||
|
//TODO aqui va la peticion ayax en el futuro para crear la sala en la bbdd
|
||||||
|
|
||||||
|
window.location.href = "sala.html?id=" + idSala;
|
||||||
|
});
|
||||||
|
|
||||||
|
function mostrarError(input, mensaje) {
|
||||||
|
input.classList.add("is-invalid");
|
||||||
|
|
||||||
|
// Comprobamos si ya existe un mensaje
|
||||||
|
let mensajeError = input.parentElement.querySelector(".invalid-feedback");
|
||||||
|
|
||||||
|
if (!mensajeError) {
|
||||||
|
mensajeError = document.createElement("div");
|
||||||
|
|
||||||
|
mensajeError.classList.add("invalid-feedback");
|
||||||
|
|
||||||
|
input.parentElement.appendChild(mensajeError);
|
||||||
|
}
|
||||||
|
|
||||||
|
mensajeError.textContent = mensaje;
|
||||||
|
}
|
||||||
|
|
||||||
|
function limpiarErrores() {
|
||||||
|
const inputs = [nombreSala, nombreEquipo1, nombreEquipo2];
|
||||||
|
|
||||||
|
inputs.forEach((input) => {
|
||||||
|
input.classList.remove("is-invalid");
|
||||||
|
|
||||||
|
const mensajeError = input.parentElement.querySelector(".invalid-feedback");
|
||||||
|
|
||||||
|
if (mensajeError) {
|
||||||
|
mensajeError.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
// ============================================
|
||||||
|
// DATOS DE PRUEBA
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
const salas = [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
nombre: "Sala Principal",
|
||||||
|
equipos: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
nombre: "Equipo 1",
|
||||||
|
jugadores: [
|
||||||
|
"Carlos",
|
||||||
|
"María"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
nombre: "Equipo 2",
|
||||||
|
jugadores: [
|
||||||
|
"Jorge"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
nombre: "Los Trivialeros",
|
||||||
|
equipos: [
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
nombre: "Equipo Rojo",
|
||||||
|
jugadores: [
|
||||||
|
"Ana",
|
||||||
|
"Pedro",
|
||||||
|
"Lucía"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
nombre: "Equipo Azul",
|
||||||
|
jugadores: [
|
||||||
|
"David",
|
||||||
|
"Laura"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
nombre: "Partida rápida",
|
||||||
|
equipos: [
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
nombre: "Equipo 1",
|
||||||
|
jugadores: [
|
||||||
|
"Miguel"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 6,
|
||||||
|
nombre: "Equipo 2",
|
||||||
|
jugadores: []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
nombre: "Noche de Trivial",
|
||||||
|
equipos: [
|
||||||
|
{
|
||||||
|
id: 7,
|
||||||
|
nombre: "Los quesitos",
|
||||||
|
jugadores: [
|
||||||
|
"Pablo",
|
||||||
|
"Sara"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
nombre: "Los cerebritos",
|
||||||
|
jugadores: [
|
||||||
|
"Mario",
|
||||||
|
"Elena",
|
||||||
|
"Álvaro"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// MOSTRAR SALAS
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
function mostrarSalas(salas) {
|
||||||
|
|
||||||
|
const contenedor = document.getElementById("contenedorSalas");
|
||||||
|
|
||||||
|
contenedor.innerHTML = "";
|
||||||
|
|
||||||
|
salas.forEach(sala => {
|
||||||
|
|
||||||
|
const columna = document.createElement("div");
|
||||||
|
|
||||||
|
columna.className = "col-12 col-md-6 col-xl-5";
|
||||||
|
|
||||||
|
|
||||||
|
columna.innerHTML = `
|
||||||
|
|
||||||
|
<div class="sala">
|
||||||
|
|
||||||
|
<div class="sala-header">
|
||||||
|
${sala.nombre}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="sala-body">
|
||||||
|
|
||||||
|
<div class="equipos">
|
||||||
|
|
||||||
|
${crearEquipo(sala, sala.equipos[0])}
|
||||||
|
|
||||||
|
${crearEquipo(sala, sala.equipos[1])}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
contenedor.appendChild(columna);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// CREAR EQUIPO
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
function crearEquipo(sala, equipo) {
|
||||||
|
|
||||||
|
let jugadoresHTML = "";
|
||||||
|
|
||||||
|
equipo.jugadores.forEach(jugador => {
|
||||||
|
|
||||||
|
jugadoresHTML += `
|
||||||
|
<div class="jugador">
|
||||||
|
<span class="avatar">👤</span>
|
||||||
|
${jugador}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return `
|
||||||
|
|
||||||
|
<div class="equipo">
|
||||||
|
|
||||||
|
<h6>
|
||||||
|
${equipo.nombre}
|
||||||
|
</h6>
|
||||||
|
|
||||||
|
<div class="jugadores">
|
||||||
|
|
||||||
|
${jugadoresHTML}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-unirse"
|
||||||
|
onclick="unirseEquipo(${sala.id}, ${equipo.id})">
|
||||||
|
|
||||||
|
Unirse
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function unirseEquipo(idSala, idEquipo) {
|
||||||
|
|
||||||
|
console.log("Sala:", idSala);
|
||||||
|
console.log("Equipo:", idEquipo);
|
||||||
|
|
||||||
|
alert(
|
||||||
|
"Has pulsado unirse al equipo " +
|
||||||
|
idEquipo +
|
||||||
|
" de la sala " +
|
||||||
|
idSala
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// CARGAR DATOS DE PRUEBA
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
mostrarSalas(salas);
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
// =========================
|
||||||
|
// CAMBIAR NOMBRE
|
||||||
|
// =========================
|
||||||
|
|
||||||
|
function cambiarNombre() {
|
||||||
|
|
||||||
|
const input = document.getElementById("nuevoNombre");
|
||||||
|
const nombre = document.getElementById("nombre");
|
||||||
|
|
||||||
|
const nuevoNombre = input.value.trim();
|
||||||
|
|
||||||
|
if (nuevoNombre !== "") {
|
||||||
|
|
||||||
|
nombre.textContent = nuevoNombre;
|
||||||
|
|
||||||
|
input.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// BORRAR NOMBRE
|
||||||
|
// =========================
|
||||||
|
|
||||||
|
function borrarNombre() {
|
||||||
|
|
||||||
|
document.getElementById("nuevoNombre").value = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// ABRIR SELECTOR DE IMAGEN
|
||||||
|
// =========================
|
||||||
|
|
||||||
|
function seleccionarFoto() {
|
||||||
|
|
||||||
|
document.getElementById("inputFoto").click();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// CAMBIAR FOTO
|
||||||
|
// =========================
|
||||||
|
|
||||||
|
document.getElementById("inputFoto").addEventListener(
|
||||||
|
"change",
|
||||||
|
function(event) {
|
||||||
|
|
||||||
|
const archivo = event.target.files[0];
|
||||||
|
|
||||||
|
if (archivo) {
|
||||||
|
|
||||||
|
// Comprobamos que sea una imagen
|
||||||
|
if (!archivo.type.startsWith("image/")) {
|
||||||
|
|
||||||
|
alert("Por favor, selecciona una imagen.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Creamos una URL temporal
|
||||||
|
const imagenURL = URL.createObjectURL(archivo);
|
||||||
|
|
||||||
|
|
||||||
|
// Cambiamos la foto
|
||||||
|
document.getElementById("fotoPerfil").src = imagenURL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
+236
@@ -0,0 +1,236 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<title>Perfil</title>
|
||||||
|
|
||||||
|
<!-- Bootstrap -->
|
||||||
|
<link
|
||||||
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||||
|
rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Bootstrap Icons -->
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
|
||||||
|
<!-- Google Font: Fredoka -->
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap"
|
||||||
|
rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Tu CSS -->
|
||||||
|
<link rel="stylesheet" href="css/index.css">
|
||||||
|
<link rel="stylesheet" href="css/perfil.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include_once 'cabecera.php';
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="perfil-container">
|
||||||
|
|
||||||
|
<div class="perfil-card">
|
||||||
|
|
||||||
|
<!-- ========================= -->
|
||||||
|
<!-- CABECERA -->
|
||||||
|
<!-- ========================= -->
|
||||||
|
|
||||||
|
<div class="perfil-header">
|
||||||
|
<i class="bi bi-person-circle"></i>
|
||||||
|
Mi perfil
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="perfil-content">
|
||||||
|
|
||||||
|
<div class="row align-items-center g-5">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ========================= -->
|
||||||
|
<!-- PERFIL -->
|
||||||
|
<!-- ========================= -->
|
||||||
|
|
||||||
|
<div class="col-md-6 text-center">
|
||||||
|
|
||||||
|
<!-- Nombre -->
|
||||||
|
|
||||||
|
<h1 id="nombre" class="nombre">
|
||||||
|
tuNombre
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ========================= -->
|
||||||
|
<!-- FOTO DE PERFIL -->
|
||||||
|
<!-- ========================= -->
|
||||||
|
|
||||||
|
<div class="foto-container">
|
||||||
|
|
||||||
|
<img
|
||||||
|
id="fotoPerfil"
|
||||||
|
src="https://i.pravatar.cc/300?img=47"
|
||||||
|
alt="Foto de perfil"
|
||||||
|
class="avatar rounded-circle">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Botón lápiz -->
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn-foto"
|
||||||
|
onclick="seleccionarFoto()"
|
||||||
|
title="Cambiar foto de perfil"
|
||||||
|
aria-label="Cambiar foto de perfil">
|
||||||
|
|
||||||
|
<i class="bi bi-pencil-fill"></i>
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Input oculto -->
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
id="inputFoto"
|
||||||
|
accept="image/*"
|
||||||
|
hidden>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ========================= -->
|
||||||
|
<!-- CAMBIAR NOMBRE -->
|
||||||
|
<!-- ========================= -->
|
||||||
|
|
||||||
|
<div class="formulario-nombre">
|
||||||
|
|
||||||
|
<label
|
||||||
|
for="nuevoNombre"
|
||||||
|
class="form-label">
|
||||||
|
|
||||||
|
Cambia tu nombre
|
||||||
|
|
||||||
|
</label>
|
||||||
|
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="nuevoNombre"
|
||||||
|
class="form-control mb-3"
|
||||||
|
placeholder="Escribe tu nuevo nombre">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center gap-2">
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn-perfil-cambiar"
|
||||||
|
onclick="cambiarNombre()">
|
||||||
|
|
||||||
|
<i class="bi bi-check-lg"></i>
|
||||||
|
Cambiar nombre
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn-perfil-borrar"
|
||||||
|
onclick="borrarNombre()">
|
||||||
|
|
||||||
|
<i class="bi bi-x-lg"></i>
|
||||||
|
Borrar
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ========================= -->
|
||||||
|
<!-- ESTADÍSTICAS -->
|
||||||
|
<!-- ========================= -->
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
<div class="estadisticas">
|
||||||
|
|
||||||
|
<h2>
|
||||||
|
<i class="bi bi-bar-chart-fill"></i>
|
||||||
|
Estadísticas
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="estadistica estadistica-victorias">
|
||||||
|
|
||||||
|
<i class="bi bi-trophy-fill"></i>
|
||||||
|
Victorias:
|
||||||
|
|
||||||
|
<strong>
|
||||||
|
0
|
||||||
|
</strong>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="estadistica estadistica-derrotas">
|
||||||
|
|
||||||
|
<i class="bi bi-x-circle-fill"></i>
|
||||||
|
Derrotas:
|
||||||
|
|
||||||
|
<strong>
|
||||||
|
0
|
||||||
|
</strong>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="estadistica estadistica-aciertos">
|
||||||
|
|
||||||
|
<i class="bi bi-bullseye"></i>
|
||||||
|
Aciertos:
|
||||||
|
|
||||||
|
<strong>
|
||||||
|
0
|
||||||
|
</strong>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script
|
||||||
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Tu JavaScript -->
|
||||||
|
<script src="js/perfil.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
REQUISITOS CONTROLADORES
|
||||||
|
|
||||||
|
registrarUsuario(nombre, email, password) inserta un usuario en la bbdd, hay que comprobar que en la tabla usuario no hay una cuenta con el correo electronico
|
||||||
|
|
||||||
|
comprobarUsuario(email, password) comprueba si el usuario introducido se encuentra en la bbdd para poder iniciar sesion, hay que actualizar las variables de sesion para guardar su email y su id de la bbdd.
|
||||||
|
|
||||||
|
Orden “RankingGlobal“
|
||||||
|
|
||||||
|
rankingGlobal() recupera los 5 usuarios con mas puntos ordenados por el maximo de puntos
|
||||||
|
|
||||||
|
crearSala(nombreSala, nombreEquipo1, nombreEquipo2) inserta en la bbdd una sala y asigna al usuario que la crea a equipo 1
|
||||||
|
|
||||||
|
Orden “BuscarSalas“
|
||||||
|
|
||||||
|
buscarSala() recupera todas las salas activas a las que el usuario se puede unir, devuelve nombre de sala, nombre de equipo, **id equipo**(todos los equipos), nombre usuarios.
|
||||||
|
|
||||||
|
Orden “AsignarUsuario“
|
||||||
|
|
||||||
|
asignarUsuario(**id equipo**, id usuario(variable de sesion)) cuando el usuario pulsa el boton de unirse asigna al equipo dicho usuario
|
||||||
|
|
||||||
|
buscarSalaUsuarioActivo(**id equipo)** recarga la pagina para solo mostrar la sala en la que se encuentra el usuario
|
||||||
|
|
||||||
|
cargarPreguntasyRespuestas() recupera todas las preguntas de la partida (10 preguntas por partida), devuelve un json con las preguntas, las 4 respuestas
|
||||||
|
|
||||||
|
Orden ”ComprobarRespuesta”
|
||||||
|
|
||||||
|
comprobarRespuesta(idRespuesta, idUsuario, tiempo) comprueba si el usuario ha pulsado sobre la respuesta correcta o incorrecta, devuelve si es correcta o incorrecta
|
||||||
|
|
||||||
|
comprobarEquipoGanador() comprueba cual de los dos equipos gana, devuelve un json con la puntuacion global, nombre de equipos, nombre de usuarios y puntuacion de cada usuario, actualiza el ranking global de usuarios
|
||||||
Reference in New Issue
Block a user