feat: Migración completa de SnatchGame a Nuxt 4
Some checks failed
build-and-deploy / filter (push) Successful in 3s
build-and-deploy / build (push) Failing after 6s
build-and-deploy / deploy (push) Has been skipped

- Creado nuevo proyecto Nuxt 4 con estructura app/
- Servidor Colyseus separado para evitar problemas con decoradores
- Migrado GameRoom y toda la lógica del juego
- Implementado cliente con composables useGameClient
- Panel de administración funcional
- Componentes Vue migrados (HomeScreen, GameScreen, PlayerCard, etc)
- Configuración para ejecutar ambos servidores (npm run dev:all)
This commit is contained in:
2025-08-05 16:05:51 -06:00
parent b83d450ac6
commit 62226ab5d4
36 changed files with 17126 additions and 2661 deletions

View File

@@ -0,0 +1,160 @@
<template>
<div class="container">
<div class="branding">
<img src="/assets/logo.svg" alt="Snatch Game Logo" class="logo" />
<h1>Snatch Game</h1>
</div>
<div class="buttons">
<button @click="onJoin" :disabled="isConnecting">
{{ isConnecting ? 'Conectando...' : 'Unirse a partida' }}
</button>
<button @click="onSettings">Configuración</button>
<button @click="onLogin">Iniciar sesión</button>
</div>
<div v-if="connectionStatus" class="connection-status">
{{ connectionStatus }}
</div>
<div class="footer">NucleoServices</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useGameClient } from '~/composables/useGameClient'
const emit = defineEmits<{
'join-game': [client: any]
'show-settings': []
}>()
const gameClient = useGameClient()
const isConnecting = ref(false)
const connectionStatus = computed(() => gameClient.connectionStatus.value)
const onJoin = async () => {
if (isConnecting.value) return
isConnecting.value = true
try {
await gameClient.connect('Jugador Test', 'classic')
console.log('Connected successfully')
// Emit the join-game event with the game client
emit('join-game', gameClient)
} catch (error) {
console.error('Error connecting:', error)
} finally {
isConnecting.value = false
}
}
const onSettings = () => {
emit('show-settings')
}
const onLogin = () => {
console.log('Login clicked')
// TODO: implement login logic
}
</script>
<style scoped>
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 2rem;
}
.branding {
text-align: center;
margin-bottom: 3rem;
}
.logo {
width: 120px;
height: 120px;
margin-bottom: 1rem;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.buttons {
display: flex;
flex-direction: column;
gap: 1rem;
width: 100%;
max-width: 300px;
}
button {
padding: 1rem 2rem;
font-size: 1.1rem;
font-weight: 600;
background: rgba(255, 255, 255, 0.2);
color: white;
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
button:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.3);
border-color: rgba(255, 255, 255, 0.5);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.connection-status {
margin-top: 2rem;
padding: 0.75rem 1.5rem;
background: rgba(255, 255, 255, 0.1);
border-radius: 8px;
backdrop-filter: blur(10px);
font-size: 0.9rem;
text-align: center;
}
.footer {
position: absolute;
bottom: 2rem;
font-size: 0.9rem;
opacity: 0.7;
}
@media (max-width: 768px) {
h1 {
font-size: 2rem;
}
.logo {
width: 80px;
height: 80px;
}
button {
font-size: 1rem;
padding: 0.75rem 1.5rem;
}
}
</style>