Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2a80f88
feat: reestructurar componentes de botones y mejorar importaciones
aek676 Nov 29, 2025
f926db8
feat: reescribir SetupScreen en Astro y ajustar importaciones en la p…
aek676 Nov 29, 2025
b2dca81
feat: agregar componente ConfigGame y eliminar SetupScreen en la pági…
aek676 Nov 29, 2025
0d0a564
feat: pulir pantalla de configuración y mejorar el componente MyButton
aek676 Nov 29, 2025
afb0e50
feat: agregar componente MyInput con estilos personalizados y soporte…
aek676 Nov 29, 2025
818ab0a
feat: reemplazar Input por MyInput en ConfigGame y ajustar estilos de…
aek676 Nov 29, 2025
3665538
feat: agregar componente PlayerListItem y mejorar la gestión de jugad…
aek676 Nov 29, 2025
0d2a8b7
feat: pulir componente PlayerListItem eliminando el botón de eliminar…
aek676 Dec 5, 2025
b7ccfcc
feat: pulir componente PlayerListItem ajustando estilos y mejorando l…
aek676 Dec 5, 2025
5c36f83
feat: pulir componente MyButton eliminando comentarios innecesarios y…
aek676 Dec 5, 2025
9ce93e5
feat: eliminar botón de eliminar en ConfigGame y agregar componente X…
aek676 Dec 5, 2025
2496d88
feat: agregar componente XButton en PlayerListItem y crear página de …
aek676 Dec 5, 2025
2be00c6
feat: agregar funcionalidad para eliminar jugadores en ConfigGame y a…
aek676 Dec 5, 2025
bd0ddf8
feat: pulir estilos del botón MyButton y ajustar alineación en la pág…
aek676 Dec 5, 2025
616db1f
feat: pulir estilos de la pantalla de configuración y mejorar la pres…
aek676 Dec 5, 2025
0ec3dcc
Merge pull request #22 from aek676:feat/ui/setup-screen-polish
aek676 Dec 5, 2025
b4f695e
feat: eliminar comentarios innecesarios en ConfigGame y MyInput
aek676 Dec 5, 2025
31066f3
feat: eliminar prefijos de borde en MyButton, PlayerListItem y XButton
aek676 Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/components/ActionButton.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
import MyButton from "./MyButton.astro";

interface Props {
text: string;
}

const { text } = Astro.props;
---

<MyButton text={text} type="submit" />
9 changes: 0 additions & 9 deletions src/components/ActionButton.tsx

This file was deleted.

196 changes: 196 additions & 0 deletions src/components/ConfigGame.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
---
import { actions } from "astro:actions";
import MyButton from "./MyButton.astro";
import { Card } from "./ui/card";
import { Label } from "./ui/label";
import MyInput from "./MyInput.astro";
import PlayerListItem from "./PlayerListItem.astro";

interface Props {
minPlayers?: number;
serverError?: string;
}

const { minPlayers = 3, serverError } = Astro.props;
---

<div class="min-h-screen flex items-center justify-center p-4">
<Card
className="w-full max-w-2xl bg-[#e3eef2] backdrop-blur border-border p-8 space-y-6"
>
<div class="text-center space-y-2">
<h2 class="text-4xl text">Configuración</h2>
<p class="text-muted-foreground">
Añade al menos {minPlayers} jugadores
</p>
</div>

<div class="space-y-4">
<div class="flex gap-2">
<div class="flex-1">
<Label
htmlFor="playerName"
className="text-foreground hidden">Nombre</Label
>

<MyInput id="playerName" placeholder="Nombre..." />
</div>
<div class="flex items-end">
<MyButton
id="addPlayerBtn"
text="Añadir"
type="button"
scale={0.45}
disabled={true}
/>
</div>
</div>

<div id="playersSection" class="space-y-2 hidden">
<p class="text-muted-foreground">
Jugadores (<span id="playerCount">0</span>)
</p>
<div
id="playersList"
class="flex flex-wrap justify-center gap-2 max-h-64 overflow-y-auto p-2"
>
</div>
</div>

<template id="player-template">
<PlayerListItem playerName="" />
</template>
</div>

<form
method="POST"
action={actions.game.startGame}
id="startGameForm"
class="mt-6"
>
<fieldset id="startGameFieldset" class="flex justify-center">
<div id="hiddenInputsContainer"></div>

<MyButton text="Iniciar Juego" type="submit" scale={0.8} />
</fieldset>

{
serverError && (
<div class="mt-4 p-3 bg-red-900/50 border border-red-500 text-red-200 rounded text-sm">
❌ Error: {serverError}
</div>
)
}
</form>
</Card>
</div>

<script define:vars={{ minPlayers }}>
let players = [];
const playerNameInput = document.getElementById("playerName");
const addPlayerBtn = document.getElementById("addPlayerBtn");
const playersSection = document.getElementById("playersSection");
const playersList = document.getElementById("playersList");
const playerCount = document.getElementById("playerCount");
const fieldset = document.getElementById("startGameFieldset");
const hiddenInputsContainer = document.getElementById(
"hiddenInputsContainer",
);
const startGameForm = document.getElementById("startGameForm");
const submitBtn = fieldset.querySelector('button[type="submit"]');
const playerTemplate = document.getElementById("player-template");

function removePlayer(index) {
players.splice(index, 1);
updateUI();
}

function updateUI() {
playerCount.textContent = players.length;
playersSection.classList.toggle("hidden", players.length === 0);

const canStart = players.length >= minPlayers;
if (canStart) {
submitBtn.removeAttribute("data-disabled");
} else {
submitBtn.setAttribute("data-disabled", "true");
}

playersList.innerHTML = "";

players.forEach((p, i) => {
const clone = playerTemplate.content.cloneNode(true);
const nameEl = clone.querySelector(".player-name-text");
if (nameEl) nameEl.textContent = p;

const deleteBtn = clone.querySelector(".x-button-wrapper");
if (deleteBtn) {
deleteBtn.addEventListener("click", () => removePlayer(i));
}

playersList.appendChild(clone);
});

hiddenInputsContainer.innerHTML = players
.map((p) => `<input type="hidden" name="players" value="${p}" />`)
.join("");
}

function handleAdd() {
const val = playerNameInput.value.trim();
if (val) {
players.push(val);
playerNameInput.value = "";
updateUI();
checkInput();
}
}

addPlayerBtn.addEventListener("click", handleAdd);

const checkInput = () => {
const hasInput = !!playerNameInput.value.trim();
if (hasInput) {
addPlayerBtn.removeAttribute("data-disabled");
} else {
addPlayerBtn.setAttribute("data-disabled", "true");
}
};

playerNameInput.addEventListener("input", checkInput);

checkInput();
updateUI();

playerNameInput.addEventListener("keydown", (e) => {
if (e.key === "Enter") {
e.preventDefault();
handleAdd();
}
});

startGameForm.addEventListener("submit", (e) => {
if (players.length < minPlayers) {
e.preventDefault();
}
});
</script>

<style>
.text {
font-style: normal;
font-weight: 400;
color: #ffffff;
text-shadow:
-1px 0 1px #000000,
1px 0 1px #000000,
0 -1px 1px #000000,
0 4px 1px #000000,
-2px 4px 1px #000000,
2px 3px 2px #000000;

white-space: normal;
text-align: center;
line-height: 0.9;
}
</style>
11 changes: 2 additions & 9 deletions src/components/Hero.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
import LinkButton from "./LinkButton";
import LinkButton from "./LinkButton.astro";
import ImpostorAnimation from "@/components/ImpostorAnimation.astro";
---

<div class="min-h-screen flex items-center justify-center p-4 overflow-hidden">
<div
class="text-center space-y-8 animate-in fade-in duration-700 w-full max-w-4xl mx-auto"
>
{/* TÍTULO */}
<div class="space-y-4 px-2">
<h1
class="text-5xl sm:text-6xl md:text-8xl font-bold text-foreground drop-shadow-lg text-balance"
Expand All @@ -16,7 +15,6 @@ import ImpostorAnimation from "@/components/ImpostorAnimation.astro";
</h1>
</div>

{/* CONTENEDOR DE LA CARTA */}
<div
class="relative w-fit mx-auto
h-auto
Expand All @@ -27,24 +25,19 @@ import ImpostorAnimation from "@/components/ImpostorAnimation.astro";
shadow-[inset_0_0_120px_rgba(0,0,0,1)]
drop-shadow-[0_0_30px_rgba(220,38,38,0.2)]"
>
{/* Capa de ruido (Noise) */}
<div
class="absolute inset-0 bg-black opacity-10 mix-blend-overlay pointer-events-none rounded-lg"
style="background-image: url('data:image/svg+xml,%3Csvg viewBox=%270 0 250 250%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cfilter id=%27noiseFilter%27%3E%3CfeTurbulence type=%27fractalNoise%27 baseFrequency=%274%27 numOctaves=%273%27 stitchTiles=%27stitch%27/%3E%3C/filter%3E%3Crect width=%27100%25%27 height=%27100%25%27 filter=%27url(%23noiseFilter)%27/%3E%3C/svg%3E');"
>
</div>

{/* ANIMACIÓN */}
{
/* Aquí está la clave: w-full para que se adapte, max-w para limitar */
}
<div
class="w-full max-w-[260px] xs:max-w-[300px] sm:max-w-96 relative z-10 mx-auto"
>
<ImpostorAnimation />
</div>
</div>

<LinkButton text="Jugar" href="/config" client:load />
<LinkButton text="Jugar" href="/config" />
</div>
</div>
12 changes: 12 additions & 0 deletions src/components/LinkButton.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
import MyButton from "./MyButton.astro";

interface Props {
text: string;
href: string;
}

const { text, href } = Astro.props;
---

<MyButton text={text} href={href} />
10 changes: 0 additions & 10 deletions src/components/LinkButton.tsx

This file was deleted.

Loading