un poco decors
This commit is contained in:
parent
c36a19fb2a
commit
16807472ab
5 changed files with 215 additions and 37 deletions
|
|
@ -3,14 +3,14 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>ChessNut - Partie</title>
|
<title>ChessNut - Partie</title>
|
||||||
<style>body{font-family:Arial;margin:20px} input,button{padding:6px;margin:4px} #log{white-space:pre-wrap; border:1px solid #ddd;padding:8px;height:300px;overflow:auto} #players{margin:6px 0;padding-left:18px}</style>
|
<link rel="stylesheet" href="/styles/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>ChessNut — Partie</h2>
|
<h2>ChessNut — Partie</h2>
|
||||||
<div>Room: <strong id="roomId">-</strong>
|
<div>Room: <strong id="roomId">-</strong>
|
||||||
<div style="display:flex;gap:20px;align-items:flex-start">
|
<div class="layout-row">
|
||||||
<div>
|
<div>
|
||||||
<div id="board" style="width:1000px;height:1000px;display:grid;grid-template-columns:repeat(8,1fr);border:1px solid #333"></div>
|
<div id="board"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -73,10 +73,7 @@
|
||||||
|
|
||||||
// Board rendering using provided SVG assets. Accepts FEN.
|
// Board rendering using provided SVG assets. Accepts FEN.
|
||||||
const pieceSetPath = '/assets/chess-pieces/chess_1Kbyte_gambit';
|
const pieceSetPath = '/assets/chess-pieces/chess_1Kbyte_gambit';
|
||||||
// set board background image (if available)
|
// board visual defaults are handled by CSS (background, size, border, position)
|
||||||
boardEl.style.backgroundImage = "url('/assets/chess-pieces/boards/8x8_wood.svg')";
|
|
||||||
boardEl.style.backgroundSize = 'cover';
|
|
||||||
boardEl.style.position = 'relative';
|
|
||||||
|
|
||||||
function renderFen(fen){
|
function renderFen(fen){
|
||||||
if(!fen) return;
|
if(!fen) return;
|
||||||
|
|
@ -92,24 +89,20 @@
|
||||||
const empties = parseInt(ch,10);
|
const empties = parseInt(ch,10);
|
||||||
for(let e=0;e<empties;e++){
|
for(let e=0;e<empties;e++){
|
||||||
const sq = document.createElement('div');
|
const sq = document.createElement('div');
|
||||||
sq.style.width = '100%'; sq.style.height = '100%';
|
sq.className = 'square';
|
||||||
sq.style.display = 'flex'; sq.style.alignItems='center'; sq.style.justifyContent='center';
|
|
||||||
boardEl.appendChild(sq);
|
boardEl.appendChild(sq);
|
||||||
file++;
|
file++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const sq = document.createElement('div');
|
const sq = document.createElement('div');
|
||||||
sq.style.width = '100%'; sq.style.height = '100%';
|
sq.className = 'square';
|
||||||
sq.style.display = 'flex'; sq.style.alignItems='center'; sq.style.justifyContent='center';
|
|
||||||
// determine filename from piece char
|
// determine filename from piece char
|
||||||
const isWhite = (ch === ch.toUpperCase());
|
const isWhite = (ch === ch.toUpperCase());
|
||||||
const letter = ch.toUpperCase();
|
const letter = ch.toUpperCase();
|
||||||
const filename = (isWhite ? 'w' + letter : 'b' + letter) + '.svg';
|
const filename = (isWhite ? 'w' + letter : 'b' + letter) + '.svg';
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
img.src = `${pieceSetPath}/${filename}`;
|
img.src = `${pieceSetPath}/${filename}`;
|
||||||
img.style.maxWidth = '78%';
|
img.className = 'piece';
|
||||||
img.style.maxHeight = '78%';
|
|
||||||
img.style.userSelect = 'none';
|
|
||||||
sq.appendChild(img);
|
sq.appendChild(img);
|
||||||
boardEl.appendChild(sq);
|
boardEl.appendChild(sq);
|
||||||
file++;
|
file++;
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,32 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>ChessNut</title>
|
<title>ChessNut</title>
|
||||||
<style>body{font-family:Arial;margin:20px} input,button{padding:6px;margin:4px} #log{white-space:pre-wrap; border:1px solid #ddd;padding:8px;height:300px;overflow:auto}</style>
|
<link rel="stylesheet" href="/styles/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>ChessNut</h2>
|
<div class="page">
|
||||||
|
<header class="hero card">
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div class="title">ChessNut</div>
|
||||||
<button id="create">Créer une room</button>
|
<div class="subtitle">Créez ou rejoignez une partie — rapide, simple et fun 🎯</div>
|
||||||
</div>
|
</div>
|
||||||
<button id="join">Rejoindre</button>
|
<div style="text-align:right">
|
||||||
Room ID: <input id="roomId" placeholder="ex: ab12cd34" />
|
<div class="muted">Invite your friends — play together</div>
|
||||||
|
<img class="decor" src="/assets/chess-pieces/boards/8x8_pink_1Kbyte_gambit.svg" alt="decor" />
|
||||||
|
</div>
|
||||||
|
<svg class="floating-piece" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M10 90 L30 10 L50 90 Z" /></svg>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="card lobby">
|
||||||
|
<div>
|
||||||
|
<button id="create" class="btn-cta">Créer une room</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="controls">
|
||||||
|
<input id="roomId" class="input" placeholder="ex: ab12cd34" />
|
||||||
|
<button id="join" class="btn-ghost">Rejoindre</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script>
|
<script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script>
|
||||||
|
|
|
||||||
74
public/styles/style.css
Normal file
74
public/styles/style.css
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
/* Compiled CSS (from style.scss) - included directly so no build step is required */
|
||||||
|
*{box-sizing:border-box}
|
||||||
|
html,body{height:100%}
|
||||||
|
body{
|
||||||
|
font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
|
||||||
|
margin:0;padding:24px;background: linear-gradient(180deg, #0b1220 0%, #0f172a 60%);color:#e6eef8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page{max-width:1100px;margin:0 auto}
|
||||||
|
|
||||||
|
header h2{margin:0 0 12px 0;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,0.4)}
|
||||||
|
|
||||||
|
.card{background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));border:1px solid rgba(255,255,255,0.04);padding:16px;border-radius:10px;box-shadow:0 6px 20px rgba(2,6,23,0.6);}
|
||||||
|
|
||||||
|
button{background:#2b6cb0;color:white;border:none;padding:8px 12px;border-radius:8px;cursor:pointer;font-weight:600}
|
||||||
|
button[disabled]{opacity:0.5;cursor:not-allowed}
|
||||||
|
input[type="text"], input[type="search"]{padding:8px;border-radius:8px;border:1px solid rgba(255,255,255,0.08);background:transparent;color:inherit}
|
||||||
|
|
||||||
|
a{color:#f6ad55;text-decoration:none}
|
||||||
|
a:hover{text-decoration:underline}
|
||||||
|
|
||||||
|
#log{white-space:pre-wrap;border-radius:8px;background:rgba(255,255,255,0.03);padding:8px;height:280px;overflow:auto;color:#dfeeff}
|
||||||
|
|
||||||
|
#board{width:800px;height:800px;display:grid;grid-template-columns:repeat(8,1fr);border-radius:6px;overflow:hidden;background-size:cover}
|
||||||
|
|
||||||
|
@media (max-width:900px){
|
||||||
|
#board{width:min(92vw,680px);height:min(92vw,680px)}
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted{opacity:0.8;color:#b9c6d9}
|
||||||
|
|
||||||
|
.controls{display:flex;gap:8px;align-items:center}
|
||||||
|
|
||||||
|
#players{margin:6px 0;padding-left:18px}
|
||||||
|
|
||||||
|
#copyInviteBtn{background:transparent;border:1px solid rgba(255,255,255,0.06);color:#fff;padding:6px 10px;border-radius:8px}
|
||||||
|
|
||||||
|
#youAreHost{background:rgba(255,255,255,0.04);padding:6px 8px;border-radius:6px;margin-left:6px}
|
||||||
|
|
||||||
|
/* layout helpers used from game.html */
|
||||||
|
.layout-row{display:flex;gap:20px;align-items:flex-start}
|
||||||
|
|
||||||
|
/* board tweaks */
|
||||||
|
#board{border:1px solid #333;position:relative;background-image: url('/assets/chess-pieces/boards/8x8_wood.svg');background-size:cover}
|
||||||
|
|
||||||
|
/* square cells and piece images (used by renderFen) */
|
||||||
|
.square{width:100%;height:100%;display:flex;align-items:center;justify-content:center}
|
||||||
|
.square img, .piece{max-width:78%;max-height:78%;user-select:none}
|
||||||
|
|
||||||
|
/* Lobby / hero styles - decorative and fun */
|
||||||
|
.hero{
|
||||||
|
display:flex;align-items:center;justify-content:space-between;padding:28px;border-radius:12px;margin-bottom:18px;overflow:hidden;position:relative;border:1px solid rgba(255,255,255,0.04);
|
||||||
|
background: linear-gradient(135deg, rgba(43,108,176,0.14), rgba(246,173,85,0.06));
|
||||||
|
}
|
||||||
|
.hero .title{font-size:28px;font-weight:800;letter-spacing:-0.5px}
|
||||||
|
.hero .subtitle{color:rgba(255,255,255,0.85);margin-top:6px;font-weight:500}
|
||||||
|
.hero .decor{position:absolute;right:-80px;top:-60px;opacity:0.06;width:420px;height:420px;filter:blur(6px);transform:rotate(20deg)}
|
||||||
|
|
||||||
|
.card.lobby{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:14px}
|
||||||
|
|
||||||
|
/* buttons variants */
|
||||||
|
.btn-ghost{background:transparent;border:1px solid rgba(255,255,255,0.06);padding:8px 10px;border-radius:8px;color:inherit}
|
||||||
|
.btn-cta{background:linear-gradient(90deg,#3b82f6,#60a5fa);box-shadow:0 8px 20px rgba(59,130,246,0.18)}
|
||||||
|
|
||||||
|
/* floating small piece icons */
|
||||||
|
.floating-piece{position:absolute;opacity:0.06;width:160px;height:160px;pointer-events:none;transform:translate(-10%,-10%);}
|
||||||
|
|
||||||
|
/* subtle button hover */
|
||||||
|
button:hover{transform:translateY(-3px);transition:all 180ms ease}
|
||||||
|
|
||||||
|
/* players area */
|
||||||
|
.players-list{list-style:none;padding-left:0;margin:0;display:flex;gap:10px}
|
||||||
|
.players-list li{background:rgba(255,255,255,0.02);padding:6px 10px;border-radius:8px}
|
||||||
|
|
||||||
86
public/styles/style.scss
Normal file
86
public/styles/style.scss
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
// Style source (SCSS) - variables & small helpers
|
||||||
|
$primary: #2b6cb0;
|
||||||
|
$accent: #f6ad55;
|
||||||
|
$bg1: #0f172a;
|
||||||
|
$bg2: #111827;
|
||||||
|
$card: rgba(255,255,255,0.04);
|
||||||
|
$glass: rgba(255,255,255,0.03);
|
||||||
|
|
||||||
|
*{box-sizing:border-box}
|
||||||
|
html,body{height:100%}
|
||||||
|
body{
|
||||||
|
font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
|
||||||
|
margin:0;padding:24px;background: linear-gradient(180deg, #0b1220 0%, #0f172a 60%);color:#e6eef8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page{max-width:1100px;margin:0 auto}
|
||||||
|
|
||||||
|
header h2{margin:0 0 12px 0;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,0.4)}
|
||||||
|
|
||||||
|
.card{background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));border:1px solid rgba(255,255,255,0.04);padding:16px;border-radius:10px;box-shadow:0 6px 20px rgba(2,6,23,0.6);}
|
||||||
|
|
||||||
|
button{background:$primary;color:white;border:none;padding:8px 12px;border-radius:8px;cursor:pointer;font-weight:600}
|
||||||
|
button[disabled]{opacity:0.5;cursor:not-allowed}
|
||||||
|
input[type="text"], input[type="search"]{padding:8px;border-radius:8px;border:1px solid rgba(255,255,255,0.08);background:transparent;color:inherit}
|
||||||
|
|
||||||
|
a{color:$accent;text-decoration:none}
|
||||||
|
a:hover{text-decoration:underline}
|
||||||
|
|
||||||
|
#log{white-space:pre-wrap;border-radius:8px;background:$glass;padding:8px;height:280px;overflow:auto;color:#dfeeff}
|
||||||
|
|
||||||
|
#board{width:800px;height:800px;display:grid;grid-template-columns:repeat(8,1fr);border-radius:6px;overflow:hidden;background-size:cover}
|
||||||
|
|
||||||
|
/* make board responsive on smaller screens */
|
||||||
|
@media (max-width:900px){
|
||||||
|
#board{width:min(92vw,680px);height:min(92vw,680px)}
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted{opacity:0.8;color:#b9c6d9}
|
||||||
|
|
||||||
|
/* small helpers */
|
||||||
|
.controls{display:flex;gap:8px;align-items:center}
|
||||||
|
|
||||||
|
/* Chat / players list */
|
||||||
|
#players{margin:6px 0;padding-left:18px}
|
||||||
|
|
||||||
|
/* visually prominent copy button */
|
||||||
|
#copyInviteBtn{background:transparent;border:1px solid rgba(255,255,255,0.06);color:#fff;padding:6px 10px;border-radius:8px}
|
||||||
|
|
||||||
|
/* host badge */
|
||||||
|
#youAreHost{background:rgba(255,255,255,0.04);padding:6px 8px;border-radius:6px;margin-left:6px}
|
||||||
|
|
||||||
|
/* layout helpers used from game.html */
|
||||||
|
.layout-row{display:flex;gap:20px;align-items:flex-start}
|
||||||
|
|
||||||
|
/* board tweaks */
|
||||||
|
#board{border:1px solid #333;position:relative;background-image: url('/assets/chess-pieces/boards/8x8_wood.svg');background-size:cover}
|
||||||
|
|
||||||
|
/* square cells and piece images (used by renderFen) */
|
||||||
|
.square{width:100%;height:100%;display:flex;align-items:center;justify-content:center}
|
||||||
|
.square img, .piece{max-width:78%;max-height:78%;user-select:none}
|
||||||
|
|
||||||
|
/* Lobby / hero styles - decorative and fun */
|
||||||
|
.hero{
|
||||||
|
display:flex;align-items:center;justify-content:space-between;padding:28px;border-radius:12px;margin-bottom:18px;overflow:hidden;position:relative;border:1px solid rgba(255,255,255,0.04);
|
||||||
|
background: linear-gradient(135deg, rgba(43,108,176,0.14), rgba(246,173,85,0.06));
|
||||||
|
}
|
||||||
|
.hero .title{font-size:28px;font-weight:800;letter-spacing:-0.5px}
|
||||||
|
.hero .subtitle{color:rgba(255,255,255,0.85);margin-top:6px;font-weight:500}
|
||||||
|
.hero .decor{position:absolute;right:-80px;top:-60px;opacity:0.06;width:420px;height:420px;filter:blur(6px);transform:rotate(20deg)}
|
||||||
|
|
||||||
|
.card.lobby{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:14px}
|
||||||
|
|
||||||
|
/* buttons variants */
|
||||||
|
.btn-ghost{background:transparent;border:1px solid rgba(255,255,255,0.06);padding:8px 10px;border-radius:8px;color:inherit}
|
||||||
|
.btn-cta{background:linear-gradient(90deg,#3b82f6,#60a5fa);box-shadow:0 8px 20px rgba(59,130,246,0.18)}
|
||||||
|
|
||||||
|
/* floating small piece icons */
|
||||||
|
.floating-piece{position:absolute;opacity:0.06;width:160px;height:160px;pointer-events:none;transform:translate(-10%,-10%);}
|
||||||
|
|
||||||
|
/* subtle button hover */
|
||||||
|
button:hover{transform:translateY(-3px);transition:all 180ms ease}
|
||||||
|
|
||||||
|
/* players area */
|
||||||
|
.players-list{list-style:none;padding-left:0;margin:0;display:flex;gap:10px}
|
||||||
|
.players-list li{background:rgba(255,255,255,0.02);padding:6px 10px;border-radius:8px}
|
||||||
|
|
||||||
|
|
@ -3,23 +3,32 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>ChessNut - Salle d'attente</title>
|
<title>ChessNut - Salle d'attente</title>
|
||||||
<style>body{font-family:Arial;margin:20px} input,button{padding:6px;margin:4px} #log{white-space:pre-wrap; border:1px solid #ddd;padding:8px;height:300px;overflow:auto} #players{margin:6px 0;padding-left:18px}</style>
|
<link rel="stylesheet" href="/styles/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>ChessNut — Salle d'attente</h2>
|
<div class="page">
|
||||||
|
<header class="hero card">
|
||||||
<div>
|
<div>
|
||||||
|
<div class="title">ChessNut — Salle d'attente</div>
|
||||||
|
<div class="subtitle">Préparez-vous, invitez un ami et lancez la partie quand tout le monde est prêt.</div>
|
||||||
|
</div>
|
||||||
|
<img class="decor" src="/assets/chess-pieces/boards/8x8_green.svg" alt="decor" />
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section class="card">
|
||||||
<div>Room: <strong id="roomId">-</strong></div>
|
<div>Room: <strong id="roomId">-</strong></div>
|
||||||
<div>Status: <strong id="status">-</strong></div>
|
<div>Status: <strong id="status">-</strong></div>
|
||||||
<div>Joueurs: <strong id="playerCount">0/2</strong></div>
|
<div>Joueurs: <strong id="playerCount">0/2</strong></div>
|
||||||
<div><span id="youAreHost" style="display:none;font-weight:bold">Vous êtes l'hôte</span></div>
|
<div><span id="youAreHost" style="display:none;font-weight:bold">Vous êtes l'hôte</span></div>
|
||||||
</div>
|
|
||||||
<div style="margin-top:8px">
|
|
||||||
<button id="startBtn" style="display:none">Commencer la partie</button>
|
|
||||||
<button id="copyInviteBtn" style="margin-left:8px">Copier le lien d'invitation</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Waiting room: only players list and start button. Events/board/controls removed per request -->
|
<div style="margin-top:8px">
|
||||||
|
<button id="startBtn" style="display:none" class="btn-cta">Commencer la partie</button>
|
||||||
|
<button id="copyInviteBtn" style="margin-left:8px" class="btn-ghost">Copier le lien d'invitation</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<div style="margin-top:10px"><a href="/">Retour à la page principale</a></div>
|
<div style="margin-top:10px"><a href="/">Retour à la page principale</a></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script>
|
<script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue