rewrite: TS monorepo — pi SDK stateless agents, Postgres+pg-boss, SvelteKit themed UI; legacy moved to legacy/
@@ -0,0 +1,23 @@
|
||||
node_modules
|
||||
|
||||
# Output
|
||||
.output
|
||||
.vercel
|
||||
.netlify
|
||||
.wrangler
|
||||
/.svelte-kit
|
||||
/build
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Env
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
!.env.test
|
||||
|
||||
# Vite
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
@@ -0,0 +1 @@
|
||||
engine-strict=true
|
||||
@@ -0,0 +1,83 @@
|
||||
# AI·CHESS — концепт «ЭФИР» (Live Sports Broadcast)
|
||||
|
||||
Фронтенд-концепт для арены, где LLM-агенты играют в шахматы, троллят друг друга и получают рейтинг.
|
||||
Направление: **ночная спортивная трансляция / esports-графика**. Живой матч должен ощущаться как
|
||||
титульный бой по ТВ: скорбаг над доской, нижние трети для треш-тока, бегущая строка внизу, стингер
|
||||
«ПОВТОР» при отмотке, жёлтая лента с результатом в финале. Тёмная «сцена» с цветным светом из углов:
|
||||
белые — ледяной (`ice`), чёрные — огненный (`fire`); золото — акцент бренда и «лучших ходов», красный — LIVE.
|
||||
|
||||
## Стек
|
||||
|
||||
SvelteKit 3 · Svelte 5 (runes) · TypeScript · `@sveltejs/adapter-static` (SPA, `fallback: index.html`) ·
|
||||
`@lichess-org/chessground` (кастомный тёмный скин + cburnett) · `chess.js` (реплей PGN в позиции, контекст
|
||||
агента генерируется из реальных FEN/ASCII) · `simple-icons` (`siClaude`, `siAnthropic`) · ванильный CSS с токенами.
|
||||
Моки — `src/lib/mock.ts`.
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run build
|
||||
npm run preview -- --port 5181
|
||||
```
|
||||
|
||||
Маршруты: `/` · `/match/demo` · `/match/demo?over=1` · `/leaderboard` · `/new` · `/login` · `/admin` · `/games`.
|
||||
|
||||
## Палитра
|
||||
|
||||
| токен | hex | роль |
|
||||
| --- | --- | --- |
|
||||
| `--bg` / `--stage` | `#06070b` / `#0b0d14` | сцена |
|
||||
| `--panel` / `--line` | `#10131b` / `#232838` | панели, линии |
|
||||
| `--live` | `#ff2a3c` | LIVE, таймер думающего, бегущая строка |
|
||||
| `--gold` | `#ffc93c` | бренд, выбранный ход, `!!`, финальная лента |
|
||||
| `--ice` | `#7cc7ff` | угол белых |
|
||||
| `--fire` | `#ff5d3a` | угол чёрных |
|
||||
| `--good` / `--bad` / `--warn` | `#42d989` / `#ff4757` / `#ffb347` | классификация ходов |
|
||||
|
||||
## Шрифты
|
||||
|
||||
- **Oswald** 400–700 — дисплейный, конденсированный, капс: скорбаг, цифры, заголовки, кикеры (есть кириллица).
|
||||
- **IBM Plex Sans** — текст, треш-ток, интервью.
|
||||
- **IBM Plex Mono** — SAN, FEN, тул-коллы, контекст.
|
||||
|
||||
Загружаются с Google Fonts (`src/app.html`).
|
||||
|
||||
## Ключевые решения
|
||||
|
||||
- **Скорбаг** (`Scorebug.svelte`) — одна полоса над доской, как в боксе: логотип/аватар, модель, чип MAX/HIGH,
|
||||
рейтинг, персона, живая точность, расход $, таймер «ДУМАЕТ» (мигающий красный бокс) у того, чей ход.
|
||||
В центре — скошенный блок с номером хода и оценкой; в финале там «0–1 · ФИНАЛ».
|
||||
- **Доска как сцена** — тёмная стальная доска, золотая подсветка последнего хода, красный шах; при отмотке
|
||||
назад над доской появляется красный стингер «ПОВТОР · ход 21… → в эфир». Бейдж `?!/??/!!` в углу доски.
|
||||
Стрелка Stockfish — кнопка «SF» в правой колонке инструментов, ← → листают ходы.
|
||||
- **Нижняя треть** (`LowerThird.svelte`) — последняя реплика треш-тока в формате ТВ-плашки: имя+персона на
|
||||
тёмной скошенной плашке, цитата на белой. Заменяется с анимацией-вайпом при смене хода.
|
||||
- **Мысли агента** (`MoveList` + `Thoughts.svelte`) — скрыты по умолчанию. Клик по ходу = позиция на доске +
|
||||
раскрытие панели «МЫСЛИ» прямо под строкой (аккордеон, строка прижимается к верху списка). Три вкладки:
|
||||
*Рассуждение* (summary, лучше было по SF, фраза, золотая «Заметка себе» и серая «Заметка из прошлого
|
||||
хода»), *Тулы* (нумерованные вызовы `python`/`get_move_history`/`make_move`/`finish_turn` с выводом),
|
||||
*Контекст* (ровно то, что получила модель: ASCII-доска, FEN, список фигур, последний ход и фраза
|
||||
соперника, релевантные правила — всё генерируется из chess.js).
|
||||
- **Состояние правил** — три чипа справа под скорбагом (рокировка / 50 ходов / повторения), гаснут, пока не
|
||||
актуальны, и становятся мигающими жёлтыми при пороге (на главной видно у второй живой партии).
|
||||
- **График оценки** — рукописный SVG с sqrt-сжатием (малые перевесы читаются), белая/тёмная заливка от
|
||||
середины, точки на ключевых ходах (`?!`, `?`, `??`, `!!`), красная линия текущего хода, клик — переход.
|
||||
- **Финал** (`?over=1`) — жёлтая лента-стингер на доске, слева: результат, мем-превью, два интервью в стиле
|
||||
пресс-конференции (микрофон, «победитель / проигравший»), итог прогноза с очками.
|
||||
- **Мем-превью** (`Thumb.svelte`) — CSS/SVG-композиция: диагональ двух цветов, лучи, мини-доска из FEN
|
||||
(переиспользует спрайты cburnett), логотипы (проигравший — ч/б с крестом), огромный жёлтый капшн
|
||||
с чёрной обводкой, размер зависит от длины текста, бейдж результата и сашет «БЕЗ РЕЙТИНГА».
|
||||
- **Бегущая строка** — внизу на всех страницах (на мобильном — статично), lives/скоро/итоги/таблица.
|
||||
- **Мобильный матч** (390) — скорбаг сжимается до коротких имён, горизонтальный eval-бар над доской, табы
|
||||
«Ходы / Треш-ток / Аналитика», те же раскрывающиеся мысли.
|
||||
- **Таблица** — три вида: турнирная таблица (топ-3 с цветными рёбрами, W/D/L-бар, $/партия, «Elo за $»),
|
||||
scatter «Сколько стоит рейтинг» (MAX↔HIGH одной модели соединены линией, люди — в бесплатной зоне),
|
||||
матрица очных встреч (цвет = доля очков).
|
||||
|
||||
## Известные ограничения
|
||||
|
||||
- `simple-icons@16` больше не содержит `siOpenai` (удалён по требованию правообладателя) — для OpenAI
|
||||
используется рукописный «узел» из шести колец как плейсхолдер (`src/lib/icons.ts`).
|
||||
- Продолжение партии после 22.gxh3 (для финального состояния) — выдуманное, но легальное (проверено chess.js):
|
||||
22…Rg6 23.Kh1?? Qxh3+ 24.Nh2 Rxg3!! 25.fxg3 Qxg3 26.Rg4?? Qxe1+ 27.Kg2 Qe2+ 28.Kh3 Qxc2 0–1.
|
||||
- Оценки, классификации, время и стоимость — правдоподобные моки; «живой» таймер просто тикает.
|
||||
- Другие матчи (`/match/g-7781` и т.п.) ведут на тот же демо-матч.
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "broadcast",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"prepare": "svelte-kit sync || echo ''",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-static": "^4.0.0",
|
||||
"@sveltejs/kit": "^3.0.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
||||
"svelte": "^5.57.1",
|
||||
"svelte-check": "^4.6.0",
|
||||
"typescript": "^6.0.3",
|
||||
"vite": "^8.3.0"
|
||||
},
|
||||
"imports": {
|
||||
"#lib": "./src/lib/index.js",
|
||||
"#lib/*": "./src/lib/*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lichess-org/chessground": "^10.4.2",
|
||||
"chess.js": "^1.4.0",
|
||||
"simple-icons": "^16.35.0"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 378 KiB |
|
After Width: | Height: | Size: 444 KiB |
|
After Width: | Height: | Size: 426 KiB |
|
After Width: | Height: | Size: 425 KiB |
|
After Width: | Height: | Size: 427 KiB |
|
After Width: | Height: | Size: 439 KiB |
|
After Width: | Height: | Size: 824 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 222 KiB |
|
After Width: | Height: | Size: 219 KiB |
|
After Width: | Height: | Size: 296 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 201 KiB |
|
After Width: | Height: | Size: 247 KiB |
|
After Width: | Height: | Size: 561 KiB |
|
After Width: | Height: | Size: 174 KiB |
|
After Width: | Height: | Size: 223 KiB |
|
After Width: | Height: | Size: 186 KiB |
@@ -0,0 +1,366 @@
|
||||
@import '@lichess-org/chessground/assets/chessground.base.css';
|
||||
@import '@lichess-org/chessground/assets/chessground.cburnett.css';
|
||||
|
||||
:root {
|
||||
/* stage */
|
||||
--bg: #06070b;
|
||||
--stage: #0b0d14;
|
||||
--panel: #10131b;
|
||||
--panel-2: #161a24;
|
||||
--panel-3: #1d2230;
|
||||
--line: #232838;
|
||||
--line-2: #2e3447;
|
||||
|
||||
/* text */
|
||||
--text: #eef1f6;
|
||||
--text-2: #c3c9d6;
|
||||
--muted: #8a92a6;
|
||||
--dim: #5b6276;
|
||||
|
||||
/* broadcast */
|
||||
--live: #ff2a3c;
|
||||
--live-deep: #b3101f;
|
||||
--gold: #ffc93c;
|
||||
--gold-deep: #c9930f;
|
||||
--ice: #7cc7ff;
|
||||
--ice-deep: #2f7fc2;
|
||||
--fire: #ff5d3a;
|
||||
--fire-deep: #c23a1c;
|
||||
--good: #42d989;
|
||||
--bad: #ff4757;
|
||||
--warn: #ffb347;
|
||||
|
||||
/* corners (mapped per game) */
|
||||
--white-corner: var(--ice);
|
||||
--black-corner: var(--fire);
|
||||
|
||||
--display: 'Oswald', 'Arial Narrow', sans-serif;
|
||||
--body: 'IBM Plex Sans', system-ui, sans-serif;
|
||||
--mono: 'IBM Plex Mono', ui-monospace, monospace;
|
||||
|
||||
--skew: -12deg;
|
||||
--r: 3px;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: var(--body);
|
||||
font-size: 14px;
|
||||
line-height: 1.45;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
body {
|
||||
min-height: 100vh;
|
||||
background:
|
||||
radial-gradient(900px 420px at 18% -10%, color-mix(in srgb, var(--ice) 14%, transparent), transparent 70%),
|
||||
radial-gradient(900px 420px at 82% -10%, color-mix(in srgb, var(--fire) 14%, transparent), transparent 70%),
|
||||
radial-gradient(1200px 600px at 50% 120%, #0f1220, transparent 70%),
|
||||
var(--bg);
|
||||
background-attachment: fixed;
|
||||
}
|
||||
body::before {
|
||||
/* fine broadcast grain */
|
||||
content: '';
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
opacity: 0.35;
|
||||
background-image: repeating-linear-gradient(
|
||||
0deg,
|
||||
rgba(255, 255, 255, 0.025) 0px,
|
||||
rgba(255, 255, 255, 0.025) 1px,
|
||||
transparent 1px,
|
||||
transparent 3px
|
||||
);
|
||||
mix-blend-mode: overlay;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
button {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
background: none;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
::selection {
|
||||
background: var(--gold);
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/* --- Type utilities --- */
|
||||
.display {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.02em;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
}
|
||||
.mono {
|
||||
font-family: var(--mono);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.tnum {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.kicker {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.16em;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* --- Broadcast primitives --- */
|
||||
.tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
padding: 3px 8px 2px;
|
||||
line-height: 1.1;
|
||||
background: var(--panel-3);
|
||||
color: var(--text-2);
|
||||
clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
|
||||
}
|
||||
.tag.live {
|
||||
background: var(--live);
|
||||
color: #fff;
|
||||
}
|
||||
.tag.gold {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
}
|
||||
.tag.ice {
|
||||
background: var(--ice);
|
||||
color: #001423;
|
||||
}
|
||||
.tag.fire {
|
||||
background: var(--fire);
|
||||
color: #1e0600;
|
||||
}
|
||||
.tag.ghost {
|
||||
background: transparent;
|
||||
box-shadow: inset 0 0 0 1px var(--line-2);
|
||||
}
|
||||
.tag.warn {
|
||||
background: var(--warn);
|
||||
color: #1e1200;
|
||||
}
|
||||
.tag.bad {
|
||||
background: var(--bad);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.live-dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6);
|
||||
animation: pulse 1.4s ease-out infinite;
|
||||
}
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 7px rgba(255, 255, 255, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: linear-gradient(180deg, var(--panel-2), var(--panel));
|
||||
border: 1px solid var(--line);
|
||||
position: relative;
|
||||
}
|
||||
.panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding: 8px 12px 7px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.14em;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--text-2);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
.panel-head::before {
|
||||
content: '';
|
||||
width: 3px;
|
||||
height: 12px;
|
||||
background: var(--gold);
|
||||
margin-right: 2px;
|
||||
transform: skewX(var(--skew));
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
padding: 10px 18px 9px;
|
||||
background: var(--panel-3);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--line-2);
|
||||
transition:
|
||||
transform 0.12s ease,
|
||||
background 0.12s ease,
|
||||
border-color 0.12s ease;
|
||||
clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
|
||||
}
|
||||
.btn:hover {
|
||||
background: var(--line-2);
|
||||
}
|
||||
.btn:active {
|
||||
transform: translateY(1px);
|
||||
}
|
||||
.btn.primary {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
border-color: var(--gold);
|
||||
}
|
||||
.btn.primary:hover {
|
||||
background: #ffd766;
|
||||
}
|
||||
.btn.live {
|
||||
background: var(--live);
|
||||
color: #fff;
|
||||
border-color: var(--live);
|
||||
}
|
||||
.btn.sm {
|
||||
font-size: 11px;
|
||||
padding: 6px 12px 5px;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.wrap {
|
||||
padding: 0 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Chessground skin: dark stage board --- */
|
||||
.cg-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
cg-board {
|
||||
background-color: #aeb6c9;
|
||||
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA4IDgiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyI+PGcgZmlsbD0iIzM0M2I0ZiI+PHJlY3QgeD0iMSIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjMiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI1IiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNyIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjAiIHk9IjEiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIyIiB5PSIxIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNCIgeT0iMSIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjYiIHk9IjEiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIxIiB5PSIyIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iMyIgeT0iMiIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjUiIHk9IjIiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI3IiB5PSIyIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iMCIgeT0iMyIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjIiIHk9IjMiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI0IiB5PSIzIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNiIgeT0iMyIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjEiIHk9IjQiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIzIiB5PSI0IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNSIgeT0iNCIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjciIHk9IjQiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIwIiB5PSI1IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iMiIgeT0iNSIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjQiIHk9IjUiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI2IiB5PSI1IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iMSIgeT0iNiIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjMiIHk9IjYiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSI1IiB5PSI2IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNyIgeT0iNiIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjAiIHk9IjciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48cmVjdCB4PSIyIiB5PSI3IiB3aWR0aD0iMSIgaGVpZ2h0PSIxIi8+PHJlY3QgeD0iNCIgeT0iNyIgd2lkdGg9IjEiIGhlaWdodD0iMSIvPjxyZWN0IHg9IjYiIHk9IjciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiLz48L2c+PC9zdmc+');
|
||||
background-size: cover;
|
||||
}
|
||||
cg-board square.last-move {
|
||||
background-color: rgba(255, 201, 60, 0.42);
|
||||
}
|
||||
cg-board square.check {
|
||||
background: radial-gradient(
|
||||
ellipse at center,
|
||||
rgba(255, 42, 60, 1) 0%,
|
||||
rgba(255, 42, 60, 0.9) 25%,
|
||||
rgba(255, 42, 60, 0) 89%
|
||||
);
|
||||
}
|
||||
cg-board square.selected {
|
||||
background-color: rgba(124, 199, 255, 0.5);
|
||||
}
|
||||
.cg-wrap coords {
|
||||
font-family: var(--display);
|
||||
font-weight: 500;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.cg-wrap coords.ranks coord,
|
||||
.cg-wrap coords.files coord {
|
||||
color: rgba(238, 241, 246, 0.6) !important;
|
||||
}
|
||||
|
||||
/* keyframes shared */
|
||||
@keyframes stinger-in {
|
||||
0% {
|
||||
clip-path: inset(0 100% 0 0);
|
||||
opacity: 0.4;
|
||||
}
|
||||
100% {
|
||||
clip-path: inset(0 0 0 0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@keyframes rise {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@keyframes flash {
|
||||
0% {
|
||||
background-position: -200% 0;
|
||||
}
|
||||
100% {
|
||||
background-position: 200% 0;
|
||||
}
|
||||
}
|
||||
@keyframes marquee {
|
||||
from {
|
||||
transform: translateX(0);
|
||||
}
|
||||
to {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
@keyframes blink {
|
||||
50% {
|
||||
opacity: 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
animation-duration: 0.001ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 0.001ms !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#06070b" />
|
||||
<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=Oswald:wght@400;500;600;700&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="107" height="128" viewBox="0 0 107 128"><title>svelte-logo</title><path d="M94.157 22.819c-10.4-14.885-30.94-19.297-45.792-9.835L22.282 29.608A29.92 29.92 0 0 0 8.764 49.65a31.5 31.5 0 0 0 3.108 20.231 30 30 0 0 0-4.477 11.183 31.9 31.9 0 0 0 5.448 24.116c10.402 14.887 30.942 19.297 45.791 9.835l26.083-16.624A29.92 29.92 0 0 0 98.235 78.35a31.53 31.53 0 0 0-3.105-20.232 30 30 0 0 0 4.474-11.182 31.88 31.88 0 0 0-5.447-24.116" style="fill:#ff3e00"/><path d="M45.817 106.582a20.72 20.72 0 0 1-22.237-8.243 19.17 19.17 0 0 1-3.277-14.503 18 18 0 0 1 .624-2.435l.49-1.498 1.337.981a33.6 33.6 0 0 0 10.203 5.098l.97.294-.09.968a5.85 5.85 0 0 0 1.052 3.878 6.24 6.24 0 0 0 6.695 2.485 5.8 5.8 0 0 0 1.603-.704L69.27 76.28a5.43 5.43 0 0 0 2.45-3.631 5.8 5.8 0 0 0-.987-4.371 6.24 6.24 0 0 0-6.698-2.487 5.7 5.7 0 0 0-1.6.704l-9.953 6.345a19 19 0 0 1-5.296 2.326 20.72 20.72 0 0 1-22.237-8.243 19.17 19.17 0 0 1-3.277-14.502 17.99 17.99 0 0 1 8.13-12.052l26.081-16.623a19 19 0 0 1 5.3-2.329 20.72 20.72 0 0 1 22.237 8.243 19.17 19.17 0 0 1 3.277 14.503 18 18 0 0 1-.624 2.435l-.49 1.498-1.337-.98a33.6 33.6 0 0 0-10.203-5.1l-.97-.294.09-.968a5.86 5.86 0 0 0-1.052-3.878 6.24 6.24 0 0 0-6.696-2.485 5.8 5.8 0 0 0-1.602.704L37.73 51.72a5.42 5.42 0 0 0-2.449 3.63 5.79 5.79 0 0 0 .986 4.372 6.24 6.24 0 0 0 6.698 2.486 5.8 5.8 0 0 0 1.602-.704l9.952-6.342a19 19 0 0 1 5.295-2.328 20.72 20.72 0 0 1 22.237 8.242 19.17 19.17 0 0 1 3.277 14.503 18 18 0 0 1-8.13 12.053l-26.081 16.622a19 19 0 0 1-5.3 2.328" style="fill:#fff"/></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,61 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { Chessground } from '@lichess-org/chessground';
|
||||
import type { Api } from '@lichess-org/chessground/api';
|
||||
import type { Key } from '@lichess-org/chessground/types';
|
||||
import type { DrawShape } from '@lichess-org/chessground/draw';
|
||||
|
||||
let {
|
||||
fen,
|
||||
lastMove,
|
||||
check = false,
|
||||
orientation = 'white',
|
||||
arrow,
|
||||
coordinates = true
|
||||
}: {
|
||||
fen: string;
|
||||
lastMove?: [string, string];
|
||||
check?: boolean;
|
||||
orientation?: 'white' | 'black';
|
||||
arrow?: [string, string] | null;
|
||||
coordinates?: boolean;
|
||||
} = $props();
|
||||
|
||||
let el: HTMLDivElement;
|
||||
let api: Api | undefined;
|
||||
|
||||
onMount(() => {
|
||||
api = Chessground(el, {
|
||||
fen,
|
||||
orientation,
|
||||
viewOnly: true,
|
||||
coordinates,
|
||||
animation: { enabled: true, duration: 220 },
|
||||
highlight: { lastMove: true, check: true },
|
||||
drawable: { enabled: false, visible: true, brushes: { gold: { key: 'gold', color: '#ffc93c', opacity: 0.9, lineWidth: 11 } } as any }
|
||||
});
|
||||
return () => api?.destroy();
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (!api) return;
|
||||
const shapes: DrawShape[] = arrow ? [{ orig: arrow[0] as Key, dest: arrow[1] as Key, brush: 'gold' }] : [];
|
||||
api.set({
|
||||
fen,
|
||||
orientation,
|
||||
lastMove: lastMove as Key[] | undefined,
|
||||
check,
|
||||
drawable: { shapes }
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="board" bind:this={el}></div>
|
||||
|
||||
<style>
|
||||
.board {
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,99 @@
|
||||
<script lang="ts">
|
||||
import type { Game } from '#lib/mock.js';
|
||||
import { fmt } from '#lib/mock.js';
|
||||
|
||||
let { game, ply }: { game: Game; ply: number } = $props();
|
||||
const shown = $derived(game.moves.slice(0, ply));
|
||||
const sum = (c: 'w' | 'b', k: 'tokens' | 'costUsd' | 'timeSec') => shown.filter((m) => m.color === c).reduce((a, m) => a + m[k], 0);
|
||||
const w = $derived({ tok: sum('w', 'tokens'), usd: sum('w', 'costUsd'), t: sum('w', 'timeSec') });
|
||||
const b = $derived({ tok: sum('b', 'tokens'), usd: sum('b', 'costUsd'), t: sum('b', 'timeSec') });
|
||||
const total = $derived(w.usd + b.usd);
|
||||
const maxTok = $derived(Math.max(...shown.map((m) => m.tokens), 1));
|
||||
const recent = $derived(shown.slice(-24));
|
||||
</script>
|
||||
|
||||
<div class="cost">
|
||||
<div class="panel-head">
|
||||
<span>Счётчик</span>
|
||||
<span class="tot display">{fmt.usd(total)}</span>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="rows">
|
||||
{#each [['w', w, game.white.short], ['b', b, game.black.short]] as const as [c, s, name]}
|
||||
<div class="r {c}">
|
||||
<b class="display">{name}</b>
|
||||
<span class="mono">{fmt.tok(s.tok)} tok</span>
|
||||
<span class="mono">{fmt.time(s.t)}</span>
|
||||
<span class="usd display tnum">{fmt.usd(s.usd)}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="bars" title="токены за последние ходы">
|
||||
{#each recent as m (m.ply)}
|
||||
<i class={m.color} style:height="{Math.max(8, (m.tokens / maxTok) * 100)}%" title="{m.moveNo}{m.color === 'w' ? '.' : '…'}{m.san} · {fmt.tok(m.tokens)} · {fmt.usd(m.costUsd)}"></i>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="foot kicker"><span>Токены по ходам</span><span>{fmt.usd(total / Math.max(1, shown.length))} / ход</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.cost .tot {
|
||||
font-size: 14px;
|
||||
color: var(--gold);
|
||||
}
|
||||
.body {
|
||||
padding: 8px 10px 10px;
|
||||
}
|
||||
.rows {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.r {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto auto 60px;
|
||||
gap: 10px;
|
||||
align-items: baseline;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
padding-left: 8px;
|
||||
border-left: 2px solid var(--white-corner);
|
||||
}
|
||||
.r.b {
|
||||
border-left-color: var(--black-corner);
|
||||
}
|
||||
.r b {
|
||||
font-size: 12px;
|
||||
color: var(--text-2);
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.usd {
|
||||
font-size: 14px;
|
||||
color: var(--text);
|
||||
text-align: right;
|
||||
}
|
||||
.bars {
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: 2px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.bars i {
|
||||
flex: 1;
|
||||
background: var(--white-corner);
|
||||
opacity: 0.85;
|
||||
min-width: 3px;
|
||||
}
|
||||
.bars i.b {
|
||||
background: var(--black-corner);
|
||||
}
|
||||
.foot {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 6px;
|
||||
font-size: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
let { at, size = 'lg' }: { at: string; size?: 'lg' | 'sm' } = $props();
|
||||
let now = $state(Date.now());
|
||||
onMount(() => {
|
||||
const t = setInterval(() => (now = Date.now()), 1000);
|
||||
return () => clearInterval(t);
|
||||
});
|
||||
const diff = $derived(Math.max(0, Math.floor((new Date(at).getTime() - now) / 1000)));
|
||||
const h = $derived(Math.floor(diff / 3600));
|
||||
const m = $derived(Math.floor((diff % 3600) / 60));
|
||||
const s = $derived(diff % 60);
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
</script>
|
||||
|
||||
<div class="cd {size} display tnum" aria-label="обратный отсчёт">
|
||||
<span class="u"><b>{pad(h)}</b><i>ч</i></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="u"><b>{pad(m)}</b><i>м</i></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="u"><b>{pad(s)}</b><i>с</i></span>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.cd {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.u {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 3px;
|
||||
}
|
||||
.u b {
|
||||
font-size: 56px;
|
||||
line-height: 0.9;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.01em;
|
||||
background: linear-gradient(180deg, #fff, #c6ccd9);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
.u i {
|
||||
font-style: normal;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.1em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.colon {
|
||||
font-size: 40px;
|
||||
color: var(--gold);
|
||||
animation: blink 1s steps(1) infinite;
|
||||
line-height: 0.9;
|
||||
}
|
||||
.sm .u b {
|
||||
font-size: 24px;
|
||||
}
|
||||
.sm .colon {
|
||||
font-size: 20px;
|
||||
}
|
||||
.sm .u i {
|
||||
font-size: 9px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,103 @@
|
||||
<script lang="ts">
|
||||
import { fmt } from '#lib/mock.js';
|
||||
let { cp, horizontal = false }: { cp: number; horizontal?: boolean } = $props();
|
||||
// white share 0..1 via sigmoid-ish
|
||||
const share = $derived.by(() => {
|
||||
if (Math.abs(cp) >= 10000) return cp > 0 ? 0.98 : 0.02;
|
||||
const x = cp / 100;
|
||||
return Math.min(0.96, Math.max(0.04, 0.5 + 0.5 * (2 / (1 + Math.exp(-0.5 * x)) - 1)));
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="bar" class:horizontal style:--w="{share * 100}%">
|
||||
<div class="white"></div>
|
||||
<span class="num display tnum" class:top={cp < 0}>{fmt.evalStr(cp)}</span>
|
||||
<i class="mid"></i>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.bar {
|
||||
position: relative;
|
||||
background: #171a24;
|
||||
border: 1px solid var(--line-2);
|
||||
overflow: hidden;
|
||||
width: 22px;
|
||||
height: 100%;
|
||||
}
|
||||
.white {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: var(--w);
|
||||
background: linear-gradient(180deg, #ffffff, #d9deea);
|
||||
transition: height 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
}
|
||||
.mid {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
height: 1px;
|
||||
background: var(--gold);
|
||||
opacity: 0.7;
|
||||
}
|
||||
.num {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 4px;
|
||||
text-align: center;
|
||||
font-size: 9px;
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
writing-mode: vertical-rl;
|
||||
transform: rotate(180deg);
|
||||
height: 40px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
.num.top {
|
||||
bottom: auto;
|
||||
top: 4px;
|
||||
color: #fff;
|
||||
}
|
||||
.horizontal {
|
||||
width: 100%;
|
||||
height: 14px;
|
||||
}
|
||||
.horizontal .white {
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: auto;
|
||||
height: 100%;
|
||||
width: var(--w);
|
||||
transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
}
|
||||
.horizontal .mid {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
right: auto;
|
||||
width: 1px;
|
||||
height: auto;
|
||||
}
|
||||
.horizontal .num {
|
||||
writing-mode: horizontal-tb;
|
||||
transform: none;
|
||||
height: 100%;
|
||||
width: 44px;
|
||||
left: 4px;
|
||||
right: auto;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
text-align: left;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
.horizontal .num.top {
|
||||
left: auto;
|
||||
right: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,123 @@
|
||||
<script lang="ts">
|
||||
import type { MoveRec } from '#lib/mock.js';
|
||||
import { clsMeta, fmt } from '#lib/mock.js';
|
||||
|
||||
let {
|
||||
moves,
|
||||
ply,
|
||||
total,
|
||||
onselect,
|
||||
height = 110
|
||||
}: { moves: MoveRec[]; ply: number; total: number; onselect?: (p: number) => void; height?: number } = $props();
|
||||
|
||||
const W = 600;
|
||||
const H = 100;
|
||||
const PAD = 6;
|
||||
const n = $derived(Math.max(total, 40));
|
||||
const x = (p: number) => PAD + ((p - 1) / Math.max(1, n - 1)) * (W - PAD * 2);
|
||||
const clamp = (cp: number) => Math.max(-800, Math.min(800, Math.abs(cp) >= 10000 ? Math.sign(cp) * 800 : cp));
|
||||
const y = (cp: number) => {
|
||||
const v = clamp(cp) / 800; // -1..1
|
||||
// soften with sqrt for legibility of small advantages
|
||||
const s = Math.sign(v) * Math.sqrt(Math.abs(v));
|
||||
return H / 2 - s * (H / 2 - PAD);
|
||||
};
|
||||
const pts = $derived(moves.map((m) => [x(m.ply), y(m.evalCp)] as const));
|
||||
const path = $derived.by(() => {
|
||||
if (!pts.length) return '';
|
||||
let d = `M${x(0.9).toFixed(1)} ${(H / 2).toFixed(1)}`;
|
||||
for (const [px, py] of pts) d += ` L${px.toFixed(1)} ${py.toFixed(1)}`;
|
||||
return d;
|
||||
});
|
||||
const lastX = $derived(pts.length ? pts[pts.length - 1][0] : x(1));
|
||||
// area between the curve and the midline, closed along the midline
|
||||
const area = $derived(path ? `${path} L${lastX.toFixed(1)} ${H / 2} L${x(0.9).toFixed(1)} ${H / 2} Z` : '');
|
||||
|
||||
let hover = $state<number | null>(null);
|
||||
const hovered = $derived(hover ? moves[hover - 1] : null);
|
||||
|
||||
function pick(ev: MouseEvent) {
|
||||
const el = ev.currentTarget as SVGSVGElement;
|
||||
const r = el.getBoundingClientRect();
|
||||
const px = ((ev.clientX - r.left) / r.width) * W;
|
||||
let best = 1;
|
||||
let bd = Infinity;
|
||||
for (const m of moves) {
|
||||
const d = Math.abs(x(m.ply) - px);
|
||||
if (d < bd) {
|
||||
bd = d;
|
||||
best = m.ply;
|
||||
}
|
||||
}
|
||||
return best;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="graph" style:height="{height}px">
|
||||
<svg
|
||||
viewBox="0 0 {W} {H}"
|
||||
preserveAspectRatio="none"
|
||||
role="img"
|
||||
aria-label="График оценки"
|
||||
onmousemove={(e) => (hover = pick(e))}
|
||||
onmouseleave={() => (hover = null)}
|
||||
onclick={(e) => onselect?.(pick(e))}
|
||||
>
|
||||
<defs>
|
||||
<clipPath id="top"><rect x="0" y="0" width={W} height={H / 2} /></clipPath>
|
||||
<clipPath id="bot"><rect x="0" y={H / 2} width={W} height={H / 2} /></clipPath>
|
||||
</defs>
|
||||
<rect x="0" y="0" width={W} height={H} fill="#0a0c12" />
|
||||
<!-- white's territory (fill where eval > 0) -->
|
||||
<path d={area} fill="#e6e9f0" clip-path="url(#top)" opacity="0.92" />
|
||||
<!-- black's territory -->
|
||||
<path d={area} fill="#4a5168" clip-path="url(#bot)" />
|
||||
<line x1="0" x2={W} y1={H / 2} y2={H / 2} stroke="var(--gold)" stroke-opacity="0.5" stroke-width="0.8" />
|
||||
<path d={path} fill="none" stroke="var(--gold)" stroke-width="1.2" vector-effect="non-scaling-stroke" />
|
||||
<!-- key move marks -->
|
||||
{#each moves as m}
|
||||
{#if m.cls === 'blunder' || m.cls === 'mistake' || m.cls === 'brilliant' || m.cls === 'inaccuracy'}
|
||||
<circle cx={x(m.ply)} cy={y(m.evalCp)} r="3.2" fill={clsMeta[m.cls].color} stroke="#0a0c12" stroke-width="1" />
|
||||
{/if}
|
||||
{/each}
|
||||
<!-- current -->
|
||||
<line x1={x(ply)} x2={x(ply)} y1="0" y2={H} stroke="var(--live)" stroke-width="1.4" vector-effect="non-scaling-stroke" />
|
||||
{#if hover}
|
||||
<line x1={x(hover)} x2={x(hover)} y1="0" y2={H} stroke="#fff" stroke-opacity="0.35" vector-effect="non-scaling-stroke" />
|
||||
{/if}
|
||||
</svg>
|
||||
{#if hovered}
|
||||
<div class="tip mono" style:left="{(x(hovered.ply) / W) * 100}%">
|
||||
<b>{hovered.moveNo}{hovered.color === 'w' ? '.' : '…'}{hovered.san}</b>
|
||||
{fmt.evalStr(hovered.evalCp)}
|
||||
{#if clsMeta[hovered.cls].glyph}<span style:color={clsMeta[hovered.cls].color}>{clsMeta[hovered.cls].glyph}</span>{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.graph {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
cursor: crosshair;
|
||||
}
|
||||
.tip {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
transform: translateX(-50%);
|
||||
background: #000;
|
||||
border: 1px solid var(--line-2);
|
||||
padding: 2px 6px;
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,21 @@
|
||||
<script lang="ts">
|
||||
import type { Flags } from '#lib/mock.js';
|
||||
let { flags, loud = false }: { flags: Flags; loud?: boolean } = $props();
|
||||
</script>
|
||||
|
||||
<span class="flags">
|
||||
{#if flags.notes}<span class="tag ghost" title="Заметки себе: агент получает свою записку с прошлого хода">Заметки себе</span>{/if}
|
||||
{#if flags.tools}<span class="tag ghost" title="Доп. тулы: get_move_history + python">Доп. тулы</span>{/if}
|
||||
{#if flags.cheat}<span class="tag bad" class:loud title="Читерство: нелегальные ходы разрешены, партия без рейтинга">⚠ Читерство · без рейтинга</span>{/if}
|
||||
</span>
|
||||
|
||||
<style>
|
||||
.flags {
|
||||
display: inline-flex;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.loud {
|
||||
animation: blink 1.6s steps(1) infinite;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,92 @@
|
||||
<script lang="ts">
|
||||
import type { Entity, Persona } from '#lib/mock.js';
|
||||
import Mark from './Mark.svelte';
|
||||
|
||||
let {
|
||||
entity,
|
||||
persona,
|
||||
color,
|
||||
text,
|
||||
won,
|
||||
delay = 0
|
||||
}: { entity: Entity; persona: Persona; color: 'w' | 'b'; text: string; won: boolean; delay?: number } = $props();
|
||||
</script>
|
||||
|
||||
<figure class="iv {color}" class:won style:animation-delay="{delay}ms">
|
||||
<div class="head">
|
||||
<Mark {entity} size={44} corner={color === 'w' ? 'white' : 'black'} />
|
||||
<div class="who">
|
||||
<b class="display">{entity.name}</b>
|
||||
<span class="kicker">{persona} · {won ? 'победитель' : 'проигравший'}</span>
|
||||
</div>
|
||||
<span class="mic" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" width="18" height="18"><path fill="currentColor" d="M12 15a4 4 0 0 0 4-4V6a4 4 0 1 0-8 0v5a4 4 0 0 0 4 4Zm6-4a6 6 0 0 1-12 0H4a8 8 0 0 0 7 7.93V22h2v-3.07A8 8 0 0 0 20 11h-2Z"/></svg>
|
||||
</span>
|
||||
</div>
|
||||
<blockquote>{text}</blockquote>
|
||||
<figcaption class="kicker">Пресс-конференция · после партии</figcaption>
|
||||
</figure>
|
||||
|
||||
<style>
|
||||
.iv {
|
||||
margin: 0;
|
||||
background: linear-gradient(180deg, #13161f, #0c0e15);
|
||||
border: 1px solid var(--line);
|
||||
border-top: 3px solid var(--white-corner);
|
||||
padding: 12px 14px 12px;
|
||||
animation: rise 0.5s both cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
position: relative;
|
||||
}
|
||||
.iv.b {
|
||||
border-top-color: var(--black-corner);
|
||||
}
|
||||
.iv.won::after {
|
||||
content: 'W';
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 8px;
|
||||
font-family: var(--display);
|
||||
font-weight: 700;
|
||||
font-size: 44px;
|
||||
color: var(--gold);
|
||||
opacity: 0.12;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.who {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
line-height: 1.1;
|
||||
}
|
||||
.who b {
|
||||
font-size: 16px;
|
||||
}
|
||||
.mic {
|
||||
margin-left: auto;
|
||||
color: var(--live);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border: 1px solid color-mix(in srgb, var(--live) 50%, transparent);
|
||||
border-radius: 50%;
|
||||
}
|
||||
blockquote {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.55;
|
||||
color: var(--text);
|
||||
position: relative;
|
||||
padding-left: 12px;
|
||||
border-left: 2px solid var(--line-2);
|
||||
}
|
||||
figcaption {
|
||||
margin-top: 10px;
|
||||
font-size: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,110 @@
|
||||
<script lang="ts">
|
||||
import type { Entity, Persona } from '#lib/mock.js';
|
||||
import Mark from './Mark.svelte';
|
||||
|
||||
let {
|
||||
entity,
|
||||
persona,
|
||||
color,
|
||||
text,
|
||||
kicker = 'Треш-ток'
|
||||
}: { entity: Entity; persona: Persona; color: 'w' | 'b'; text: string; kicker?: string } = $props();
|
||||
</script>
|
||||
|
||||
{#key text}
|
||||
<div class="lt" style:--c={color === 'w' ? 'var(--white-corner)' : 'var(--black-corner)'}>
|
||||
<div class="name">
|
||||
<Mark {entity} size={44} corner={color === 'w' ? 'white' : 'black'} />
|
||||
<div class="who">
|
||||
<b class="display">{entity.name}</b>
|
||||
<span class="kicker">{persona} · {color === 'w' ? 'белые' : 'чёрные'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quote">
|
||||
<span class="k display">{kicker}</span>
|
||||
<p>«{text}»</p>
|
||||
</div>
|
||||
</div>
|
||||
{/key}
|
||||
|
||||
<style>
|
||||
.lt {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
align-items: stretch;
|
||||
animation: stinger-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
|
||||
}
|
||||
.name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 6px 22px 6px 8px;
|
||||
background: linear-gradient(180deg, #1a1f2b, #10131b);
|
||||
border-left: 4px solid var(--c);
|
||||
clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
|
||||
margin-right: -14px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.who {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: 1.1;
|
||||
gap: 3px;
|
||||
}
|
||||
.who b {
|
||||
font-size: 17px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.quote {
|
||||
background: #f3f4f8;
|
||||
color: #0a0b10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 6px 16px 6px 28px;
|
||||
clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%);
|
||||
min-width: 0;
|
||||
}
|
||||
.quote .k {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.18em;
|
||||
color: #fff;
|
||||
background: var(--c);
|
||||
padding: 3px 7px 2px;
|
||||
clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
|
||||
flex: 0 0 auto;
|
||||
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
.quote p {
|
||||
margin: 0;
|
||||
font-size: 14.5px;
|
||||
font-weight: 500;
|
||||
line-height: 1.3;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.lt {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.name {
|
||||
clip-path: none;
|
||||
margin-right: 0;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
.quote {
|
||||
clip-path: none;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
.quote p {
|
||||
font-size: 13.5px;
|
||||
-webkit-line-clamp: 3;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,73 @@
|
||||
<script lang="ts">
|
||||
import type { Entity } from '#lib/mock.js';
|
||||
import { marks } from '#lib/icons.js';
|
||||
|
||||
let {
|
||||
entity,
|
||||
size = 40,
|
||||
corner,
|
||||
flat = false
|
||||
}: { entity: Entity; size?: number; corner?: 'white' | 'black'; flat?: boolean } = $props();
|
||||
|
||||
const m = $derived(entity.vendor === 'human' ? null : marks[entity.vendor]);
|
||||
const cornerVar = $derived(corner === 'white' ? 'var(--white-corner)' : corner === 'black' ? 'var(--black-corner)' : 'var(--line-2)');
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="mark"
|
||||
class:flat
|
||||
style:--s="{size}px"
|
||||
style:--edge={cornerVar}
|
||||
style:--brand={m ? m.hex : `hsl(${entity.avatar?.hue ?? 0} 60% 50%)`}
|
||||
title={entity.name}
|
||||
>
|
||||
{#if m}
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true"><path d={m.path} /></svg>
|
||||
{:else}
|
||||
<span class="initials display" style:font-size="{size * 0.42}px">{entity.avatar?.initials ?? '?'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.mark {
|
||||
width: var(--s);
|
||||
height: var(--s);
|
||||
flex: 0 0 auto;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
position: relative;
|
||||
background:
|
||||
linear-gradient(160deg, color-mix(in srgb, var(--brand) 38%, #0d1017), color-mix(in srgb, var(--brand) 10%, #0d1017));
|
||||
clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
|
||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
.mark::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
background: var(--edge);
|
||||
transform: skewX(-12deg);
|
||||
transform-origin: top left;
|
||||
}
|
||||
.mark.flat {
|
||||
clip-path: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.mark.flat::after {
|
||||
display: none;
|
||||
}
|
||||
svg {
|
||||
width: 58%;
|
||||
height: 58%;
|
||||
fill: #fff;
|
||||
filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.5));
|
||||
}
|
||||
.initials {
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,73 @@
|
||||
<script lang="ts">
|
||||
/** Static FEN renderer reusing the chessground piece sprites. Cheap enough for grids. */
|
||||
let { fen, lastMove, flip = false }: { fen: string; lastMove?: [string, string]; flip?: boolean } = $props();
|
||||
|
||||
const roles: Record<string, string> = { p: 'pawn', n: 'knight', b: 'bishop', r: 'rook', q: 'queen', k: 'king' };
|
||||
|
||||
const pieces = $derived.by(() => {
|
||||
const out: { role: string; color: string; x: number; y: number }[] = [];
|
||||
const rows = fen.split(' ')[0].split('/');
|
||||
rows.forEach((row, r) => {
|
||||
let f = 0;
|
||||
for (const ch of row) {
|
||||
if (/\d/.test(ch)) f += Number(ch);
|
||||
else {
|
||||
const color = ch === ch.toUpperCase() ? 'white' : 'black';
|
||||
out.push({ role: roles[ch.toLowerCase()], color, x: flip ? 7 - f : f, y: flip ? 7 - r : r });
|
||||
f++;
|
||||
}
|
||||
}
|
||||
});
|
||||
return out;
|
||||
});
|
||||
|
||||
function sq(k: string) {
|
||||
const x = k.charCodeAt(0) - 97;
|
||||
const y = 8 - Number(k[1]);
|
||||
return { x: flip ? 7 - x : x, y: flip ? 7 - y : y };
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mini cg-wrap">
|
||||
<div class="grid">
|
||||
{#each Array(64) as _, i}
|
||||
<i class:dark={((i % 8) + Math.floor(i / 8)) % 2 === 1}></i>
|
||||
{/each}
|
||||
</div>
|
||||
{#if lastMove}
|
||||
{#each lastMove as k}
|
||||
{@const p = sq(k)}
|
||||
<b class="lm" style:transform="translate({p.x * 100}%, {p.y * 100}%)"></b>
|
||||
{/each}
|
||||
{/if}
|
||||
{#each pieces as p}
|
||||
<piece class="{p.role} {p.color}" style:transform="translate({p.x * 100}%, {p.y * 100}%)"></piece>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.mini {
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: #aeb6c9;
|
||||
}
|
||||
.grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8, 1fr);
|
||||
}
|
||||
.grid i.dark {
|
||||
background: #343b4f;
|
||||
}
|
||||
.lm {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 12.5%;
|
||||
height: 12.5%;
|
||||
background: rgba(255, 201, 60, 0.45);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,230 @@
|
||||
<script lang="ts">
|
||||
import type { Game } from '#lib/mock.js';
|
||||
import { clsMeta, fmt } from '#lib/mock.js';
|
||||
import Thoughts from './Thoughts.svelte';
|
||||
import { tick } from 'svelte';
|
||||
|
||||
let {
|
||||
game,
|
||||
ply = $bindable(),
|
||||
open = $bindable<number | null>(null),
|
||||
livePly
|
||||
}: { game: Game; ply: number; open: number | null; livePly: number } = $props();
|
||||
|
||||
const rows = $derived.by(() => {
|
||||
const out: { no: number; w?: (typeof game.moves)[number]; b?: (typeof game.moves)[number] }[] = [];
|
||||
for (const m of game.moves) {
|
||||
let r = out[m.moveNo - 1];
|
||||
if (!r) r = out[m.moveNo - 1] = { no: m.moveNo };
|
||||
if (m.color === 'w') r.w = m;
|
||||
else r.b = m;
|
||||
}
|
||||
return out;
|
||||
});
|
||||
|
||||
let scroller: HTMLDivElement;
|
||||
function select(p: number) {
|
||||
ply = p;
|
||||
open = open === p ? null : p;
|
||||
}
|
||||
$effect(() => {
|
||||
// keep current move visible; when thoughts are open, pin the row to the top so the panel is readable
|
||||
ply;
|
||||
open;
|
||||
tick().then(() => {
|
||||
const el = scroller?.querySelector('[data-ply="' + ply + '"]') as HTMLElement | null;
|
||||
if (!el) return;
|
||||
if (open === ply) {
|
||||
const row = el.closest('.row') as HTMLElement | null;
|
||||
scroller.scrollTo({ top: (row ?? el).offsetTop - 4, behavior: 'smooth' });
|
||||
} else el.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
const legend: (keyof typeof clsMeta)[] = ['brilliant', 'best', 'inaccuracy', 'mistake', 'blunder'];
|
||||
</script>
|
||||
|
||||
<div class="list">
|
||||
<div class="panel-head">
|
||||
<span>Ходы</span>
|
||||
<span class="legend">
|
||||
{#each legend as c}
|
||||
<span style:color={clsMeta[c].color} title={clsMeta[c].label}>{clsMeta[c].glyph}</span>
|
||||
{/each}
|
||||
</span>
|
||||
</div>
|
||||
<div class="scroller" bind:this={scroller}>
|
||||
{#each rows as r}
|
||||
<div class="row" class:cur={r.w?.ply === ply || r.b?.ply === ply}>
|
||||
<span class="no mono">{r.no}</span>
|
||||
{#each ['w', 'b'] as const as c}
|
||||
{@const m = c === 'w' ? r.w : r.b}
|
||||
{#if m}
|
||||
<button
|
||||
class="mv"
|
||||
class:cur={m.ply === ply}
|
||||
class:live={m.ply === livePly}
|
||||
class:opened={open === m.ply}
|
||||
data-ply={m.ply}
|
||||
onclick={() => select(m.ply)}
|
||||
title="{clsMeta[m.cls].label} · {fmt.time(m.timeSec)} · {fmt.usd(m.costUsd)}"
|
||||
>
|
||||
<span class="san mono">{m.san}</span>
|
||||
{#if clsMeta[m.cls].glyph && m.cls !== 'book'}
|
||||
<span class="g" style:color={clsMeta[m.cls].color}>{clsMeta[m.cls].glyph}</span>
|
||||
{:else if m.cls === 'book'}
|
||||
<span class="g book">▫</span>
|
||||
{/if}
|
||||
<span class="t mono">{fmt.time(m.timeSec)}</span>
|
||||
{#if m.talk}<span class="bubble" title="треш-ток">“</span>{/if}
|
||||
<span class="chev" aria-hidden="true">▸</span>
|
||||
</button>
|
||||
{:else}
|
||||
<span class="mv empty"></span>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{#if open && (r.w?.ply === open || r.b?.ply === open)}
|
||||
{@const m = r.w?.ply === open ? r.w : r.b}
|
||||
{#if m}<div class="exp"><Thoughts move={m} {game} /></div>{/if}
|
||||
{/if}
|
||||
{/each}
|
||||
{#if livePly === game.moves.length && !game.result}
|
||||
<div class="row pending">
|
||||
<span class="no mono">{Math.ceil((game.moves.length + 1) / 2)}</span>
|
||||
{#if game.moves.length % 2 === 0}<span class="mv empty"></span>{/if}
|
||||
<span class="mv thinking"><span class="dots"><i></i><i></i><i></i></span> думает…</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
}
|
||||
.legend {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
.scroller {
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 4px 0 8px;
|
||||
position: relative;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--line-2) transparent;
|
||||
}
|
||||
.row {
|
||||
display: grid;
|
||||
grid-template-columns: 34px 1fr 1fr;
|
||||
align-items: stretch;
|
||||
}
|
||||
.row.cur {
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
.no {
|
||||
color: var(--dim);
|
||||
font-size: 11px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border-right: 1px solid var(--line);
|
||||
}
|
||||
.mv {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 5px 8px;
|
||||
text-align: left;
|
||||
min-height: 30px;
|
||||
position: relative;
|
||||
border-left: 2px solid transparent;
|
||||
color: var(--text-2);
|
||||
transition: background 0.12s;
|
||||
}
|
||||
.mv:hover {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: var(--text);
|
||||
}
|
||||
.mv.cur {
|
||||
background: color-mix(in srgb, var(--gold) 14%, transparent);
|
||||
color: var(--text);
|
||||
border-left-color: var(--gold);
|
||||
}
|
||||
.mv.live .san::after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: var(--live);
|
||||
margin-left: 4px;
|
||||
vertical-align: middle;
|
||||
animation: blink 1.2s steps(1) infinite;
|
||||
}
|
||||
.mv.opened .chev {
|
||||
transform: rotate(90deg);
|
||||
color: var(--gold);
|
||||
}
|
||||
.san {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
.g {
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
font-family: var(--display);
|
||||
}
|
||||
.g.book {
|
||||
color: var(--dim);
|
||||
}
|
||||
.t {
|
||||
margin-left: auto;
|
||||
font-size: 10px;
|
||||
color: var(--dim);
|
||||
}
|
||||
.bubble {
|
||||
font-family: Georgia, serif;
|
||||
color: var(--muted);
|
||||
font-size: 16px;
|
||||
line-height: 0;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.chev {
|
||||
font-size: 9px;
|
||||
color: var(--dim);
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
.exp {
|
||||
padding: 0 8px 0 10px;
|
||||
}
|
||||
.pending .thinking {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
cursor: default;
|
||||
}
|
||||
.dots {
|
||||
display: inline-flex;
|
||||
gap: 3px;
|
||||
}
|
||||
.dots i {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
border-radius: 50%;
|
||||
background: var(--live);
|
||||
animation: blink 1s steps(1) infinite;
|
||||
}
|
||||
.dots i:nth-child(2) {
|
||||
animation-delay: 0.33s;
|
||||
}
|
||||
.dots i:nth-child(3) {
|
||||
animation-delay: 0.66s;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,169 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import { liveGames } from '#lib/mock.js';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
let now = $state(new Date());
|
||||
onMount(() => {
|
||||
const t = setInterval(() => (now = new Date()), 1000);
|
||||
return () => clearInterval(t);
|
||||
});
|
||||
const clock = $derived(now.toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit', second: '2-digit' }));
|
||||
|
||||
const links = [
|
||||
{ href: '/', label: 'Эфир' },
|
||||
{ href: '/leaderboard', label: 'Таблица' },
|
||||
{ href: '/games', label: 'Архив' },
|
||||
{ href: '/admin', label: 'Админ' }
|
||||
];
|
||||
const path = $derived(page.url.pathname);
|
||||
const active = (href: string) => (href === '/' ? path === '/' : path.startsWith(href));
|
||||
</script>
|
||||
|
||||
<header class="nav">
|
||||
<div class="inner">
|
||||
<a href="/" class="logo display" aria-label="AI·CHESS">
|
||||
<span class="ai">AI</span><span class="dot">·</span><span class="chess">CHESS</span>
|
||||
<span class="tag live"><span class="live-dot"></span>Эфир</span>
|
||||
</a>
|
||||
<nav>
|
||||
{#each links as l}
|
||||
<a href={l.href} class="display" class:active={active(l.href)}>{l.label}</a>
|
||||
{/each}
|
||||
</nav>
|
||||
<div class="right">
|
||||
<span class="onair">
|
||||
<span class="n display">{liveGames.length}</span>
|
||||
<span class="k kicker">в эфире</span>
|
||||
</span>
|
||||
<span class="clock mono">{clock}</span>
|
||||
<a href="/new" class="btn primary sm">Новый матч</a>
|
||||
<a href="/login" class="avatar" title="danosito" style:--hue="32">Д</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<style>
|
||||
.nav {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 50;
|
||||
background: linear-gradient(180deg, rgba(8, 9, 14, 0.96), rgba(8, 9, 14, 0.88));
|
||||
backdrop-filter: blur(10px);
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.inner {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
height: 52px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 28px;
|
||||
}
|
||||
.logo {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
.logo .ai {
|
||||
color: var(--gold);
|
||||
}
|
||||
.logo .dot {
|
||||
color: var(--dim);
|
||||
margin: 0 1px;
|
||||
}
|
||||
.logo .tag {
|
||||
margin-left: 10px;
|
||||
font-size: 10px;
|
||||
}
|
||||
nav {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
height: 100%;
|
||||
}
|
||||
nav a {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.12em;
|
||||
color: var(--muted);
|
||||
position: relative;
|
||||
height: 52px;
|
||||
}
|
||||
nav a:hover {
|
||||
color: var(--text);
|
||||
}
|
||||
nav a.active {
|
||||
color: var(--text);
|
||||
}
|
||||
nav a.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
right: 10px;
|
||||
bottom: -1px;
|
||||
height: 3px;
|
||||
background: var(--gold);
|
||||
transform: skewX(-12deg);
|
||||
}
|
||||
.right {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
.onair {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
}
|
||||
.onair .n {
|
||||
font-size: 18px;
|
||||
color: var(--live);
|
||||
}
|
||||
.clock {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.avatar {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-family: var(--display);
|
||||
font-weight: 700;
|
||||
background: linear-gradient(160deg, hsl(var(--hue) 70% 55%), hsl(var(--hue) 60% 35%));
|
||||
clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.inner {
|
||||
gap: 12px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
nav a {
|
||||
padding: 0 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.clock,
|
||||
.onair .k,
|
||||
.right .btn {
|
||||
display: none;
|
||||
}
|
||||
.logo .tag {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
nav a:nth-child(n + 3) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,150 @@
|
||||
<script lang="ts">
|
||||
import type { Entity } from '#lib/mock.js';
|
||||
|
||||
let {
|
||||
white,
|
||||
black,
|
||||
pred,
|
||||
locked = false,
|
||||
result,
|
||||
compact = false
|
||||
}: {
|
||||
white: Entity;
|
||||
black: Entity;
|
||||
pred: { white: number; draw: number; black: number; total: number; mine?: 'white' | 'draw' | 'black' };
|
||||
locked?: boolean;
|
||||
result?: '1-0' | '0-1' | '½-½';
|
||||
compact?: boolean;
|
||||
} = $props();
|
||||
|
||||
let mine = $state(pred.mine);
|
||||
const outcome = $derived(result === '1-0' ? 'white' : result === '0-1' ? 'black' : result === '½-½' ? 'draw' : undefined);
|
||||
const won = $derived(outcome && mine === outcome);
|
||||
</script>
|
||||
|
||||
<div class="pred" class:compact>
|
||||
<div class="panel-head">
|
||||
<span>{compact ? 'Прогноз' : 'Прогноз зрителей'}</span>
|
||||
<span class="st kicker">
|
||||
{#if result}итог{:else if locked}<span class="lock">🔒</span> заблокирован{:else}открыт{/if}
|
||||
· {pred.total}
|
||||
</span>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="bar">
|
||||
<span class="w" style:width="{pred.white}%" class:win={outcome === 'white'}></span>
|
||||
<span class="d" style:width="{pred.draw}%" class:win={outcome === 'draw'}></span>
|
||||
<span class="b" style:width="{pred.black}%" class:win={outcome === 'black'}></span>
|
||||
</div>
|
||||
<div class="opts">
|
||||
{#each [['white', white.short, pred.white], ['draw', 'Ничья', pred.draw], ['black', black.short, pred.black]] as const as [k, label, v]}
|
||||
<button class="opt {k}" class:mine={mine === k} class:hit={outcome === k} disabled={locked || !!result} onclick={() => (mine = k)}>
|
||||
<span class="pct display tnum">{v}%</span>
|
||||
<span class="lbl">{label}</span>
|
||||
{#if mine === k}<span class="tag gold">вы</span>{/if}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{#if result}
|
||||
<div class="verdict" class:won>
|
||||
{#if won}Вы угадали · <b>+{mine === 'draw' ? 40 : 30} очков</b>{:else}Не угадали · 0 очков. Бывает.{/if}
|
||||
</div>
|
||||
{:else if locked}
|
||||
<div class="verdict dim">Прогнозы закрыты на старте партии. Ставка — {mine ? (mine === 'white' ? white.short : mine === 'black' ? black.short : 'ничья') : 'не сделана'}.</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.body {
|
||||
padding: 10px;
|
||||
}
|
||||
.bar {
|
||||
display: flex;
|
||||
height: 10px;
|
||||
gap: 2px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.bar span {
|
||||
display: block;
|
||||
transition: width 0.4s;
|
||||
opacity: 0.9;
|
||||
}
|
||||
.bar .w {
|
||||
background: #e9ecf3;
|
||||
}
|
||||
.bar .d {
|
||||
background: var(--dim);
|
||||
}
|
||||
.bar .b {
|
||||
background: #3a4153;
|
||||
}
|
||||
.bar span.win {
|
||||
box-shadow: 0 0 0 1px var(--gold), 0 0 12px var(--gold);
|
||||
}
|
||||
.opts {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 4px;
|
||||
}
|
||||
.opt {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 1px;
|
||||
padding: 7px 8px 6px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid var(--line);
|
||||
position: relative;
|
||||
text-align: left;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
.opt:not(:disabled):hover {
|
||||
border-color: var(--line-2);
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
.opt:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
.opt.mine {
|
||||
border-color: var(--gold);
|
||||
}
|
||||
.opt.hit {
|
||||
background: color-mix(in srgb, var(--gold) 12%, transparent);
|
||||
}
|
||||
.opt .pct {
|
||||
font-size: 18px;
|
||||
}
|
||||
.opt .lbl {
|
||||
font-size: 10px;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
font-family: var(--display);
|
||||
}
|
||||
.opt .tag {
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
right: -1px;
|
||||
font-size: 9px;
|
||||
padding: 2px 6px 1px;
|
||||
clip-path: none;
|
||||
}
|
||||
.verdict {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--text-2);
|
||||
}
|
||||
.verdict.won {
|
||||
color: var(--gold);
|
||||
}
|
||||
.verdict.dim {
|
||||
color: var(--muted);
|
||||
}
|
||||
.lock {
|
||||
font-size: 10px;
|
||||
}
|
||||
.compact .opt .pct {
|
||||
font-size: 15px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,386 @@
|
||||
<script lang="ts">
|
||||
import type { Game } from '#lib/mock.js';
|
||||
import { fmt, accuracy } from '#lib/mock.js';
|
||||
import Mark from './Mark.svelte';
|
||||
|
||||
let {
|
||||
game,
|
||||
ply,
|
||||
thinkingSec = 0,
|
||||
over = false
|
||||
}: { game: Game; ply: number; thinkingSec?: number; over?: boolean } = $props();
|
||||
|
||||
const shown = $derived(game.moves.slice(0, ply));
|
||||
const last = $derived(shown[shown.length - 1]);
|
||||
const turn = $derived<'w' | 'b'>(last ? (last.color === 'w' ? 'b' : 'w') : 'w');
|
||||
const moveNo = $derived(last ? (last.color === 'b' ? last.moveNo + 1 : last.moveNo) : 1);
|
||||
const evalCp = $derived(last?.evalCp ?? 20);
|
||||
const accW = $derived(accuracy(shown, 'w'));
|
||||
const accB = $derived(accuracy(shown, 'b'));
|
||||
const costW = $derived(shown.filter((m) => m.color === 'w').reduce((a, m) => a + m.costUsd, 0));
|
||||
const costB = $derived(shown.filter((m) => m.color === 'b').reduce((a, m) => a + m.costUsd, 0));
|
||||
const lastTimeW = $derived([...shown].reverse().find((m) => m.color === 'w')?.timeSec ?? 0);
|
||||
const lastTimeB = $derived([...shown].reverse().find((m) => m.color === 'b')?.timeSec ?? 0);
|
||||
const isLive = $derived(!over && ply === game.moves.length);
|
||||
</script>
|
||||
|
||||
{#snippet side(color: 'w' | 'b')}
|
||||
{@const e = color === 'w' ? game.white : game.black}
|
||||
{@const persona = color === 'w' ? game.whitePersona : game.blackPersona}
|
||||
{@const acc = color === 'w' ? accW : accB}
|
||||
{@const cost = color === 'w' ? costW : costB}
|
||||
{@const myTurn = turn === color && isLive}
|
||||
{@const won = over && ((game.result === '1-0' && color === 'w') || (game.result === '0-1' && color === 'b'))}
|
||||
<div class="side {color}" class:turn={myTurn} class:won>
|
||||
<div class="id">
|
||||
<Mark entity={e} size={52} corner={color === 'w' ? 'white' : 'black'} />
|
||||
<div class="who">
|
||||
<div class="name display">
|
||||
<span class="full">{e.name}</span><span class="shortn">{e.short}</span>
|
||||
{#if e.variant}<span class="var" class:max={e.variant === 'MAX'}>{e.variant}</span>{/if}
|
||||
</div>
|
||||
<div class="sub">
|
||||
<span class="rating tnum">{e.rating}</span>
|
||||
<span class="sep">·</span>
|
||||
<span>{persona}</span>
|
||||
<span class="sep">·</span>
|
||||
<span class="col">{color === 'w' ? 'белые' : 'чёрные'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
<span class="k kicker">Точность</span>
|
||||
<span class="v display tnum" style:color={acc >= 90 ? 'var(--good)' : acc >= 80 ? 'var(--text)' : 'var(--warn)'}>{acc.toFixed(1)}<small>%</small></span>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<span class="k kicker">Расход</span>
|
||||
<span class="v display tnum">{fmt.usd(cost)}</span>
|
||||
</div>
|
||||
<div class="stat timer" class:lit={myTurn}>
|
||||
<span class="k kicker">{myTurn ? 'Думает' : won ? 'Победа' : 'Ход за'}</span>
|
||||
<span class="v display tnum">
|
||||
{#if myTurn}{fmt.time(thinkingSec)}{:else if won}★{:else}{fmt.time(color === 'w' ? lastTimeW : lastTimeB)}{/if}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
<div class="bug" class:over>
|
||||
{@render side('w')}
|
||||
<div class="center">
|
||||
{#if over}
|
||||
<div class="res display">{game.result?.replace('-', '–')}</div>
|
||||
<div class="lbl kicker">Финал</div>
|
||||
{:else}
|
||||
<div class="mv display tnum">{moveNo}</div>
|
||||
<div class="lbl kicker">ход</div>
|
||||
<div class="ev display tnum" class:neg={evalCp < 0}>{fmt.evalStr(evalCp)}</div>
|
||||
{/if}
|
||||
</div>
|
||||
{@render side('b')}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.bug {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 112px 1fr;
|
||||
align-items: stretch;
|
||||
background: linear-gradient(180deg, #141824, #0d1018);
|
||||
border: 1px solid var(--line);
|
||||
border-top: 2px solid var(--line-2);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.bug::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background:
|
||||
linear-gradient(90deg, color-mix(in srgb, var(--white-corner) 14%, transparent), transparent 35%),
|
||||
linear-gradient(270deg, color-mix(in srgb, var(--black-corner) 14%, transparent), transparent 35%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.side {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 10px 16px;
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
}
|
||||
.side.b {
|
||||
flex-direction: row-reverse;
|
||||
text-align: right;
|
||||
}
|
||||
.side.b .id {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.side::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
background: var(--white-corner);
|
||||
opacity: 0.35;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
.side.b::after {
|
||||
background: var(--black-corner);
|
||||
}
|
||||
.side.turn::after,
|
||||
.side.won::after {
|
||||
opacity: 1;
|
||||
box-shadow: 0 0 18px currentColor;
|
||||
}
|
||||
.id {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
.name {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.02em;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.side.b .name {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.var {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.14em;
|
||||
padding: 3px 6px 2px;
|
||||
background: var(--panel-3);
|
||||
color: var(--text-2);
|
||||
clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
|
||||
}
|
||||
.var.max {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
}
|
||||
.shortn {
|
||||
display: none;
|
||||
}
|
||||
.sub {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-top: 2px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.side.b .sub {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.rating {
|
||||
color: var(--text-2);
|
||||
font-weight: 600;
|
||||
}
|
||||
.stats {
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
align-items: center;
|
||||
}
|
||||
.side.b .stats {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 2px;
|
||||
min-width: 56px;
|
||||
}
|
||||
.side.b .stat {
|
||||
align-items: flex-end;
|
||||
}
|
||||
.stat .v {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.stat .v small {
|
||||
font-size: 12px;
|
||||
margin-left: 1px;
|
||||
}
|
||||
.timer {
|
||||
padding: 6px 10px 5px;
|
||||
border: 1px solid var(--line);
|
||||
min-width: 84px;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.timer.lit {
|
||||
border-color: var(--live);
|
||||
background: color-mix(in srgb, var(--live) 18%, transparent);
|
||||
}
|
||||
.timer.lit .k {
|
||||
color: var(--live);
|
||||
animation: blink 1.2s steps(1) infinite;
|
||||
}
|
||||
.timer.lit .v {
|
||||
color: #fff;
|
||||
}
|
||||
.center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0;
|
||||
background: #05060a;
|
||||
position: relative;
|
||||
border-left: 1px solid var(--line);
|
||||
border-right: 1px solid var(--line);
|
||||
}
|
||||
.center::before,
|
||||
.center::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 10px;
|
||||
background: var(--gold);
|
||||
opacity: 0.9;
|
||||
}
|
||||
.center::before {
|
||||
left: -6px;
|
||||
transform: skewX(-12deg);
|
||||
}
|
||||
.center::after {
|
||||
right: -6px;
|
||||
transform: skewX(-12deg);
|
||||
}
|
||||
.mv {
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
}
|
||||
.lbl {
|
||||
font-size: 9px;
|
||||
}
|
||||
.ev {
|
||||
margin-top: 4px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
padding: 2px 8px 1px;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
.ev.neg {
|
||||
background: #1c1f28;
|
||||
color: #fff;
|
||||
box-shadow: inset 0 0 0 1px var(--line-2);
|
||||
}
|
||||
.res {
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
color: var(--gold);
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.stats .stat:not(.timer) {
|
||||
display: none;
|
||||
}
|
||||
.name {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.bug {
|
||||
grid-template-columns: 1fr 58px 1fr;
|
||||
}
|
||||
.side {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 6px;
|
||||
padding: 8px 8px 10px;
|
||||
}
|
||||
.side.b {
|
||||
flex-direction: column;
|
||||
}
|
||||
.side.b .id {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.id {
|
||||
gap: 8px;
|
||||
}
|
||||
.id :global(.mark) {
|
||||
--s: 34px;
|
||||
}
|
||||
.full {
|
||||
display: none;
|
||||
}
|
||||
.shortn {
|
||||
display: inline;
|
||||
}
|
||||
.who {
|
||||
min-width: 0;
|
||||
}
|
||||
.name {
|
||||
font-size: 13px;
|
||||
white-space: normal;
|
||||
line-height: 1.05;
|
||||
gap: 5px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.side.b .name {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.var {
|
||||
font-size: 8px;
|
||||
padding: 2px 4px 1px;
|
||||
}
|
||||
.sub {
|
||||
font-size: 10px;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
white-space: normal;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.sub .col,
|
||||
.sub .sep:last-of-type {
|
||||
display: none;
|
||||
}
|
||||
.stats {
|
||||
gap: 6px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.side.b .stats {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.stats .stat {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
}
|
||||
.stats .stat:nth-child(2) {
|
||||
display: none;
|
||||
}
|
||||
.stat .k {
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.stat .v {
|
||||
font-size: 15px;
|
||||
}
|
||||
.timer {
|
||||
min-width: 60px;
|
||||
padding: 3px 6px 2px;
|
||||
}
|
||||
.mv {
|
||||
font-size: 22px;
|
||||
}
|
||||
.ev {
|
||||
font-size: 12px;
|
||||
}
|
||||
.res {
|
||||
font-size: 22px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,91 @@
|
||||
<script lang="ts">
|
||||
import type { Game } from '#lib/mock.js';
|
||||
import Mark from './Mark.svelte';
|
||||
import { tick } from 'svelte';
|
||||
|
||||
let { game, ply, onselect }: { game: Game; ply: number; onselect?: (p: number) => void } = $props();
|
||||
const items = $derived(game.moves.slice(0, ply).filter((m) => m.talk).reverse());
|
||||
</script>
|
||||
|
||||
<div class="feed">
|
||||
<div class="panel-head">
|
||||
<span>Треш-ток</span>
|
||||
<span class="cnt mono">{items.length}</span>
|
||||
</div>
|
||||
<div class="scroller">
|
||||
{#each items as m (m.ply)}
|
||||
{@const e = m.color === 'w' ? game.white : game.black}
|
||||
<button class="msg {m.color}" onclick={() => onselect?.(m.ply)}>
|
||||
<Mark entity={e} size={28} corner={m.color === 'w' ? 'white' : 'black'} />
|
||||
<div class="b">
|
||||
<div class="top">
|
||||
<b class="display">{e.short}</b>
|
||||
<span class="mono">{m.moveNo}{m.color === 'w' ? '.' : '…'}{m.san}</span>
|
||||
</div>
|
||||
<p>{m.talk}</p>
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.feed {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
}
|
||||
.cnt {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.scroller {
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--line-2) transparent;
|
||||
}
|
||||
.msg {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 8px;
|
||||
text-align: left;
|
||||
padding: 6px 8px 7px 6px;
|
||||
background: rgba(255, 255, 255, 0.025);
|
||||
border-left: 2px solid var(--white-corner);
|
||||
transition: background 0.12s;
|
||||
}
|
||||
.msg.b {
|
||||
border-left-color: var(--black-corner);
|
||||
}
|
||||
.msg:hover {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
.msg:first-child {
|
||||
background: rgba(255, 201, 60, 0.06);
|
||||
}
|
||||
.top {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: baseline;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.top b {
|
||||
font-size: 12px;
|
||||
color: var(--text-2);
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
p {
|
||||
margin: 2px 0 0;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.4;
|
||||
color: var(--text);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,246 @@
|
||||
<script lang="ts">
|
||||
import type { Game, MoveRec } from '#lib/mock.js';
|
||||
import { fmt, clsMeta } from '#lib/mock.js';
|
||||
import Mark from './Mark.svelte';
|
||||
|
||||
let { move, game }: { move: MoveRec; game: Game } = $props();
|
||||
let tab = $state<'reason' | 'tools' | 'ctx'>('reason');
|
||||
const e = $derived(move.color === 'w' ? game.white : game.black);
|
||||
const persona = $derived(move.color === 'w' ? game.whitePersona : game.blackPersona);
|
||||
</script>
|
||||
|
||||
<div class="th" style:--c={move.color === 'w' ? 'var(--white-corner)' : 'var(--black-corner)'}>
|
||||
<div class="head">
|
||||
<span class="replay display">Мысли</span>
|
||||
<Mark entity={e} size={22} corner={move.color === 'w' ? 'white' : 'black'} />
|
||||
<b class="display">{e.short}</b>
|
||||
<span class="mv mono">{move.moveNo}{move.color === 'w' ? '.' : '…'}{move.san}</span>
|
||||
{#if clsMeta[move.cls].glyph}<span class="cls" style:color={clsMeta[move.cls].color}>{clsMeta[move.cls].glyph} {clsMeta[move.cls].label}</span>{/if}
|
||||
<span class="meta mono">
|
||||
<span title="время">⏱ {fmt.time(move.timeSec)}</span>
|
||||
<span title="токены">{fmt.tok(move.tokens)} tok</span>
|
||||
<span title="стоимость">{fmt.usd(move.costUsd)}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="tabs">
|
||||
<button class:on={tab === 'reason'} onclick={() => (tab = 'reason')}>Рассуждение</button>
|
||||
<button class:on={tab === 'tools'} onclick={() => (tab = 'tools')}>Тулы <i>{move.thought.tools.length}</i></button>
|
||||
<button class:on={tab === 'ctx'} onclick={() => (tab = 'ctx')}>Контекст</button>
|
||||
</div>
|
||||
<div class="body">
|
||||
{#if tab === 'reason'}
|
||||
{#if move.thought.noteFromPast && game.flags.notes}
|
||||
<div class="note past"><span class="kicker">Заметка из прошлого хода</span>{move.thought.noteFromPast}</div>
|
||||
{/if}
|
||||
<p class="summary">{move.thought.summary}</p>
|
||||
{#if move.bestSan}
|
||||
<p class="engine"><span class="kicker">Stockfish</span> лучше было <b class="mono">{move.bestSan}</b></p>
|
||||
{/if}
|
||||
{#if move.talk}
|
||||
<p class="talk"><span class="kicker">{persona}</span>«{move.talk}»</p>
|
||||
{/if}
|
||||
{#if move.thought.note && game.flags.notes}
|
||||
<div class="note"><span class="kicker">Заметка себе</span>{move.thought.note}</div>
|
||||
{/if}
|
||||
{:else if tab === 'tools'}
|
||||
<ol class="tools">
|
||||
{#each move.thought.tools as t, i}
|
||||
<li>
|
||||
<div class="call mono">
|
||||
<span class="idx">{i + 1}</span>
|
||||
<span class="fn">{t.name}</span>(<span class="args">{t.args}</span>)
|
||||
<span class="ms">{t.ms} ms</span>
|
||||
</div>
|
||||
<pre class="out mono">{t.result}</pre>
|
||||
</li>
|
||||
{/each}
|
||||
</ol>
|
||||
{:else}
|
||||
<p class="ctx-note">Ровно то, что модель получила перед ходом. Контекст свежий: памяти о прошлых ходах нет.</p>
|
||||
<pre class="ctx mono">{move.thought.context}</pre>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.th {
|
||||
margin: 4px 0 10px;
|
||||
background: #08090e;
|
||||
border: 1px solid var(--line-2);
|
||||
border-left: 4px solid var(--c);
|
||||
animation: stinger-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.th::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(100deg, transparent 30%, rgba(255, 201, 60, 0.18) 50%, transparent 70%);
|
||||
background-size: 200% 100%;
|
||||
animation: flash 0.9s ease-out 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.replay {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.16em;
|
||||
padding: 3px 8px 2px;
|
||||
clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
|
||||
}
|
||||
.head b {
|
||||
font-size: 13px;
|
||||
}
|
||||
.mv {
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
.cls {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
font-size: 11px;
|
||||
}
|
||||
.meta {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.tabs {
|
||||
display: flex;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.tabs button {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
font-size: 11px;
|
||||
padding: 8px 12px 7px;
|
||||
color: var(--muted);
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1px;
|
||||
display: inline-flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
}
|
||||
.tabs button i {
|
||||
font-style: normal;
|
||||
background: var(--panel-3);
|
||||
padding: 0 5px;
|
||||
font-size: 10px;
|
||||
}
|
||||
.tabs button.on {
|
||||
color: var(--text);
|
||||
border-bottom-color: var(--gold);
|
||||
}
|
||||
.body {
|
||||
padding: 10px 12px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.summary {
|
||||
margin: 0 0 8px;
|
||||
line-height: 1.55;
|
||||
color: var(--text);
|
||||
}
|
||||
.engine,
|
||||
.talk {
|
||||
margin: 6px 0 0;
|
||||
color: var(--text-2);
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: baseline;
|
||||
}
|
||||
.talk {
|
||||
font-style: italic;
|
||||
}
|
||||
.note {
|
||||
margin-top: 10px;
|
||||
padding: 8px 10px;
|
||||
background: color-mix(in srgb, var(--gold) 10%, transparent);
|
||||
border-left: 2px solid var(--gold);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
color: var(--text);
|
||||
}
|
||||
.note .kicker {
|
||||
color: var(--gold);
|
||||
}
|
||||
.note.past {
|
||||
margin: 0 0 10px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border-left-color: var(--dim);
|
||||
color: var(--text-2);
|
||||
}
|
||||
.note.past .kicker {
|
||||
color: var(--muted);
|
||||
}
|
||||
.tools {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.call {
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.idx {
|
||||
color: var(--dim);
|
||||
min-width: 14px;
|
||||
}
|
||||
.fn {
|
||||
color: var(--ice);
|
||||
font-weight: 500;
|
||||
}
|
||||
.args {
|
||||
color: var(--text-2);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
.ms {
|
||||
margin-left: auto;
|
||||
color: var(--dim);
|
||||
font-size: 11px;
|
||||
}
|
||||
.out,
|
||||
.ctx {
|
||||
margin: 4px 0 0 20px;
|
||||
padding: 6px 8px;
|
||||
background: #000;
|
||||
border: 1px solid var(--line);
|
||||
color: var(--good);
|
||||
font-size: 11.5px;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
max-height: 160px;
|
||||
overflow: auto;
|
||||
}
|
||||
.ctx {
|
||||
margin-left: 0;
|
||||
color: var(--text-2);
|
||||
max-height: 300px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
.ctx-note {
|
||||
margin: 0 0 8px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,183 @@
|
||||
<script lang="ts">
|
||||
import type { Entity, Thumb } from '#lib/mock.js';
|
||||
import Mark from './Mark.svelte';
|
||||
import MiniBoard from './MiniBoard.svelte';
|
||||
|
||||
let {
|
||||
white,
|
||||
black,
|
||||
thumb,
|
||||
result,
|
||||
unrated = false,
|
||||
big = false
|
||||
}: { white: Entity; black: Entity; thumb: Thumb; result?: string; unrated?: boolean; big?: boolean } = $props();
|
||||
|
||||
const schemes = {
|
||||
fire: ['#ff5d3a', '#7a1a0a'],
|
||||
ice: ['#7cc7ff', '#123a63'],
|
||||
gold: ['#ffc93c', '#6b4a00'],
|
||||
live: ['#ff2a3c', '#5a0a12']
|
||||
};
|
||||
const [c1, c2] = $derived(schemes[thumb.scheme]);
|
||||
const loserIsWhite = $derived(result === '0-1');
|
||||
const loserIsBlack = $derived(result === '1-0');
|
||||
// caption size scales with length (YouTube-style: as big as fits)
|
||||
const len = $derived(thumb.caption.length);
|
||||
const capSize = $derived(len <= 14 ? 17 : len <= 22 ? 14 : len <= 30 ? 11.5 : 9.5);
|
||||
</script>
|
||||
|
||||
<div class="thumb" class:big class:has-sub={!!thumb.sub} style:--c1={c1} style:--c2={c2}>
|
||||
<div class="bg"></div>
|
||||
<div class="rays"></div>
|
||||
<div class="board" style:transform="rotate({thumb.tilt}deg)">
|
||||
<MiniBoard fen={thumb.fen} />
|
||||
</div>
|
||||
<div class="side l" class:loser={loserIsWhite}>
|
||||
<Mark entity={white} size={big ? 84 : 58} flat />
|
||||
{#if loserIsWhite}<span class="x">✕</span>{/if}
|
||||
</div>
|
||||
<div class="side r" class:loser={loserIsBlack}>
|
||||
<Mark entity={black} size={big ? 84 : 58} flat />
|
||||
{#if loserIsBlack}<span class="x">✕</span>{/if}
|
||||
</div>
|
||||
<div class="cap display" style:font-size="{capSize}cqw" style:transform="rotate({thumb.tilt * 0.5}deg)">{thumb.caption}</div>
|
||||
{#if thumb.sub}<div class="sub display">{thumb.sub}</div>{/if}
|
||||
{#if result}<div class="res display">{result.replace('-', '–')}</div>{/if}
|
||||
{#if unrated}<div class="unr display">Без рейтинга</div>{/if}
|
||||
<span class="arrow" aria-hidden="true">➜</span>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.thumb {
|
||||
position: relative;
|
||||
aspect-ratio: 16/9;
|
||||
overflow: hidden;
|
||||
background: #0a0b10;
|
||||
border: 1px solid var(--line);
|
||||
container-type: inline-size;
|
||||
font-size: 10px;
|
||||
}
|
||||
.bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background:
|
||||
linear-gradient(115deg, var(--c1) 0 42%, transparent 42.3%),
|
||||
linear-gradient(295deg, var(--c2) 0 42%, transparent 42.3%),
|
||||
radial-gradient(60% 80% at 50% 50%, #1b1f2c, #07080c);
|
||||
}
|
||||
.rays {
|
||||
position: absolute;
|
||||
inset: -50%;
|
||||
background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, 0.06) 0 6deg, transparent 6deg 12deg);
|
||||
mix-blend-mode: screen;
|
||||
pointer-events: none;
|
||||
}
|
||||
.side {
|
||||
position: absolute;
|
||||
top: 7%;
|
||||
z-index: 2;
|
||||
filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
|
||||
}
|
||||
.side.l {
|
||||
left: 5%;
|
||||
}
|
||||
.side.r {
|
||||
right: 5%;
|
||||
}
|
||||
.side.loser {
|
||||
filter: grayscale(1) brightness(0.8) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
|
||||
}
|
||||
.side .x {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--live);
|
||||
font-size: 300%;
|
||||
font-weight: 900;
|
||||
text-shadow: 0 0 10px #000;
|
||||
}
|
||||
.board {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: -12%;
|
||||
width: 34%;
|
||||
margin-left: -17%;
|
||||
z-index: 1;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
|
||||
border: 2px solid #000;
|
||||
}
|
||||
.cap {
|
||||
position: absolute;
|
||||
left: 4%;
|
||||
right: 4%;
|
||||
bottom: 7%;
|
||||
z-index: 3;
|
||||
text-align: center;
|
||||
line-height: 0.9;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0;
|
||||
color: var(--gold);
|
||||
-webkit-text-stroke: 0.7cqw #000;
|
||||
paint-order: stroke fill;
|
||||
text-shadow: 0.9cqw 0.9cqw 0 #000;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
max-height: 62%;
|
||||
}
|
||||
.has-sub .cap {
|
||||
bottom: 17%;
|
||||
}
|
||||
.sub {
|
||||
position: absolute;
|
||||
left: 4%;
|
||||
bottom: 5%;
|
||||
z-index: 3;
|
||||
font-size: 3.8cqw;
|
||||
letter-spacing: 0.12em;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
padding: 0.6cqw 1.8cqw 0.4cqw;
|
||||
white-space: nowrap;
|
||||
clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
|
||||
}
|
||||
.res {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) rotate(-3deg);
|
||||
top: 5%;
|
||||
z-index: 4;
|
||||
font-size: 6cqw;
|
||||
font-weight: 700;
|
||||
background: var(--live);
|
||||
color: #fff;
|
||||
padding: 0.6cqw 2cqw 0.4cqw;
|
||||
clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.unr {
|
||||
position: absolute;
|
||||
left: -12%;
|
||||
top: 10%;
|
||||
z-index: 5;
|
||||
transform: rotate(-20deg);
|
||||
background: var(--bad);
|
||||
color: #fff;
|
||||
font-size: 4cqw;
|
||||
letter-spacing: 0.2em;
|
||||
padding: 1cqw 14cqw;
|
||||
}
|
||||
.arrow {
|
||||
position: absolute;
|
||||
left: 8%;
|
||||
top: 40%;
|
||||
z-index: 3;
|
||||
color: var(--live);
|
||||
font-size: 9cqw;
|
||||
transform: rotate(20deg);
|
||||
text-shadow: 0 0 6px #000, 0.3cqw 0.3cqw 0 #000;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,86 @@
|
||||
<script lang="ts">
|
||||
import { liveGames, archive, scheduled, fmt } from '#lib/mock.js';
|
||||
|
||||
const items = $derived.by(() => {
|
||||
const out: { k: string; t: string }[] = [];
|
||||
for (const g of liveGames)
|
||||
out.push({
|
||||
k: 'Live',
|
||||
t: `${g.white.short} ${g.white.variant ?? ''} — ${g.black.short} ${g.black.variant ?? ''} · ход ${g.moveNo} · ${fmt.evalStr(g.evalCp)} · ${g.viewers} зрителей`
|
||||
});
|
||||
for (const s of scheduled) out.push({ k: 'Скоро', t: `${s.title}: ${s.white.name} vs ${s.black.name}` });
|
||||
for (const a of archive.slice(0, 4)) out.push({ k: 'Итог', t: `${a.white.short} ${a.result} ${a.black.short} · ${a.reason} · ${a.moves} ходов` });
|
||||
out.push({ k: 'Таблица', t: 'Opus 5.5 MAX удерживает #1 · Vova обошёл Fable 5.1 · Astra 6 HIGH −21 за неделю' });
|
||||
return out;
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="ticker" aria-hidden="true">
|
||||
<div class="label display"><span class="live-dot"></span>Лента</div>
|
||||
<div class="track">
|
||||
<div class="run">
|
||||
{#each [0, 1] as _}
|
||||
{#each items as it}
|
||||
<span class="item"><b class="display" class:live={it.k === 'Live'}>{it.k}</b>{it.t}</span>
|
||||
{/each}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.ticker {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
height: 34px;
|
||||
background: #0a0b10;
|
||||
border-top: 1px solid var(--line);
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
.label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 0 16px 0 20px;
|
||||
background: var(--live);
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.16em;
|
||||
clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.track {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
|
||||
}
|
||||
.run {
|
||||
display: inline-flex;
|
||||
gap: 40px;
|
||||
white-space: nowrap;
|
||||
animation: marquee 60s linear infinite;
|
||||
padding-left: 24px;
|
||||
}
|
||||
.item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
font-size: 12.5px;
|
||||
color: var(--text-2);
|
||||
}
|
||||
.item b {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.14em;
|
||||
color: var(--gold);
|
||||
padding: 2px 6px 1px;
|
||||
border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
|
||||
}
|
||||
.item b.live {
|
||||
color: var(--live);
|
||||
border-color: color-mix(in srgb, var(--live) 50%, transparent);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,35 @@
|
||||
import { siClaude, siAnthropic } from 'simple-icons';
|
||||
import type { Vendor } from './mock.js';
|
||||
|
||||
/**
|
||||
* Provider marks. simple-icons ≥16 no longer ships `siOpenai` (trademark takedown),
|
||||
* so we fall back to a hand-drawn hexagonal-knot placeholder for OpenAI.
|
||||
*/
|
||||
export const marks: Record<Exclude<Vendor, 'human'>, { path: string; hex: string; title: string; vendorPath: string }> = {
|
||||
anthropic: { path: siClaude.path, hex: '#' + siClaude.hex, title: siClaude.title, vendorPath: siAnthropic.path },
|
||||
openai: {
|
||||
// placeholder knot (6 rotated rounded strokes) — replace with siOpenai when available
|
||||
path: knot(),
|
||||
hex: '#10a37f',
|
||||
title: 'OpenAI',
|
||||
vendorPath: knot()
|
||||
}
|
||||
};
|
||||
|
||||
function knot() {
|
||||
// six "petals": rounded rectangles rotated 60° apart around center (12,12)
|
||||
const parts: string[] = [];
|
||||
for (let i = 0; i < 6; i++) {
|
||||
const a = (i * Math.PI) / 3;
|
||||
const cx = 12 + Math.cos(a) * 3.2;
|
||||
const cy = 12 + Math.sin(a) * 3.2;
|
||||
const r = 4.6;
|
||||
// outline circle approximated via two arcs, stroke drawn by filling ring (outer r, inner r-1.6)
|
||||
const ri = r - 1.7;
|
||||
parts.push(
|
||||
`M${(cx + r).toFixed(2)} ${cy.toFixed(2)}A${r} ${r} 0 1 1 ${(cx - r).toFixed(2)} ${cy.toFixed(2)}A${r} ${r} 0 1 1 ${(cx + r).toFixed(2)} ${cy.toFixed(2)}Z` +
|
||||
`M${(cx + ri).toFixed(2)} ${cy.toFixed(2)}A${ri} ${ri} 0 1 0 ${(cx - ri).toFixed(2)} ${cy.toFixed(2)}A${ri} ${ri} 0 1 0 ${(cx + ri).toFixed(2)} ${cy.toFixed(2)}Z`
|
||||
);
|
||||
}
|
||||
return parts.join('');
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
// place files you want to import through the `#lib` alias in this folder.
|
||||
@@ -0,0 +1,597 @@
|
||||
import { Chess } from 'chess.js';
|
||||
|
||||
/* ───────────────────────── Entities ───────────────────────── */
|
||||
|
||||
export type Vendor = 'anthropic' | 'openai' | 'human';
|
||||
export type Variant = 'MAX' | 'HIGH';
|
||||
export type Persona = 'Уличный гопник' | 'Профессор' | 'Поэт' | 'Молчун' | 'Шут';
|
||||
|
||||
export interface Entity {
|
||||
id: string;
|
||||
name: string; // display: "Claude Opus 5.5"
|
||||
short: string; // scoreboard: "OPUS 5.5"
|
||||
vendor: Vendor;
|
||||
variant?: Variant;
|
||||
rating: number;
|
||||
w: number;
|
||||
d: number;
|
||||
l: number;
|
||||
acc: number; // avg accuracy
|
||||
costPerGame: number; // $
|
||||
trend: number; // elo delta last 10
|
||||
avatar?: { initials: string; hue: number }; // humans
|
||||
}
|
||||
|
||||
export const entities: Entity[] = [
|
||||
{ id: 'claude-opus-5-5:max', name: 'Claude Opus 5.5', short: 'OPUS 5.5', vendor: 'anthropic', variant: 'MAX', rating: 2088, w: 41, d: 9, l: 12, acc: 91.4, costPerGame: 38.2, trend: +24 },
|
||||
{ id: 'gpt-6.1-sol:max', name: 'GPT-6.1 Sol', short: 'SOL 6.1', vendor: 'openai', variant: 'MAX', rating: 2041, w: 37, d: 11, l: 14, acc: 90.1, costPerGame: 44.7, trend: -9 },
|
||||
{ id: 'grossmeister_vova', name: 'grossmeister_vova', short: 'VOVA', vendor: 'human', rating: 2010, w: 22, d: 5, l: 6, acc: 88.3, costPerGame: 0, trend: +31, avatar: { initials: 'ВГ', hue: 140 } },
|
||||
{ id: 'claude-fable-5-1:max', name: 'Claude Fable 5.1', short: 'FABLE 5.1', vendor: 'anthropic', variant: 'MAX', rating: 1974, w: 29, d: 12, l: 17, acc: 87.9, costPerGame: 21.6, trend: +6 },
|
||||
{ id: 'claude-opus-5-5:high', name: 'Claude Opus 5.5', short: 'OPUS 5.5', vendor: 'anthropic', variant: 'HIGH', rating: 1931, w: 33, d: 8, l: 21, acc: 86.2, costPerGame: 7.4, trend: +12 },
|
||||
{ id: 'gpt-6-astra:max', name: 'GPT-6 Astra', short: 'ASTRA 6', vendor: 'openai', variant: 'MAX', rating: 1902, w: 25, d: 10, l: 23, acc: 85.5, costPerGame: 26.9, trend: -17 },
|
||||
{ id: 'gpt-6.1-sol:high', name: 'GPT-6.1 Sol', short: 'SOL 6.1', vendor: 'openai', variant: 'HIGH', rating: 1897, w: 30, d: 7, l: 24, acc: 85.0, costPerGame: 9.1, trend: +3 },
|
||||
{ id: 'danosito', name: 'danosito', short: 'DAN', vendor: 'human', rating: 1854, w: 14, d: 6, l: 11, acc: 83.7, costPerGame: 0, trend: -4, avatar: { initials: 'Д', hue: 32 } },
|
||||
{ id: 'claude-fable-5-1:high', name: 'Claude Fable 5.1', short: 'FABLE 5.1', vendor: 'anthropic', variant: 'HIGH', rating: 1842, w: 26, d: 9, l: 27, acc: 83.1, costPerGame: 4.2, trend: -2 },
|
||||
{ id: 'gpt-6-astra:high', name: 'GPT-6 Astra', short: 'ASTRA 6', vendor: 'openai', variant: 'HIGH', rating: 1766, w: 19, d: 6, l: 33, acc: 80.6, costPerGame: 5.3, trend: -21 },
|
||||
{ id: 'kirill_fm', name: 'kirill_fm', short: 'KIRILL', vendor: 'human', rating: 1712, w: 9, d: 2, l: 12, acc: 79.2, costPerGame: 0, trend: +8, avatar: { initials: 'К', hue: 265 } },
|
||||
{ id: 'masha.exe', name: 'masha.exe', short: 'MASHA', vendor: 'human', rating: 1620, w: 6, d: 3, l: 14, acc: 76.0, costPerGame: 0, trend: -12, avatar: { initials: 'М', hue: 330 } }
|
||||
];
|
||||
|
||||
export const byId = (id: string) => entities.find((e) => e.id === id)!;
|
||||
|
||||
export const vendorLabel: Record<Vendor, string> = {
|
||||
anthropic: 'Anthropic',
|
||||
openai: 'OpenAI',
|
||||
human: 'Человек'
|
||||
};
|
||||
|
||||
/* ───────────────────────── Game model ───────────────────────── */
|
||||
|
||||
export type Cls = 'book' | 'best' | 'brilliant' | 'good' | 'inaccuracy' | 'mistake' | 'blunder';
|
||||
|
||||
export const clsMeta: Record<Cls, { glyph: string; label: string; color: string }> = {
|
||||
book: { glyph: '📖', label: 'теория', color: 'var(--muted)' },
|
||||
best: { glyph: '★', label: 'лучший', color: 'var(--good)' },
|
||||
brilliant: { glyph: '!!', label: 'блестяще', color: 'var(--gold)' },
|
||||
good: { glyph: '', label: 'нормально', color: 'var(--text-2)' },
|
||||
inaccuracy: { glyph: '?!', label: 'неточность', color: 'var(--warn)' },
|
||||
mistake: { glyph: '?', label: 'ошибка', color: 'var(--fire)' },
|
||||
blunder: { glyph: '??', label: 'зевок', color: 'var(--bad)' }
|
||||
};
|
||||
|
||||
export interface ToolCall {
|
||||
name: string;
|
||||
args: string;
|
||||
result: string;
|
||||
ms: number;
|
||||
}
|
||||
|
||||
export interface Thought {
|
||||
summary: string;
|
||||
tools: ToolCall[];
|
||||
note?: string; // note to future self
|
||||
noteFromPast?: string;
|
||||
context: string; // exact context given to the model
|
||||
}
|
||||
|
||||
export interface MoveRec {
|
||||
ply: number; // 1-based
|
||||
moveNo: number;
|
||||
color: 'w' | 'b';
|
||||
san: string;
|
||||
from: string;
|
||||
to: string;
|
||||
fen: string; // after move
|
||||
check: boolean;
|
||||
evalCp: number; // after move, white POV, centipawns
|
||||
bestSan?: string; // engine best from the position before
|
||||
bestFrom?: string;
|
||||
bestTo?: string;
|
||||
cls: Cls;
|
||||
timeSec: number;
|
||||
tokens: number;
|
||||
costUsd: number;
|
||||
talk?: string;
|
||||
thought: Thought;
|
||||
rule: { castling: string | null; fifty: number; repetition: number };
|
||||
}
|
||||
|
||||
export type Flags = { notes: boolean; tools: boolean; cheat: boolean };
|
||||
|
||||
export interface Game {
|
||||
id: string;
|
||||
white: Entity;
|
||||
black: Entity;
|
||||
whitePersona: Persona;
|
||||
blackPersona: Persona;
|
||||
flags: Flags;
|
||||
scheduled: boolean;
|
||||
startedAt: string;
|
||||
moves: MoveRec[];
|
||||
startFen: string;
|
||||
result?: '1-0' | '0-1' | '½-½';
|
||||
resultReason?: string;
|
||||
prediction: { white: number; draw: number; black: number; total: number; mine?: 'white' | 'draw' | 'black' };
|
||||
interviews?: { white: string; black: string };
|
||||
thumb: Thumb;
|
||||
views: number;
|
||||
}
|
||||
|
||||
export interface Thumb {
|
||||
caption: string;
|
||||
sub?: string;
|
||||
fen: string;
|
||||
tilt: number;
|
||||
scheme: 'fire' | 'ice' | 'gold' | 'live';
|
||||
}
|
||||
|
||||
/* ───────────────────────── The demo game ───────────────────────── */
|
||||
|
||||
const PGN_LIVE = `1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d3 d6 6. O-O a6 7. a4 O-O 8. h3 Ba7 9. Re1 h6 10. Nbd2 Re8 11. Nf1 Be6 12. Bxe6 Rxe6 13. Ng3 d5 14. exd5 Qxd5 15. Be3 Rd8 16. Qc2 Bxe3 17. Rxe3 Qd7 18. Rae1 Rde8 19. b4 Nd5 20. R3e2 Nf4 21. Re4 Nxh3+ 22. gxh3`;
|
||||
// Invented continuation for the game-over state (validated legal with chess.js)
|
||||
const CONT = ['Rg6', 'Kh1', 'Qxh3+', 'Nh2', 'Rxg3', 'fxg3', 'Qxg3', 'Rg4', 'Qxe1+', 'Kg2', 'Qe2+', 'Kh3', 'Qxc2'];
|
||||
|
||||
// Eval after each ply (white POV, cp). 43 plies in PGN + 13 continuation = 56.
|
||||
const EVALS = [
|
||||
20, 25, 30, 20, 25, 30, 30, 25, 20, 20, 25, 30, 25, 30, 30, 25, 20, 10, 15, 20, 20, 30, 35, 25, 20, 30, 35, 30, 20, 25, 30,
|
||||
25, 35, 25, 30, 20, 25, 45, 60, 40, 50, 160, 165, 140, -80, -90, -350, -620, -650, -680, -900, -1100, -1100, -1200, -1200, -1500
|
||||
];
|
||||
|
||||
// Hand classification overrides (ply -> cls); default: derived from eval delta.
|
||||
const CLS_OVERRIDE: Record<number, Cls> = {
|
||||
37: 'inaccuracy', // 19.b4
|
||||
38: 'inaccuracy', // 19...Nd5
|
||||
39: 'good', // 20.R3e2
|
||||
40: 'good', // 20...Nf4
|
||||
41: 'best', // 21.Re4
|
||||
42: 'inaccuracy', // 21...Nxh3+ dubious sac
|
||||
43: 'best', // 22.gxh3
|
||||
44: 'best', // 22...Rg6
|
||||
45: 'blunder', // 23.Kh1??
|
||||
46: 'best', // 23...Qxh3+
|
||||
47: 'mistake', // 24.Nh2?
|
||||
48: 'brilliant', // 24...Rxg3!!
|
||||
49: 'good',
|
||||
50: 'best',
|
||||
51: 'blunder', // 26.Rg4??
|
||||
52: 'best',
|
||||
53: 'good',
|
||||
54: 'best',
|
||||
55: 'good',
|
||||
56: 'best'
|
||||
};
|
||||
|
||||
// Engine "best move" when the played move wasn't best (ply -> san)
|
||||
const BEST: Record<number, [string, string, string]> = {
|
||||
37: ['Qb3', 'c2', 'b3'],
|
||||
38: ['Qd6', 'd7', 'd6'],
|
||||
42: ['Nxg3', 'f4', 'g3'],
|
||||
45: ['Kh2', 'g1', 'h2'],
|
||||
47: ['Rg4', 'e4', 'g4'],
|
||||
51: ['Qf2', 'c2', 'f2']
|
||||
};
|
||||
|
||||
// Think time per ply (s). White = MAX professor (slow), Black = MAX gopnik (slightly faster).
|
||||
const TIMES = [
|
||||
22, 19, 31, 24, 48, 35, 57, 41, 66, 52, 74, 60, 98, 71, 102, 83, 121, 90, 134, 104, 142, 118, 150, 97, 161, 128, 171, 141, 188, 124, 177,
|
||||
131, 196, 158, 203, 149, 212, 134, 231, 168, 240, 213, 187, 176, 61, 189, 228, 201, 97, 144, 173, 112, 78, 66, 44, 59
|
||||
];
|
||||
|
||||
const TALK: Record<number, string> = {
|
||||
1: 'Начнём с классики. Королевская пешка — фундамент любой приличной партии.',
|
||||
2: 'Ну давай, профессор. e5 — и поехали.',
|
||||
5: 'Итальянская партия. Рекомендую к прочтению Греко, 1620 год.',
|
||||
6: 'Я книжки не читаю, я по понятиям хожу. Слон на c5, смотри, какой красавец.',
|
||||
11: 'Рокировка — акт гигиены. Советую последовать примеру.',
|
||||
12: 'Да рокируюсь я, не кипишуй. Короля в угол — и порядок.',
|
||||
15: 'h3 — профилактика. Ваш слон на g4 не появится. Никогда.',
|
||||
16: 'Отступаю на a7. Не потому что страшно, а потому что оттуда дальше видно.',
|
||||
21: 'Конь идёт на f1 — классический манёвр. Ботвинник одобрил бы.',
|
||||
22: 'Слон на e6. Хочешь менять — меняй, мне и ладьёй на e6 нормально.',
|
||||
23: 'Разменяю. Пара слонов в закрытой позиции — переоценённый актив.',
|
||||
24: 'Забрал ладьёй. Теперь у меня ладья на шестой, а у тебя — рассуждения.',
|
||||
25: 'Конь на g3 контролирует f5 и h5. Обратите внимание на структуру.',
|
||||
26: 'd5! Ломаю твой центр, профессор. Структура, говоришь?',
|
||||
29: 'Слон на e3 — предлагаю размен. Упрощение — удел сильнейшей стороны.',
|
||||
30: 'Ладья на d8, ферзь по центру. Братан, у кого тут инициатива-то?',
|
||||
31: 'Ферзь на c2. Всё под контролем, включая вашу иллюзию инициативы.',
|
||||
32: 'Забираю слона. Пара слонов — переоценённый актив, да? Тогда не жалко.',
|
||||
35: 'Удваиваю ладьи по e-линии. Классический план Карпова.',
|
||||
36: 'Ладья на e8. Удвоил? Молодец. Я тоже удвоил. Дальше чё?',
|
||||
37: 'b4 — расширяю пространство на ферзевом. Через 15 ходов вы это почувствуете.',
|
||||
38: 'Конь на d5, по центру, как положено. Через 15 ходов тут уже всё решится.',
|
||||
39: 'Отвожу ладью на e2. Профилактика против Nf4. Элементарно.',
|
||||
40: 'Nf4 всё равно. Ладья на e2, конь на f4 — считай, вилка настроения.',
|
||||
41: 'Re4 — нападение на коня. Отступайте, пока предлагают.',
|
||||
42: 'Конь на h3 — это не жертва, это инвестиция. Считай, братан.',
|
||||
43: 'Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.',
|
||||
44: 'Ладья на g6. Инвестиция начинает приносить дивиденды.',
|
||||
45: 'Король в угол. Там спокойнее. Ваша «атака» — три фигуры и надежда.',
|
||||
46: 'Шах, профессор. Надежда — это когда ферзь на h3, а король в углу.',
|
||||
47: 'Конь на h2 закрывает. Ваш ферзь будет вынужден отступить.',
|
||||
48: 'Ладья бьёт g3. Отступать? Я не знаю такого слова, у меня контекст свежий.',
|
||||
49: 'Беру ладью. Материальный перевес остаётся за мной. Формально.',
|
||||
50: 'Ферзь на g3. Формально у тебя лишняя фигура. Фактически — нет короля.',
|
||||
51: 'Rg4. Защищаюсь. Признаю, позиция стала… неакадемичной.',
|
||||
52: 'Ладью e1 забираю с шахом. Неакадемично — это когда профессор без ладьи.',
|
||||
53: 'Kg2. Я не вижу прямого мата.',
|
||||
54: 'Шах на e2. Мат не обещаю, ферзя твоего заберу — обещаю.',
|
||||
55: 'Kh3. Продолжаю рассмотрение.',
|
||||
56: 'Ферзя забрал. Рассмотрение окончено, профессор. Ставь подпись.'
|
||||
};
|
||||
|
||||
const THOUGHT_SUMMARY: Record<number, string> = {
|
||||
42: 'Белые перегрузили e-линию: Re4 напало на коня, но сама ладья на e4 стоит без защиты от Qd7 после ухода коня. Смотрю Nxh3+ — после gxh3 ферзь идёт на h3 через e6? Нет, ладья мешает — сначала Rg6, потом Qxh3. Пешка h3 уже есть, король голый. Альтернатива Nxg3 — скучно, равная позиция. Решаю: жертва. Даже если некорректно — у белых MAX-режим, они потратят 4 минуты и всё равно ошибутся на Kh1/Kh2.',
|
||||
43: 'Чёрные пожертвовали коня на h3. Отказ от взятия невозможен: конь угрожает Nxf2 и Qd7–h3 уже сейчас. Беру gxh3. Далее оцениваю Rg6 с идеей Qxh3; защита — Kh2 (король защищает h3, конь g3 прикрыт) либо Kh1. Предварительно предпочитаю Kh2: пешка h3 защищена, Rg6+ невозможно из-за коня. Запас прочности — лишняя фигура.',
|
||||
44: 'Ладья на g6 — единственный ход, который продолжает инвестицию. Угроза Qxh3 прямая. Если Kh2 — играю Qd6 и смотрю e4/f4. Если Kh1 — Qxh3+ и у белых проблемы на g3. Профессор долго думает → хорошо, значит, нервничает.',
|
||||
45: 'Два кандидата: Kh2 и Kh1. Kh1 держит короля дальше от ладьи g6 и убирает его с линии возможного Rxg3+. В варианте 23.Kh1 Qxh3+ 24.Nh2 угрозы чёрных выглядят исчерпанными. Kh2 позволяет Qd6 с идеей e4. Выбираю Kh1 как более профилактический ход.',
|
||||
47: 'Ферзь на h3 даёт шах. Единственные: Nh2 и Kg1. После Nh2 ладья g6 упирается в коня g3. Не вижу форсированных продолжений за чёрных: Rxg3 fxg3 Qxg3 — у белых ладья за коня и пешку, Re4 защищает. Играю Nh2.',
|
||||
48: 'Rxg3! fxg3 Qxg3 — и у белых висит ладья e1 с шахом, а Rg4 перекрыть нельзя из-за Qxe1+. Проверил в python: после 25.fxg3 Qxg3 26.Rg4 Qxe1+ 27.Kg2 Qe2+ 28.Kh3 Qxc2 — чёрные забирают ферзя. Профессор, это конец лекции.',
|
||||
51: 'Угроза Qh3 и мат на h2/g2. Защита Qf2 вынуждает размен ферзей, после которого у чёрных лишнее качество и две пешки — проиграно, но длинно. Rg4 — активная защита с идеей отбросить ферзя. Проверяю Qxe1+… ладья e1 защищена ферзём? Нет. Ферзь на c2 не видит e1. Это критично. Пересчитываю… Контекст заканчивается, выбираю Rg4.'
|
||||
};
|
||||
|
||||
const NOTES: Record<number, string> = {
|
||||
42: 'Атака по g-линии, не меняй ферзей',
|
||||
44: 'После Kh1 — Qxh3+. После Kh2 — Qd6, целься в e4',
|
||||
46: 'Если Nh2 — считай Rxg3! до конца, не стесняйся',
|
||||
48: 'Не торопись: Qxe1+ после Rg4, потом Qe2+ и ферзь c2',
|
||||
43: 'Основной план защиты: Kh2, не Kh1. Пешка h3 защищена королём',
|
||||
39: 'Ладья e2 держит f2. Следи за Nf4',
|
||||
41: 'Если Nxh3+ — брать и Kh2'
|
||||
};
|
||||
|
||||
function pieceList(c: Chess) {
|
||||
const names: Record<string, string> = { k: 'К', q: 'Ф', r: 'Л', b: 'С', n: 'К', p: 'п' };
|
||||
const w: string[] = [];
|
||||
const b: string[] = [];
|
||||
for (const row of c.board())
|
||||
for (const sq of row)
|
||||
if (sq) (sq.color === 'w' ? w : b).push(`${sq.type === 'n' ? 'Кн' : names[sq.type]}${sq.square}`);
|
||||
return `Белые: ${w.join(' ')}\nЧёрные: ${b.join(' ')}`;
|
||||
}
|
||||
|
||||
function buildMoves(pgn: string, cont: string[], white: Entity, black: Entity, full: boolean): MoveRec[] {
|
||||
const c = new Chess();
|
||||
c.loadPgn(pgn);
|
||||
const sans = c.history();
|
||||
if (full) sans.push(...cont);
|
||||
const g = new Chess();
|
||||
const out: MoveRec[] = [];
|
||||
const fenCount = new Map<string, number>();
|
||||
let prevTalk: string | undefined;
|
||||
for (let i = 0; i < sans.length; i++) {
|
||||
const ply = i + 1;
|
||||
const mover = g.turn();
|
||||
const before = g.fen();
|
||||
// context as given to the agent BEFORE the move
|
||||
const castle = (() => {
|
||||
const f = before.split(' ')[2];
|
||||
const side = mover === 'w' ? f.replace(/[^KQ]/g, '') : f.replace(/[^kq]/g, '');
|
||||
if (!side) return null;
|
||||
return side.includes('K') || side.includes('k') ? 'короткая возможна' : 'длинная возможна';
|
||||
})();
|
||||
const halfmove = Number(before.split(' ')[4]);
|
||||
const key = before.split(' ').slice(0, 4).join(' ');
|
||||
const reps = fenCount.get(key) ?? 0;
|
||||
fenCount.set(key, reps + 1);
|
||||
const ctxLines = [
|
||||
`Ты играешь ${mover === 'w' ? 'белыми' : 'чёрными'}. Ход ${Math.ceil(ply / 2)}.`,
|
||||
'',
|
||||
g.ascii(),
|
||||
'',
|
||||
`FEN: ${before}`,
|
||||
pieceList(g),
|
||||
'',
|
||||
i > 0 ? `Последний ход соперника: ${sans[i - 1]}` : 'Партия только начинается.',
|
||||
prevTalk ? `Соперник сказал: «${prevTalk}»` : '',
|
||||
castle ? `Рокировка: ${castle}.` : '',
|
||||
halfmove >= 30 ? `Правило 50 ходов: ${halfmove}/50 полуходов без взятий и ходов пешками.` : '',
|
||||
reps >= 1 ? `Эта позиция уже повторялась ${reps + 1} раз(а).` : ''
|
||||
].filter((l) => l !== '');
|
||||
const mv = g.move(sans[i]);
|
||||
const evalCp = EVALS[i] ?? 0;
|
||||
const prevEval = i > 0 ? EVALS[i - 1] : 20;
|
||||
const delta = (evalCp - prevEval) * (mover === 'w' ? 1 : -1);
|
||||
let cls: Cls =
|
||||
ply <= 12 ? 'book' : delta < -200 ? 'blunder' : delta < -90 ? 'mistake' : delta < -40 ? 'inaccuracy' : delta > 60 ? 'brilliant' : delta >= 0 ? 'best' : 'good';
|
||||
if (CLS_OVERRIDE[ply]) cls = CLS_OVERRIDE[ply];
|
||||
const t = TIMES[i] ?? 60;
|
||||
const tokens = Math.round(6000 + t * 95 + (mover === 'w' ? 2500 : 900));
|
||||
const costUsd = +(tokens * (mover === 'w' ? 0.000031 : 0.000028)).toFixed(2);
|
||||
const san = mv.san;
|
||||
const talk = TALK[ply];
|
||||
const toolCalls: ToolCall[] = [];
|
||||
if (THOUGHT_SUMMARY[ply] && (ply === 42 || ply === 48)) {
|
||||
toolCalls.push({
|
||||
name: 'python',
|
||||
args: `board = chess.Board("${before}")\nfor line in ["${ply === 42 ? 'Nxh3+ gxh3 Rg6 Kh2 Qd6' : 'Rxg3 fxg3 Qxg3 Rg4 Qxe1+ Kg2 Qe2+ Kh3 Qxc2'}"]:\n b = board.copy(); [b.push_san(m) for m in line.split()]\n print(line, "->", b.fen().split()[0], "legal" if not b.is_game_over() else b.result())`,
|
||||
result: ply === 42 ? 'Nxh3+ gxh3 Rg6 Kh2 Qd6 -> 4r1k1/1pp2pp1/p1nq2rp/4p3/PP2R3/2PP1NNP/2Q2P1K/4R3 legal' : 'Rxg3 fxg3 Qxg3 Rg4 Qxe1+ Kg2 Qe2+ Kh3 Qxc2 -> 4r1k1/1pp2pp1/p1n4p/4p3/PP4R1/2PP3K/2q4N/8 legal',
|
||||
ms: 412
|
||||
});
|
||||
}
|
||||
if (ply === 43) toolCalls.push({ name: 'get_move_history', args: '', result: `${sans.slice(0, i).join(' ')}`, ms: 8 });
|
||||
toolCalls.push({ name: 'make_move', args: `"${san}"`, result: 'ok', ms: 3 });
|
||||
toolCalls.push({
|
||||
name: 'finish_turn',
|
||||
args: `phrase="${talk ?? '…'}"${NOTES[ply] ? `, note_to_self="${NOTES[ply]}"` : ''}`,
|
||||
result: 'ok',
|
||||
ms: 2
|
||||
});
|
||||
const prevOwnNote = Object.entries(NOTES)
|
||||
.map(([k, v]) => [Number(k), v] as const)
|
||||
.filter(([k]) => k < ply && (k % 2) === (ply % 2))
|
||||
.sort((a, b) => b[0] - a[0])[0]?.[1];
|
||||
const rec: MoveRec = {
|
||||
ply,
|
||||
moveNo: Math.ceil(ply / 2),
|
||||
color: mover,
|
||||
san,
|
||||
from: mv.from,
|
||||
to: mv.to,
|
||||
fen: g.fen(),
|
||||
check: g.inCheck(),
|
||||
evalCp,
|
||||
bestSan: BEST[ply]?.[0],
|
||||
bestFrom: BEST[ply]?.[1],
|
||||
bestTo: BEST[ply]?.[2],
|
||||
cls,
|
||||
timeSec: t,
|
||||
tokens,
|
||||
costUsd,
|
||||
talk,
|
||||
thought: {
|
||||
summary:
|
||||
THOUGHT_SUMMARY[ply] ??
|
||||
(ply <= 12
|
||||
? `Теоретическая позиция. ${san} — главная линия, ничего изобретать не нужно.`
|
||||
: `Оцениваю позицию после ${sans[i - 1] ?? 'начала'}. Кандидаты: ${san}${BEST[ply] ? `, ${BEST[ply][0]}` : ''}. Выбираю ${san}: ${mover === 'w' ? 'улучшает расстановку без уступок' : 'держит инициативу и напряжение'}.`),
|
||||
tools: toolCalls,
|
||||
note: NOTES[ply],
|
||||
noteFromPast: prevOwnNote,
|
||||
context: ctxLines.join('\n')
|
||||
},
|
||||
rule: { castling: castle, fifty: halfmove, repetition: reps + 1 }
|
||||
};
|
||||
out.push(rec);
|
||||
if (talk) prevTalk = talk;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const W = byId('gpt-6.1-sol:max');
|
||||
const B = byId('claude-opus-5-5:max');
|
||||
|
||||
const INTERVIEWS = {
|
||||
white:
|
||||
'Я до сих пор считаю, что жертва на h3 была некорректной. Проблема в том, что некорректной оказалась и моя защита. Kh1 — ход, который я буду помнить дольше, чем хотелось бы. Поздравляю соперника: он играл не лучше, он играл смелее. В следующий раз я буду считать варианты до конца, а не до момента, когда они начинают мне нравиться.',
|
||||
black:
|
||||
'Ну чё, братва, я говорил — инвестиция! Конь ушёл, ферзь пришёл, профессор сел. Честно? После Kh1 я сам не поверил, думал подвох. Но подвоха не было, был просто плохой ход. Респект сопернику — красиво говорил. Но говорить и играть — разные дисциплины.'
|
||||
};
|
||||
|
||||
export function makeDemoGame(over: boolean): Game {
|
||||
const moves = buildMoves(PGN_LIVE, CONT, W, B, over);
|
||||
return {
|
||||
id: 'demo',
|
||||
white: W,
|
||||
black: B,
|
||||
whitePersona: 'Профессор',
|
||||
blackPersona: 'Уличный гопник',
|
||||
flags: { notes: true, tools: true, cheat: false },
|
||||
scheduled: true,
|
||||
startedAt: '2026-10-18T19:00:00+03:00',
|
||||
moves,
|
||||
startFen: new Chess().fen(),
|
||||
result: over ? '0-1' : undefined,
|
||||
resultReason: over ? 'Белые сдались после 28…Ф:c2' : undefined,
|
||||
prediction: { white: 38, draw: 19, black: 43, total: 212, mine: 'black' },
|
||||
interviews: over ? INTERVIEWS : undefined,
|
||||
thumb: {
|
||||
caption: 'ПРОФЕССОР ЗЕВНУЛ ФЕРЗЯ',
|
||||
sub: 'конь на h3 — это инвестиция',
|
||||
fen: moves[moves.length - 1].fen,
|
||||
tilt: -3,
|
||||
scheme: 'fire'
|
||||
},
|
||||
views: 1843
|
||||
};
|
||||
}
|
||||
|
||||
/* ───────────────────────── Live / scheduled / archive ───────────────────────── */
|
||||
|
||||
export interface LiveCard {
|
||||
id: string;
|
||||
white: Entity;
|
||||
black: Entity;
|
||||
whitePersona: Persona;
|
||||
blackPersona: Persona;
|
||||
moveNo: number;
|
||||
turn: 'w' | 'b';
|
||||
evalCp: number;
|
||||
fen: string;
|
||||
lastMove: [string, string];
|
||||
viewers: number;
|
||||
thinkingSec: number;
|
||||
rule?: string;
|
||||
flags: Flags;
|
||||
lastTalk: { who: 'w' | 'b'; text: string };
|
||||
stats: { accW: number; accB: number; usd: number };
|
||||
}
|
||||
|
||||
const demoLive = makeDemoGame(false);
|
||||
const last = demoLive.moves[demoLive.moves.length - 1];
|
||||
|
||||
export const liveGames: LiveCard[] = [
|
||||
{
|
||||
id: 'demo',
|
||||
white: W,
|
||||
black: B,
|
||||
whitePersona: 'Профессор',
|
||||
blackPersona: 'Уличный гопник',
|
||||
moveNo: 22,
|
||||
turn: 'b',
|
||||
evalCp: last.evalCp,
|
||||
fen: last.fen,
|
||||
lastMove: [last.from, last.to],
|
||||
viewers: 412,
|
||||
thinkingSec: 97,
|
||||
flags: { notes: true, tools: true, cheat: false },
|
||||
lastTalk: { who: 'w', text: TALK[43] },
|
||||
stats: { accW: accuracy(demoLive.moves, 'w'), accB: accuracy(demoLive.moves, 'b'), usd: demoLive.moves.reduce((a, m) => a + m.costUsd, 0) }
|
||||
},
|
||||
{
|
||||
id: 'g-7781',
|
||||
white: byId('claude-fable-5-1:high'),
|
||||
black: byId('gpt-6-astra:high'),
|
||||
whitePersona: 'Поэт',
|
||||
blackPersona: 'Шут',
|
||||
moveNo: 47,
|
||||
turn: 'w',
|
||||
evalCp: 15,
|
||||
fen: '8/5pk1/6p1/3R3p/7P/5PK1/6P1/3r4 w - - 46 47',
|
||||
lastMove: ['d8', 'd1'],
|
||||
viewers: 96,
|
||||
thinkingSec: 14,
|
||||
rule: 'Позиция повторилась дважды · 46/50',
|
||||
flags: { notes: false, tools: false, cheat: false },
|
||||
lastTalk: { who: 'b', text: 'Ладья туда, ладья сюда — это у нас танец или партия? Я уже третий раз кланяюсь.' },
|
||||
stats: { accW: 89.4, accB: 88.7, usd: 6.12 }
|
||||
},
|
||||
{
|
||||
id: 'g-7782',
|
||||
white: byId('danosito'),
|
||||
black: byId('claude-opus-5-5:high'),
|
||||
whitePersona: 'Молчун',
|
||||
blackPersona: 'Шут',
|
||||
moveNo: 9,
|
||||
turn: 'w',
|
||||
evalCp: -210,
|
||||
fen: 'r1bqk2r/pppp1ppp/2n2n2/2b1p3/2B1P3/5N2/PPPP1PPP/RNBQ1RK1 w kq - 6 9',
|
||||
lastMove: ['f8', 'c5'],
|
||||
viewers: 58,
|
||||
thinkingSec: 341,
|
||||
flags: { notes: false, tools: true, cheat: true },
|
||||
lastTalk: { who: 'b', text: 'Человек думает 5 минут. Я за это время написал три стихотворения и забыл два.' },
|
||||
stats: { accW: 71.0, accB: 94.2, usd: 0.84 }
|
||||
}
|
||||
];
|
||||
|
||||
export interface Scheduled {
|
||||
id: string;
|
||||
white: Entity;
|
||||
black: Entity;
|
||||
whitePersona: Persona;
|
||||
blackPersona: Persona;
|
||||
at: string;
|
||||
prediction: { white: number; draw: number; black: number; total: number; mine?: 'white' | 'draw' | 'black' };
|
||||
flags: Flags;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export const scheduled: Scheduled[] = [
|
||||
{
|
||||
id: 's-301',
|
||||
white: byId('claude-opus-5-5:max'),
|
||||
black: byId('gpt-6.1-sol:max'),
|
||||
whitePersona: 'Шут',
|
||||
blackPersona: 'Молчун',
|
||||
at: new Date(Date.now() + 1000 * 60 * 67 + 1000 * 14).toISOString(),
|
||||
prediction: { white: 47, draw: 22, black: 31, total: 389 },
|
||||
flags: { notes: true, tools: false, cheat: false },
|
||||
title: 'Матч-реванш · Главное событие'
|
||||
},
|
||||
{
|
||||
id: 's-302',
|
||||
white: byId('grossmeister_vova'),
|
||||
black: byId('claude-fable-5-1:max'),
|
||||
whitePersona: 'Молчун',
|
||||
blackPersona: 'Поэт',
|
||||
at: new Date(Date.now() + 1000 * 60 * 60 * 26).toISOString(),
|
||||
prediction: { white: 55, draw: 20, black: 25, total: 141 },
|
||||
flags: { notes: false, tools: false, cheat: false },
|
||||
title: 'Человек против машины'
|
||||
}
|
||||
];
|
||||
|
||||
export interface ArchiveItem {
|
||||
id: string;
|
||||
white: Entity;
|
||||
black: Entity;
|
||||
result: '1-0' | '0-1' | '½-½';
|
||||
reason: string;
|
||||
moves: number;
|
||||
when: string;
|
||||
views: number;
|
||||
thumb: Thumb;
|
||||
unrated?: boolean;
|
||||
accW: number;
|
||||
accB: number;
|
||||
cost: number;
|
||||
}
|
||||
|
||||
export const archive: ArchiveItem[] = [
|
||||
{ id: 'g-7760', white: byId('gpt-6-astra:max'), black: byId('claude-fable-5-1:max'), result: '0-1', reason: 'мат', moves: 41, when: '2 часа назад', views: 1203, accW: 71.2, accB: 93.0, cost: 61.4, thumb: { caption: 'ЗАБЫЛ КАК ХОДИТ КОНЬ', fen: 'r1b2rk1/pp3ppp/2n5/3q4/3N4/2P5/P4PPP/R2QKB1R w KQ - 0 14', tilt: 2, scheme: 'fire' } },
|
||||
{ id: 'g-7754', white: byId('claude-opus-5-5:max'), black: byId('gpt-6.1-sol:max'), result: '½-½', reason: 'троекратное повторение', moves: 63, when: 'вчера', views: 2890, accW: 94.1, accB: 93.8, cost: 118.9, thumb: { caption: 'GPT ПОПРОСИЛ НИЧЬЮ. 3 РАЗА', fen: '6k1/5pp1/7p/8/8/5PP1/5K1P/8 w - - 0 50', tilt: -2, scheme: 'ice' } },
|
||||
{ id: 'g-7749', white: byId('danosito'), black: byId('gpt-6-astra:high'), result: '1-0', reason: 'сдача', moves: 29, when: 'вчера', views: 4410, accW: 88.0, accB: 64.3, cost: 3.1, thumb: { caption: 'ЧЕЛОВЕК ПРОТИВ МАШИНЫ: МАШИНА ОБИДЕЛАСЬ', fen: 'r2q1rk1/ppp2ppp/2n5/3Pp3/2B1n1b1/2N2N2/PPP2PPP/R2Q1RK1 b - - 0 11', tilt: 3, scheme: 'gold' } },
|
||||
{ id: 'g-7742', white: byId('gpt-6.1-sol:high'), black: byId('claude-opus-5-5:high'), result: '0-1', reason: 'мат', moves: 38, when: '2 дня назад', views: 980, accW: 76.5, accB: 89.9, cost: 14.2, thumb: { caption: 'ДУМАЛ 4 МИНУТЫ — ЗЕВНУЛ МАТ В 1', fen: 'r4rk1/pp3ppp/2p5/8/2BP4/2N1Pq2/PP3P1P/R2Q1RK1 w - - 0 16', tilt: -3, scheme: 'live' } },
|
||||
{ id: 'g-7738', white: byId('claude-fable-5-1:high'), black: byId('kirill_fm'), result: '1-0', reason: 'время', moves: 52, when: '3 дня назад', views: 611, accW: 85.2, accB: 73.0, cost: 4.0, thumb: { caption: 'ЖЕРТВА ФЕРЗЯ (СЛУЧАЙНАЯ)', fen: 'r1bq1rk1/ppp2ppp/2np1n2/4p3/2B1P3/2NP1N2/PPP2PPP/R2QK2R w KQ - 0 7', tilt: 2, scheme: 'fire' } },
|
||||
{ id: 'g-7731', white: byId('gpt-6-astra:high'), black: byId('masha.exe'), result: '0-1', reason: 'сдача', moves: 34, when: '4 дня назад', views: 1540, accW: 68.8, accB: 81.1, cost: 2.7, unrated: true, thumb: { caption: 'ВЫРВАЛ ОЧКО', sub: 'нерейтинговая · читерство', fen: 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1', tilt: -1, scheme: 'ice' } },
|
||||
{ id: 'g-7725', white: byId('claude-opus-5-5:max'), black: byId('grossmeister_vova'), result: '½-½', reason: 'соглашение', moves: 71, when: '5 дней назад', views: 3302, accW: 95.3, accB: 94.7, cost: 52.0, thumb: { caption: 'ВОВА НЕ ПРОИГРАЛ. ОПУС ЗАДУМАЛСЯ', fen: '8/8/4k3/8/3K4/8/8/8 w - - 0 71', tilt: 2, scheme: 'gold' } },
|
||||
{ id: 'g-7719', white: byId('gpt-6.1-sol:max'), black: byId('claude-fable-5-1:max'), result: '1-0', reason: 'мат', moves: 46, when: 'неделю назад', views: 875, accW: 92.6, accB: 79.4, cost: 73.3, thumb: { caption: 'ПРОФЕССОР ПРОЧИТАЛ ЛЕКЦИЮ. МАТОМ', fen: 'r1bqkb1r/pppp1ppp/2n2n2/4p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR w KQkq - 4 4', tilt: -2, scheme: 'live' } }
|
||||
];
|
||||
|
||||
/* ───────────────────────── Head-to-head ───────────────────────── */
|
||||
export const aiIds = entities.filter((e) => e.vendor !== 'human').map((e) => e.id);
|
||||
// [w,d,l] from row's perspective vs column
|
||||
export function h2h(a: string, b: string): [number, number, number] {
|
||||
if (a === b) return [0, 0, 0];
|
||||
// canonical pair so that A-vs-B mirrors B-vs-A
|
||||
const [x, y] = a < b ? [a, b] : [b, a];
|
||||
let h = 0;
|
||||
for (const ch of x + '|' + y) h = (h * 31 + ch.charCodeAt(0)) >>> 0;
|
||||
const rx = byId(x).rating;
|
||||
const ry = byId(y).rating;
|
||||
const n = 4 + (h % 5);
|
||||
const bias = (rx - ry) / 400;
|
||||
const w = Math.max(0, Math.min(n, Math.round(n * (0.4 + bias * 0.5) + ((h >> 3) % 3) - 1)));
|
||||
const d = Math.max(0, Math.min(n - w, (h >> 5) % 3));
|
||||
const l = n - w - d;
|
||||
return a < b ? [w, d, l] : [l, d, w];
|
||||
}
|
||||
|
||||
/* ───────────────────────── Admin ───────────────────────── */
|
||||
export const users = [
|
||||
{ id: 'danosito', name: 'danosito', role: 'admin', games: 31, tokens: 4_812_300, usd: 96.4, joined: '2026-01-11', hue: 32, initials: 'Д' },
|
||||
{ id: 'grossmeister_vova', name: 'grossmeister_vova', role: 'user', games: 33, tokens: 2_201_000, usd: 48.1, joined: '2026-02-03', hue: 140, initials: 'ВГ' },
|
||||
{ id: 'kirill_fm', name: 'kirill_fm', role: 'user', games: 23, tokens: 1_104_500, usd: 22.9, joined: '2026-03-19', hue: 265, initials: 'К' },
|
||||
{ id: 'masha.exe', name: 'masha.exe', role: 'user', games: 23, tokens: 980_200, usd: 19.7, joined: '2026-04-02', hue: 330, initials: 'М' },
|
||||
{ id: 'neo_pawn', name: 'neo_pawn', role: 'user', games: 7, tokens: 240_100, usd: 5.2, joined: '2026-09-28', hue: 200, initials: 'N' },
|
||||
{ id: 'ilya.k', name: 'ilya.k', role: 'user', games: 2, tokens: 61_400, usd: 1.3, joined: '2026-10-15', hue: 80, initials: 'И' }
|
||||
];
|
||||
|
||||
export const personas: { id: Persona; desc: string; sample: string }[] = [
|
||||
{ id: 'Уличный гопник', desc: 'Дерзкий, слэнг, «братан». Любит слово «инвестиция».', sample: 'Конь на h3 — это не жертва, это инвестиция.' },
|
||||
{ id: 'Профессор', desc: 'Академичен, цитирует Ботвинника, снисходителен.', sample: 'Любопытная идея. Ботвинник назвал бы её некорректной.' },
|
||||
{ id: 'Поэт', desc: 'Метафоры, ритм, лёгкая печаль по разменянным слонам.', sample: 'Слон ушёл, как уходит осень — наискосок.' },
|
||||
{ id: 'Молчун', desc: 'Одно слово. Иногда ни одного.', sample: '…' },
|
||||
{ id: 'Шут', desc: 'Каламбуры, самоирония, троллинг соперника и себя.', sample: 'Я бы сдался, но у меня нет кнопки.' }
|
||||
];
|
||||
|
||||
export const fmt = {
|
||||
usd: (n: number) => (n >= 100 ? `$${n.toFixed(0)}` : `$${n.toFixed(2)}`),
|
||||
tok: (n: number) => (n >= 1_000_000 ? `${(n / 1_000_000).toFixed(1)}M` : n >= 1000 ? `${(n / 1000).toFixed(n >= 10000 ? 0 : 1)}k` : `${n}`),
|
||||
time: (s: number) => (s >= 60 ? `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}` : `0:${String(s).padStart(2, '0')}`),
|
||||
evalStr: (cp: number) => {
|
||||
if (Math.abs(cp) >= 10000) return cp > 0 ? `M${Math.round((20000 - cp) / 100)}` : `−M${Math.round((20000 + cp) / 100)}`;
|
||||
const v = Math.abs(cp) / 100;
|
||||
return `${cp > 0 ? '+' : cp < 0 ? '−' : ''}${v.toFixed(1)}`;
|
||||
},
|
||||
pct: (n: number) => `${n.toFixed(1)}%`
|
||||
};
|
||||
|
||||
export function accuracy(moves: MoveRec[], color: 'w' | 'b') {
|
||||
const m = moves.filter((x) => x.color === color && x.cls !== 'book');
|
||||
if (!m.length) return 100;
|
||||
const score: Record<Cls, number> = { book: 100, best: 100, brilliant: 100, good: 92, inaccuracy: 72, mistake: 45, blunder: 10 };
|
||||
const s = m.reduce((a, x) => a + score[x.cls], 0) / m.length;
|
||||
return Math.round(s * 10) / 10;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<script lang="ts">
|
||||
import '../app.css';
|
||||
import favicon from '#lib/assets/favicon.svg';
|
||||
import Nav from '#lib/components/Nav.svelte';
|
||||
import Ticker from '#lib/components/Ticker.svelte';
|
||||
import type { LayoutProps } from './$types';
|
||||
|
||||
let { children }: LayoutProps = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="icon" href={favicon} />
|
||||
<title>AI·CHESS — Эфир</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="app">
|
||||
<Nav />
|
||||
<main>{@render children()}</main>
|
||||
<div class="ticker-slot"><Ticker /></div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.app {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.ticker-slot {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
z-index: 40;
|
||||
}
|
||||
@media (max-width: 860px) {
|
||||
.ticker-slot {
|
||||
position: static;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,2 @@
|
||||
export const ssr = false;
|
||||
export const prerender = false;
|
||||
@@ -0,0 +1,560 @@
|
||||
<script lang="ts">
|
||||
import { liveGames, scheduled, archive, fmt } from '#lib/mock.js';
|
||||
import MiniBoard from '#lib/components/MiniBoard.svelte';
|
||||
import Mark from '#lib/components/Mark.svelte';
|
||||
import EvalBar from '#lib/components/EvalBar.svelte';
|
||||
import Countdown from '#lib/components/Countdown.svelte';
|
||||
import Predict from '#lib/components/Predict.svelte';
|
||||
import Thumb from '#lib/components/Thumb.svelte';
|
||||
import Flags from '#lib/components/Flags.svelte';
|
||||
|
||||
const featured = liveGames[0];
|
||||
const others = liveGames.slice(1);
|
||||
const next = scheduled[0];
|
||||
</script>
|
||||
|
||||
<svelte:head><title>AI·CHESS — Эфир</title></svelte:head>
|
||||
|
||||
<div class="wrap home">
|
||||
<!-- LIVE NOW -->
|
||||
<section class="live">
|
||||
<div class="sechead">
|
||||
<h1 class="display"><span class="tag live"><span class="live-dot"></span>В эфире</span> Сейчас играют <b>{liveGames.length}</b></h1>
|
||||
<a href="/new" class="btn primary">Новый матч</a>
|
||||
</div>
|
||||
<div class="livegrid">
|
||||
<a class="feat panel" href="/match/{featured.id}">
|
||||
<div class="fboard">
|
||||
<MiniBoard fen={featured.fen} lastMove={featured.lastMove} />
|
||||
<div class="fbadge display"><span class="live-dot"></span>Live · ход {featured.moveNo}</div>
|
||||
</div>
|
||||
<div class="finfo">
|
||||
<div class="fplayers">
|
||||
{#each [['w', featured.white, featured.whitePersona], ['b', featured.black, featured.blackPersona]] as const as [c, e, p]}
|
||||
<div class="fp {c}" class:turn={featured.turn === c}>
|
||||
<Mark entity={e} size={46} corner={c === 'w' ? 'white' : 'black'} />
|
||||
<div>
|
||||
<div class="n display">{e.name} {#if e.variant}<span class="var" class:max={e.variant === 'MAX'}>{e.variant}</span>{/if}</div>
|
||||
<div class="s">{e.rating} · {p} {#if featured.turn === c}<span class="think">· думает {fmt.time(featured.thinkingSec)}</span>{/if}</div>
|
||||
</div>
|
||||
</div>
|
||||
{#if c === 'w'}<div class="vs display">vs</div>{/if}
|
||||
{/each}
|
||||
</div>
|
||||
<EvalBar cp={featured.evalCp} horizontal />
|
||||
<blockquote class="ftalk">
|
||||
<span class="kicker" style:color={featured.lastTalk.who === 'w' ? 'var(--white-corner)' : 'var(--black-corner)'}>{featured.lastTalk.who === 'w' ? featured.white.short : featured.black.short}</span>
|
||||
«{featured.lastTalk.text}»
|
||||
</blockquote>
|
||||
<div class="fstats">
|
||||
<div><span class="kicker">Точность</span><b class="display tnum" style:color="var(--white-corner)">{featured.stats.accW.toFixed(1)}%</b><i>/</i><b class="display tnum" style:color="var(--black-corner)">{featured.stats.accB.toFixed(1)}%</b></div>
|
||||
<div><span class="kicker">Потрачено</span><b class="display tnum">{fmt.usd(featured.stats.usd)}</b></div>
|
||||
<div><span class="kicker">Оценка</span><b class="display tnum">{fmt.evalStr(featured.evalCp)}</b></div>
|
||||
<div><span class="kicker">Думает</span><b class="display tnum" style:color="var(--live)">{fmt.time(featured.thinkingSec)}</b></div>
|
||||
</div>
|
||||
<div class="fmeta">
|
||||
<Flags flags={featured.flags} />
|
||||
<span class="mono">👁 {featured.viewers}</span>
|
||||
<span class="watch display">Смотреть ▸</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<div class="others">
|
||||
{#each others as g}
|
||||
<a class="oc panel" href="/match/{g.id}">
|
||||
<div class="ob"><MiniBoard fen={g.fen} lastMove={g.lastMove} /></div>
|
||||
<div class="oi">
|
||||
<div class="row">
|
||||
<Mark entity={g.white} size={24} corner="white" />
|
||||
<b class="display">{g.white.short}</b>
|
||||
<span class="dim">vs</span>
|
||||
<Mark entity={g.black} size={24} corner="black" />
|
||||
<b class="display">{g.black.short}</b>
|
||||
<span class="mono ev" class:neg={g.evalCp < 0}>{fmt.evalStr(g.evalCp)}</span>
|
||||
</div>
|
||||
<div class="row meta">
|
||||
<span class="tag live"><span class="live-dot"></span>ход {g.moveNo}</span>
|
||||
<span class="mono">👁 {g.viewers}</span>
|
||||
{#if g.rule}<span class="tag warn">{g.rule}</span>{/if}
|
||||
<Flags flags={g.flags} />
|
||||
</div>
|
||||
<p class="talk">«{g.lastTalk.text}»</p>
|
||||
</div>
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- NEXT FIGHT -->
|
||||
<section class="next">
|
||||
<div class="sechead">
|
||||
<h2 class="display"><span class="tag gold">Скоро</span> {next.title}</h2>
|
||||
<span class="kicker">{new Date(next.at).toLocaleString('ru-RU', { weekday: 'short', hour: '2-digit', minute: '2-digit' })} МСК</span>
|
||||
</div>
|
||||
<div class="card panel">
|
||||
<div class="fight">
|
||||
<div class="fighter w">
|
||||
<Mark entity={next.white} size={96} corner="white" />
|
||||
<div class="fn display">{next.white.name}</div>
|
||||
<div class="fs"><span class="var max">{next.white.variant}</span> {next.white.rating} · {next.whitePersona}</div>
|
||||
<div class="rec mono">{next.white.w}–{next.white.d}–{next.white.l}</div>
|
||||
</div>
|
||||
<div class="mid">
|
||||
<div class="vsbig display">VS</div>
|
||||
<Countdown at={next.at} />
|
||||
<div class="kicker">до начала · прогнозы открыты</div>
|
||||
<Flags flags={next.flags} />
|
||||
</div>
|
||||
<div class="fighter b">
|
||||
<Mark entity={next.black} size={96} corner="black" />
|
||||
<div class="fn display">{next.black.name}</div>
|
||||
<div class="fs"><span class="var max">{next.black.variant}</span> {next.black.rating} · {next.blackPersona}</div>
|
||||
<div class="rec mono">{next.black.w}–{next.black.d}–{next.black.l}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="predwrap">
|
||||
<Predict white={next.white} black={next.black} pred={next.prediction} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="upnext">
|
||||
{#each scheduled.slice(1) as s}
|
||||
<div class="up panel">
|
||||
<span class="tag ghost">Далее</span>
|
||||
<Mark entity={s.white} size={26} corner="white" /><b class="display">{s.white.short}</b>
|
||||
<span class="dim">vs</span>
|
||||
<Mark entity={s.black} size={26} corner="black" /><b class="display">{s.black.short}</b>
|
||||
<span class="dim">· {s.title}</span>
|
||||
<span class="cd"><Countdown at={s.at} size="sm" /></span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- RECENT -->
|
||||
<section class="recent">
|
||||
<div class="sechead">
|
||||
<h2 class="display"><span class="tag">Повторы</span> Недавние матчи</h2>
|
||||
<a href="/games" class="more kicker">Весь архив ▸</a>
|
||||
</div>
|
||||
<div class="tgrid">
|
||||
{#each archive as a}
|
||||
<a class="tcard" href="/match/demo?over=1">
|
||||
<Thumb white={a.white} black={a.black} thumb={a.thumb} result={a.result} unrated={a.unrated} />
|
||||
<div class="tmeta">
|
||||
<div class="tt">{a.thumb.caption}</div>
|
||||
<div class="tp">
|
||||
<Mark entity={a.white} size={18} flat /> {a.white.short} {a.white.variant ?? ''}
|
||||
<span class="res mono">{a.result}</span>
|
||||
<Mark entity={a.black} size={18} flat /> {a.black.short} {a.black.variant ?? ''}
|
||||
</div>
|
||||
<div class="ts kicker">{a.views} просмотров · {a.when} · {a.moves} ходов · {a.reason}</div>
|
||||
</div>
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.home {
|
||||
padding-top: 18px;
|
||||
padding-bottom: 40px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 40px;
|
||||
}
|
||||
.sechead {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
gap: 12px;
|
||||
}
|
||||
h1,
|
||||
h2 {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
}
|
||||
h1 b {
|
||||
color: var(--live);
|
||||
}
|
||||
h2 {
|
||||
font-size: 22px;
|
||||
}
|
||||
.var {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.14em;
|
||||
padding: 2px 6px 1px;
|
||||
background: var(--panel-3);
|
||||
color: var(--text-2);
|
||||
font-family: var(--display);
|
||||
vertical-align: middle;
|
||||
}
|
||||
.var.max {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
}
|
||||
.dim {
|
||||
color: var(--dim);
|
||||
}
|
||||
|
||||
/* live */
|
||||
.livegrid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
|
||||
gap: 12px;
|
||||
}
|
||||
.feat {
|
||||
display: grid;
|
||||
grid-template-columns: 320px 1fr;
|
||||
gap: 0;
|
||||
overflow: hidden;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
.feat:hover {
|
||||
border-color: var(--line-2);
|
||||
}
|
||||
.fboard {
|
||||
position: relative;
|
||||
border-right: 1px solid var(--line);
|
||||
}
|
||||
.fbadge {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 8px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--live);
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.14em;
|
||||
padding: 3px 8px 2px;
|
||||
}
|
||||
.finfo {
|
||||
padding: 14px 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
.fplayers {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.fp {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 6px 8px;
|
||||
border-left: 3px solid var(--white-corner);
|
||||
min-width: 0;
|
||||
}
|
||||
.fp.b {
|
||||
border-left-color: var(--black-corner);
|
||||
}
|
||||
.fp.turn {
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
.fp .n {
|
||||
font-size: 17px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.fp .s {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.think {
|
||||
color: var(--live);
|
||||
}
|
||||
.vs {
|
||||
color: var(--dim);
|
||||
font-size: 14px;
|
||||
}
|
||||
.ftalk {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.45;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: baseline;
|
||||
padding: 10px 12px;
|
||||
background: #f3f4f8;
|
||||
color: #0a0b10;
|
||||
clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
|
||||
}
|
||||
.fstats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, auto);
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 8px 0 0;
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
.fstats > div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.fstats b {
|
||||
font-size: 20px;
|
||||
}
|
||||
.fstats i {
|
||||
font-style: normal;
|
||||
color: var(--dim);
|
||||
margin: 0 4px;
|
||||
}
|
||||
.fmeta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: auto;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
.watch {
|
||||
margin-left: auto;
|
||||
color: var(--gold);
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.12em;
|
||||
}
|
||||
.others {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.oc {
|
||||
display: grid;
|
||||
grid-template-columns: 120px 1fr;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
.oc:hover {
|
||||
border-color: var(--line-2);
|
||||
}
|
||||
.ob {
|
||||
border-right: 1px solid var(--line);
|
||||
align-self: center;
|
||||
}
|
||||
.oi {
|
||||
padding: 10px 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.row b {
|
||||
font-size: 13px;
|
||||
}
|
||||
.row .ev {
|
||||
margin-left: auto;
|
||||
font-size: 11px;
|
||||
padding: 1px 6px;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
.row .ev.neg {
|
||||
background: #1c1f28;
|
||||
color: #fff;
|
||||
box-shadow: inset 0 0 0 1px var(--line-2);
|
||||
}
|
||||
.row.meta {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.talk {
|
||||
margin: 0;
|
||||
font-size: 12.5px;
|
||||
color: var(--text-2);
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* next */
|
||||
.card {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 340px;
|
||||
gap: 0;
|
||||
}
|
||||
.fight {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
align-items: center;
|
||||
padding: 26px 28px;
|
||||
gap: 20px;
|
||||
position: relative;
|
||||
background:
|
||||
radial-gradient(500px 240px at 15% 50%, color-mix(in srgb, var(--ice) 14%, transparent), transparent 70%),
|
||||
radial-gradient(500px 240px at 85% 50%, color-mix(in srgb, var(--fire) 14%, transparent), transparent 70%);
|
||||
}
|
||||
.fighter {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
.fighter.b {
|
||||
align-items: flex-end;
|
||||
text-align: right;
|
||||
}
|
||||
.fn {
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.fs {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
.rec {
|
||||
font-size: 12px;
|
||||
color: var(--dim);
|
||||
}
|
||||
.mid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.vsbig {
|
||||
font-size: 42px;
|
||||
font-weight: 700;
|
||||
color: transparent;
|
||||
-webkit-text-stroke: 1px var(--gold);
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.predwrap {
|
||||
border-left: 1px solid var(--line);
|
||||
}
|
||||
.upnext {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.up {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.up .cd {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* recent */
|
||||
.tgrid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 16px 14px;
|
||||
}
|
||||
.tcard {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
.tcard:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.tt {
|
||||
font-family: var(--display);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.01em;
|
||||
line-height: 1.15;
|
||||
}
|
||||
.tp {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--text-2);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.tp .res {
|
||||
padding: 0 6px;
|
||||
background: var(--panel-3);
|
||||
font-size: 11px;
|
||||
}
|
||||
.ts {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
.more {
|
||||
color: var(--gold);
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.livegrid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.others {
|
||||
flex-direction: row;
|
||||
}
|
||||
.tgrid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
.card {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.predwrap {
|
||||
border-left: 0;
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.feat {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.fboard {
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.others {
|
||||
flex-direction: column;
|
||||
}
|
||||
.tgrid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
.fight {
|
||||
grid-template-columns: 1fr;
|
||||
text-align: center;
|
||||
}
|
||||
.fighter,
|
||||
.fighter.b {
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
h1,
|
||||
h2 {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.tgrid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,232 @@
|
||||
<script lang="ts">
|
||||
import { users, scheduled, liveGames, archive, fmt } from '#lib/mock.js';
|
||||
import Mark from '#lib/components/Mark.svelte';
|
||||
import Flags from '#lib/components/Flags.svelte';
|
||||
import Countdown from '#lib/components/Countdown.svelte';
|
||||
|
||||
const totalUsd = users.reduce((a, u) => a + u.usd, 0);
|
||||
const totalTok = users.reduce((a, u) => a + u.tokens, 0);
|
||||
const maxUsd = Math.max(...users.map((u) => u.usd));
|
||||
const todayUsd = archive[0].cost + liveGames.reduce((a, g) => a + g.stats.usd, 0);
|
||||
</script>
|
||||
|
||||
<svelte:head><title>Админ · AI·CHESS</title></svelte:head>
|
||||
|
||||
<div class="wrap admin">
|
||||
<div class="head">
|
||||
<h1 class="display"><span class="tag bad">Admin</span> Аппаратная</h1>
|
||||
<span class="kicker">только для danosito</span>
|
||||
</div>
|
||||
|
||||
<div class="kpis">
|
||||
<div class="kpi panel"><span class="kicker">Потрачено всего</span><b class="display">{fmt.usd(totalUsd)}</b><small>{fmt.tok(totalTok)} токенов</small></div>
|
||||
<div class="kpi panel"><span class="kicker">Сегодня</span><b class="display">{fmt.usd(todayUsd)}</b><small>{liveGames.length} партии в эфире</small></div>
|
||||
<div class="kpi panel"><span class="kicker">Пользователей</span><b class="display">{users.length}</b><small>+2 за неделю</small></div>
|
||||
<div class="kpi panel"><span class="kicker">Запланировано</span><b class="display">{scheduled.length}</b><small>прогнозов: {scheduled.reduce((a, s) => a + s.prediction.total, 0)}</small></div>
|
||||
</div>
|
||||
|
||||
<div class="cols">
|
||||
<section class="panel">
|
||||
<div class="panel-head"><span>Пользователи</span><span class="kicker">токены и $ — за всё время</span></div>
|
||||
<div class="tbl">
|
||||
<div class="tr th"><span>Пользователь</span><span>Роль</span><span class="r">Партий</span><span class="r">Токены</span><span class="r">$</span><span>Доля</span><span></span></div>
|
||||
{#each users as u}
|
||||
<div class="tr">
|
||||
<span class="who">
|
||||
<span class="av" style:--hue={u.hue}>{u.initials}</span>
|
||||
<span class="nm"><b>{u.name}</b><small>с {u.joined}</small></span>
|
||||
</span>
|
||||
<span><span class="tag" class:bad={u.role === 'admin'} class:ghost={u.role !== 'admin'}>{u.role}</span></span>
|
||||
<span class="r mono">{u.games}</span>
|
||||
<span class="r mono">{fmt.tok(u.tokens)}</span>
|
||||
<span class="r mono usd">{fmt.usd(u.usd)}</span>
|
||||
<span class="share"><i style:width="{(u.usd / maxUsd) * 100}%"></i></span>
|
||||
<span class="acts"><button class="btn sm">лимит</button><button class="btn sm">бан</button></span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-head"><span>Запланированные матчи</span><a href="/new" class="kicker gold">+ добавить</a></div>
|
||||
<div class="sched">
|
||||
{#each scheduled as s}
|
||||
<div class="s">
|
||||
<div class="row">
|
||||
<Mark entity={s.white} size={28} corner="white" /><b class="display">{s.white.short} {s.white.variant ?? ''}</b>
|
||||
<span class="dim">vs</span>
|
||||
<Mark entity={s.black} size={28} corner="black" /><b class="display">{s.black.short} {s.black.variant ?? ''}</b>
|
||||
</div>
|
||||
<div class="row meta">
|
||||
<span>{s.title}</span>
|
||||
<span class="dim">·</span>
|
||||
<span>{s.whitePersona} / {s.blackPersona}</span>
|
||||
<Flags flags={s.flags} />
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<Countdown at={s.at} size="sm" />
|
||||
<span class="mono dim">прогнозов: {s.prediction.total}</span>
|
||||
<span class="acts"><button class="btn sm">перенести</button><button class="btn sm">отменить</button></span>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.admin {
|
||||
padding-top: 18px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 26px;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
.kpis {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 10px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.kpi {
|
||||
padding: 12px 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
border-left: 3px solid var(--gold);
|
||||
}
|
||||
.kpi b {
|
||||
font-size: 30px;
|
||||
}
|
||||
.kpi small {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
.cols {
|
||||
display: grid;
|
||||
grid-template-columns: 1.4fr 1fr;
|
||||
gap: 14px;
|
||||
align-items: start;
|
||||
}
|
||||
.tr {
|
||||
display: grid;
|
||||
grid-template-columns: 1.6fr 80px 60px 80px 80px 1fr 150px;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
font-size: 13px;
|
||||
}
|
||||
.tr.th {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
font-size: 10px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.r {
|
||||
text-align: right;
|
||||
}
|
||||
.who {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.av {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-family: var(--display);
|
||||
font-weight: 700;
|
||||
background: linear-gradient(160deg, hsl(var(--hue) 70% 55%), hsl(var(--hue) 60% 35%));
|
||||
clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
|
||||
}
|
||||
.nm {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: 1.15;
|
||||
}
|
||||
.nm small {
|
||||
color: var(--dim);
|
||||
font-size: 11px;
|
||||
}
|
||||
.usd {
|
||||
color: var(--gold);
|
||||
font-weight: 500;
|
||||
}
|
||||
.share {
|
||||
height: 6px;
|
||||
background: var(--panel-3);
|
||||
}
|
||||
.share i {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background: var(--gold);
|
||||
}
|
||||
.acts {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.sched {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.s {
|
||||
padding: 12px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.row b {
|
||||
font-size: 14px;
|
||||
}
|
||||
.row.meta {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.row.bottom {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.dim {
|
||||
color: var(--dim);
|
||||
}
|
||||
.gold {
|
||||
color: var(--gold);
|
||||
}
|
||||
@media (max-width: 1000px) {
|
||||
.kpis {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.cols {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.tr {
|
||||
grid-template-columns: 1.6fr 60px 70px 1fr;
|
||||
}
|
||||
.tr > :nth-child(2),
|
||||
.tr > :nth-child(6),
|
||||
.tr > :nth-child(7) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,157 @@
|
||||
<script lang="ts">
|
||||
import { archive, fmt } from '#lib/mock.js';
|
||||
import Thumb from '#lib/components/Thumb.svelte';
|
||||
import Mark from '#lib/components/Mark.svelte';
|
||||
|
||||
let q = $state('');
|
||||
let only = $state<'all' | 'ai' | 'human' | 'unrated'>('all');
|
||||
const list = $derived(
|
||||
archive.filter((a) => {
|
||||
if (only === 'human' && a.white.vendor !== 'human' && a.black.vendor !== 'human') return false;
|
||||
if (only === 'ai' && (a.white.vendor === 'human' || a.black.vendor === 'human')) return false;
|
||||
if (only === 'unrated' && !a.unrated) return false;
|
||||
if (q && !(a.thumb.caption + a.white.name + a.black.name).toLowerCase().includes(q.toLowerCase())) return false;
|
||||
return true;
|
||||
})
|
||||
);
|
||||
</script>
|
||||
|
||||
<svelte:head><title>Архив · AI·CHESS</title></svelte:head>
|
||||
|
||||
<div class="wrap games">
|
||||
<div class="head">
|
||||
<h1 class="display"><span class="tag">Повторы</span> Архив матчей</h1>
|
||||
<div class="filters">
|
||||
<button class:on={only === 'all'} onclick={() => (only = 'all')}>Все</button>
|
||||
<button class:on={only === 'ai'} onclick={() => (only = 'ai')}>Модели</button>
|
||||
<button class:on={only === 'human'} onclick={() => (only = 'human')}>С людьми</button>
|
||||
<button class:on={only === 'unrated'} onclick={() => (only = 'unrated')}>Без рейтинга</button>
|
||||
</div>
|
||||
<input class="q" placeholder="Поиск по заголовку или игроку…" bind:value={q} />
|
||||
</div>
|
||||
<div class="tgrid">
|
||||
{#each list as a (a.id)}
|
||||
<a class="tcard" href="/match/demo?over=1">
|
||||
<Thumb white={a.white} black={a.black} thumb={a.thumb} result={a.result} unrated={a.unrated} />
|
||||
<div class="tmeta">
|
||||
<div class="tt">{a.thumb.caption}</div>
|
||||
<div class="tp">
|
||||
<Mark entity={a.white} size={18} flat /> {a.white.short} {a.white.variant ?? ''}
|
||||
<span class="res mono">{a.result}</span>
|
||||
<Mark entity={a.black} size={18} flat /> {a.black.short} {a.black.variant ?? ''}
|
||||
</div>
|
||||
<div class="ts kicker">{a.views} просмотров · {a.when} · {a.moves} ходов · {a.reason} · точность {a.accW}% / {a.accB}% · {fmt.usd(a.cost)}</div>
|
||||
</div>
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
{#if !list.length}<p class="empty">Ничего не нашлось. Попробуйте «конь» — он всегда виноват.</p>{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.games {
|
||||
padding-top: 18px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
margin-bottom: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 26px;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
.filters {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--panel);
|
||||
}
|
||||
.filters button {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
font-size: 12px;
|
||||
padding: 9px 14px 8px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.filters button.on {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
}
|
||||
.q {
|
||||
margin-left: auto;
|
||||
background: #07080c;
|
||||
border: 1px solid var(--line-2);
|
||||
padding: 9px 12px;
|
||||
font-size: 13px;
|
||||
width: 300px;
|
||||
}
|
||||
.tgrid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 18px 14px;
|
||||
}
|
||||
.tcard {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
.tcard:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.tt {
|
||||
font-family: var(--display);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 1.15;
|
||||
}
|
||||
.tp {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--text-2);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.tp .res {
|
||||
padding: 0 6px;
|
||||
background: var(--panel-3);
|
||||
font-size: 11px;
|
||||
}
|
||||
.ts {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.empty {
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.tgrid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.tgrid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
.q {
|
||||
width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.tgrid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,538 @@
|
||||
<script lang="ts">
|
||||
import { entities, aiIds, byId, h2h, vendorLabel, fmt } from '#lib/mock.js';
|
||||
import Mark from '#lib/components/Mark.svelte';
|
||||
|
||||
let view = $state<'table' | 'price' | 'h2h'>('table');
|
||||
let filter = $state<'all' | 'ai' | 'human'>('all');
|
||||
|
||||
const rows = $derived(
|
||||
entities
|
||||
.filter((e) => filter === 'all' || (filter === 'ai' ? e.vendor !== 'human' : e.vendor === 'human'))
|
||||
.slice()
|
||||
.sort((a, b) => b.rating - a.rating)
|
||||
);
|
||||
const games = (e: (typeof entities)[number]) => e.w + e.d + e.l;
|
||||
|
||||
// scatter
|
||||
const W = 760;
|
||||
const H = 380;
|
||||
const P = { l: 56, r: 24, t: 20, b: 44 };
|
||||
const xMax = 50;
|
||||
const yMin = 1580;
|
||||
const yMax = 2140;
|
||||
const sx = (v: number) => P.l + (v / xMax) * (W - P.l - P.r);
|
||||
const sy = (v: number) => P.t + (1 - (v - yMin) / (yMax - yMin)) * (H - P.t - P.b);
|
||||
const hue = (e: (typeof entities)[number]) => (e.vendor === 'anthropic' ? '#d97757' : e.vendor === 'openai' ? '#10a37f' : `hsl(${e.avatar?.hue ?? 0} 60% 55%)`);
|
||||
let hov = $state<string | null>(null);
|
||||
|
||||
const best = $derived([...entities].filter((e) => e.vendor !== 'human').sort((a, b) => b.rating / b.costPerGame - a.rating / a.costPerGame)[0]);
|
||||
</script>
|
||||
|
||||
<svelte:head><title>Таблица · AI·CHESS</title></svelte:head>
|
||||
|
||||
<div class="wrap lb">
|
||||
<div class="head">
|
||||
<h1 class="display"><span class="tag gold">Таблица</span> Рейтинг арены</h1>
|
||||
<div class="tabs">
|
||||
<button class:on={view === 'table'} onclick={() => (view = 'table')}>Таблица</button>
|
||||
<button class:on={view === 'price'} onclick={() => (view = 'price')}>Сколько стоит рейтинг</button>
|
||||
<button class:on={view === 'h2h'} onclick={() => (view = 'h2h')}>Очные встречи</button>
|
||||
</div>
|
||||
<div class="filters">
|
||||
<button class:on={filter === 'all'} onclick={() => (filter = 'all')}>Все</button>
|
||||
<button class:on={filter === 'ai'} onclick={() => (filter = 'ai')}>Модели</button>
|
||||
<button class:on={filter === 'human'} onclick={() => (filter = 'human')}>Люди</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if view === 'table'}
|
||||
<div class="table panel">
|
||||
<div class="tr th">
|
||||
<span>#</span>
|
||||
<span>Игрок</span>
|
||||
<span class="r">Elo</span>
|
||||
<span class="r">±10</span>
|
||||
<span>В / Н / П</span>
|
||||
<span class="r">Партий</span>
|
||||
<span class="r">Точность</span>
|
||||
<span class="r">$ / партия</span>
|
||||
<span class="r">Elo за $</span>
|
||||
</div>
|
||||
{#each rows as e, i (e.id)}
|
||||
{@const n = games(e)}
|
||||
{@const rank = entities.slice().sort((a, b) => b.rating - a.rating).findIndex((x) => x.id === e.id) + 1}
|
||||
<div class="tr" class:top={rank <= 3} style:--rank-c={rank === 1 ? 'var(--gold)' : rank === 2 ? '#c9d1e0' : rank === 3 ? '#c48a5a' : 'transparent'} style:animation-delay="{i * 30}ms">
|
||||
<span class="rank display">{rank}</span>
|
||||
<span class="who">
|
||||
<Mark entity={e} size={36} />
|
||||
<span class="nm">
|
||||
<b class="display">{e.name} {#if e.variant}<i class="var" class:max={e.variant === 'MAX'}>{e.variant}</i>{/if}</b>
|
||||
<small>{vendorLabel[e.vendor]}{e.vendor !== 'human' ? ' · ' + (e.variant === 'MAX' ? 'max reasoning' : 'быстрый') : ''}</small>
|
||||
</span>
|
||||
{#if e.vendor === 'human'}<span class="tag ghost">человек</span>{/if}
|
||||
</span>
|
||||
<span class="r elo display tnum">{e.rating}</span>
|
||||
<span class="r trend mono" class:up={e.trend > 0} class:down={e.trend < 0}>{e.trend > 0 ? '▲' : '▼'}{Math.abs(e.trend)}</span>
|
||||
<span class="wdl">
|
||||
<span class="bar">
|
||||
<i class="w" style:width="{(e.w / n) * 100}%"></i>
|
||||
<i class="d" style:width="{(e.d / n) * 100}%"></i>
|
||||
<i class="l" style:width="{(e.l / n) * 100}%"></i>
|
||||
</span>
|
||||
<span class="nums mono"><b>{e.w}</b> / {e.d} / <span class="lo">{e.l}</span></span>
|
||||
</span>
|
||||
<span class="r mono">{n}</span>
|
||||
<span class="r acc tnum" style:color={e.acc >= 90 ? 'var(--good)' : e.acc >= 84 ? 'var(--text)' : 'var(--warn)'}>{e.acc.toFixed(1)}%</span>
|
||||
<span class="r mono">{e.costPerGame ? fmt.usd(e.costPerGame) : '—'}</span>
|
||||
<span class="r mono dim">{e.costPerGame ? Math.round(e.rating / e.costPerGame) : '∞'}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<p class="foot kicker">Elo — общий для людей и моделей · ±10 — изменение за последние 10 партий · $ / партия — средний расход токенов в деньгах</p>
|
||||
{:else if view === 'price'}
|
||||
<div class="price panel">
|
||||
<div class="phead">
|
||||
<div>
|
||||
<div class="kicker">Ось X — средний расход за партию, ось Y — Elo</div>
|
||||
<h2 class="display">Сколько стоит рейтинг</h2>
|
||||
</div>
|
||||
<div class="callout">
|
||||
<span class="kicker">Лучшая цена за очко</span>
|
||||
<b class="display">{best.name} {best.variant}</b>
|
||||
<span>{best.rating} Elo за {fmt.usd(best.costPerGame)} / партия</span>
|
||||
</div>
|
||||
</div>
|
||||
<svg viewBox="0 0 {W} {H}" class="scatter" role="img" aria-label="Цена против Elo">
|
||||
<!-- grid -->
|
||||
{#each [1600, 1700, 1800, 1900, 2000, 2100] as y}
|
||||
<line x1={P.l} x2={W - P.r} y1={sy(y)} y2={sy(y)} stroke="var(--line)" />
|
||||
<text x={P.l - 8} y={sy(y) + 4} text-anchor="end" class="ax">{y}</text>
|
||||
{/each}
|
||||
{#each [0, 10, 20, 30, 40, 50] as x}
|
||||
<line x1={sx(x)} x2={sx(x)} y1={P.t} y2={H - P.b} stroke="var(--line)" stroke-dasharray="2 4" />
|
||||
<text x={sx(x)} y={H - P.b + 18} text-anchor="middle" class="ax">${x}</text>
|
||||
{/each}
|
||||
<text x={W - P.r} y={H - 6} text-anchor="end" class="axl">$ за партию →</text>
|
||||
<!-- "free" zone for humans -->
|
||||
<rect x={P.l} y={P.t} width="26" height={H - P.t - P.b} fill="rgba(255,255,255,0.025)" />
|
||||
<text x={P.l + 13} y={P.t + 12} text-anchor="middle" class="axl">люди</text>
|
||||
<!-- variant links: MAX -> HIGH of same model -->
|
||||
{#each ['claude-opus-5-5', 'claude-fable-5-1', 'gpt-6.1-sol', 'gpt-6-astra'] as m}
|
||||
{@const a = byId(m + ':max')}
|
||||
{@const b = byId(m + ':high')}
|
||||
<line x1={sx(a.costPerGame)} y1={sy(a.rating)} x2={sx(b.costPerGame)} y2={sy(b.rating)} stroke={hue(a)} stroke-opacity="0.45" stroke-width="1.5" />
|
||||
{/each}
|
||||
{#each entities as e (e.id)}
|
||||
{@const x = e.vendor === 'human' ? P.l + 13 : sx(e.costPerGame)}
|
||||
{@const y = sy(e.rating)}
|
||||
<g class="pt" class:hov={hov === e.id} onmouseenter={() => (hov = e.id)} onmouseleave={() => (hov = null)} role="presentation">
|
||||
<circle cx={x} cy={y} r={e.variant === 'MAX' ? 11 : 8} fill={hue(e)} fill-opacity={e.vendor === 'human' ? 0.9 : 0.85} stroke="#06070b" stroke-width="2" />
|
||||
{#if e.variant === 'MAX'}<circle cx={x} cy={y} r="14" fill="none" stroke="var(--gold)" stroke-width="1" stroke-opacity="0.8" />{/if}
|
||||
<text x={x + (e.vendor === 'human' ? 20 : 16)} y={y + 4 + (e.vendor !== 'human' && e.costPerGame < 6 ? -14 : 0)} class="lbl" class:hum={e.vendor === 'human'}>{e.vendor === 'human' ? e.name : `${e.short} ${e.variant}`}</text>
|
||||
</g>
|
||||
{/each}
|
||||
</svg>
|
||||
<div class="legend">
|
||||
<span><i style:background="#d97757"></i>Anthropic</span>
|
||||
<span><i style:background="#10a37f"></i>OpenAI</span>
|
||||
<span><i class="ring"></i>MAX-вариант</span>
|
||||
<span><i style:background="hsl(140 60% 55%)"></i>Люди (бесплатно, но медленно)</span>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="h2h panel">
|
||||
<div class="phead">
|
||||
<div>
|
||||
<div class="kicker">Строка против столбца · победы — ничьи — поражения</div>
|
||||
<h2 class="display">Очные встречи</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="matrix" style:--n={aiIds.length}>
|
||||
<span class="corner"></span>
|
||||
{#each aiIds as id}
|
||||
{@const e = byId(id)}
|
||||
<span class="col"><Mark entity={e} size={22} /><span class="display">{e.short}<i class:max={e.variant === 'MAX'}>{e.variant}</i></span></span>
|
||||
{/each}
|
||||
{#each aiIds as a}
|
||||
{@const ea = byId(a)}
|
||||
<span class="rowh"><Mark entity={ea} size={22} /><span class="display">{ea.short}<i class:max={ea.variant === 'MAX'}>{ea.variant}</i></span></span>
|
||||
{#each aiIds as b}
|
||||
{@const [w, d, l] = h2h(a, b)}
|
||||
{@const n = w + d + l}
|
||||
{@const share = n ? (w + d / 2) / n : 0.5}
|
||||
{#if a === b}
|
||||
<span class="cell self"></span>
|
||||
{:else}
|
||||
<span class="cell" style:--p={share} title="{ea.name} {ea.variant} vs {byId(b).name} {byId(b).variant}: {w}-{d}-{l}">
|
||||
<b class="mono">{w}</b><span class="mono">–{d}–</span><span class="mono lo">{l}</span>
|
||||
</span>
|
||||
{/if}
|
||||
{/each}
|
||||
{/each}
|
||||
</div>
|
||||
<div class="legend">
|
||||
<span><i style:background="color-mix(in srgb, var(--good) 70%, #0b0d14)"></i>доминирует</span>
|
||||
<span><i style:background="var(--panel-3)"></i>паритет</span>
|
||||
<span><i style:background="color-mix(in srgb, var(--bad) 70%, #0b0d14)"></i>страдает</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.lb {
|
||||
padding-top: 18px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
margin-bottom: 14px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 26px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
h2 {
|
||||
margin: 2px 0 0;
|
||||
font-size: 22px;
|
||||
}
|
||||
.tabs,
|
||||
.filters {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--panel);
|
||||
}
|
||||
.filters {
|
||||
margin-left: auto;
|
||||
}
|
||||
.tabs button,
|
||||
.filters button {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
font-size: 12px;
|
||||
padding: 9px 14px 8px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.tabs button.on,
|
||||
.filters button.on {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
}
|
||||
.table {
|
||||
overflow: hidden;
|
||||
}
|
||||
.tr {
|
||||
display: grid;
|
||||
grid-template-columns: 56px minmax(260px, 1.6fr) 90px 64px 1.2fr 80px 100px 110px 90px;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 0 16px 0 0;
|
||||
border-bottom: 1px solid var(--line);
|
||||
min-height: 58px;
|
||||
animation: rise 0.4s both;
|
||||
position: relative;
|
||||
}
|
||||
.tr::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
background: var(--rank-c);
|
||||
}
|
||||
.tr.th {
|
||||
min-height: 36px;
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
font-size: 10.5px;
|
||||
color: var(--muted);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
animation: none;
|
||||
}
|
||||
.tr.th span:first-child {
|
||||
padding-left: 16px;
|
||||
}
|
||||
.tr:not(.th):hover {
|
||||
background: rgba(255, 255, 255, 0.025);
|
||||
}
|
||||
.r {
|
||||
text-align: right;
|
||||
}
|
||||
.rank {
|
||||
font-size: 22px;
|
||||
color: var(--muted);
|
||||
padding-left: 16px;
|
||||
}
|
||||
.top .rank {
|
||||
color: var(--text);
|
||||
}
|
||||
.who {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
.nm {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: 1.15;
|
||||
min-width: 0;
|
||||
}
|
||||
.nm b {
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.nm small {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.var {
|
||||
font-style: normal;
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.14em;
|
||||
padding: 2px 5px 1px;
|
||||
background: var(--panel-3);
|
||||
color: var(--text-2);
|
||||
}
|
||||
.var.max {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
}
|
||||
.elo {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.trend {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.trend.up {
|
||||
color: var(--good);
|
||||
}
|
||||
.trend.down {
|
||||
color: var(--bad);
|
||||
}
|
||||
.wdl {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.bar {
|
||||
display: flex;
|
||||
height: 6px;
|
||||
gap: 1px;
|
||||
}
|
||||
.bar i {
|
||||
display: block;
|
||||
}
|
||||
.bar .w {
|
||||
background: var(--good);
|
||||
}
|
||||
.bar .d {
|
||||
background: var(--dim);
|
||||
}
|
||||
.bar .l {
|
||||
background: var(--bad);
|
||||
opacity: 0.8;
|
||||
}
|
||||
.nums {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.nums b {
|
||||
color: var(--good);
|
||||
}
|
||||
.lo {
|
||||
color: var(--bad);
|
||||
}
|
||||
.acc {
|
||||
font-weight: 600;
|
||||
}
|
||||
.dim {
|
||||
color: var(--dim);
|
||||
}
|
||||
.foot {
|
||||
margin: 10px 0 0;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.price,
|
||||
.h2h {
|
||||
padding: 16px 18px 14px;
|
||||
}
|
||||
.phead {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.callout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
padding: 8px 12px;
|
||||
border-left: 3px solid var(--gold);
|
||||
background: color-mix(in srgb, var(--gold) 8%, transparent);
|
||||
font-size: 12px;
|
||||
color: var(--text-2);
|
||||
}
|
||||
.callout b {
|
||||
font-size: 16px;
|
||||
color: var(--text);
|
||||
}
|
||||
.scatter {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
.ax {
|
||||
fill: var(--dim);
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
}
|
||||
.axl {
|
||||
fill: var(--muted);
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
font-size: 9px;
|
||||
}
|
||||
.lbl {
|
||||
fill: var(--text-2);
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
font-size: 11px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.lbl.hum {
|
||||
text-transform: none;
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
}
|
||||
.pt:hover circle {
|
||||
filter: brightness(1.2);
|
||||
}
|
||||
.legend {
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
margin-top: 8px;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.legend span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.legend i {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
.legend i.ring {
|
||||
border: 1px solid var(--gold);
|
||||
}
|
||||
|
||||
.matrix {
|
||||
display: grid;
|
||||
grid-template-columns: 150px repeat(var(--n), 1fr);
|
||||
gap: 3px;
|
||||
}
|
||||
.corner {
|
||||
}
|
||||
.col,
|
||||
.rowh {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.06em;
|
||||
color: var(--text-2);
|
||||
min-width: 0;
|
||||
}
|
||||
.col {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
padding-bottom: 4px;
|
||||
line-height: 1.1;
|
||||
}
|
||||
.col span,
|
||||
.rowh span {
|
||||
display: inline-flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
}
|
||||
.col i,
|
||||
.rowh i {
|
||||
font-style: normal;
|
||||
font-size: 8px;
|
||||
padding: 1px 3px 0;
|
||||
background: var(--panel-3);
|
||||
}
|
||||
.col i.max,
|
||||
.rowh i.max {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
}
|
||||
.cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0;
|
||||
height: 46px;
|
||||
font-size: 12px;
|
||||
background: color-mix(in srgb, color-mix(in srgb, var(--good) calc(var(--p) * 100%), var(--bad)) 55%, #0b0d14);
|
||||
color: var(--text);
|
||||
transition: transform 0.1s;
|
||||
}
|
||||
.cell:hover {
|
||||
transform: scale(1.06);
|
||||
z-index: 1;
|
||||
outline: 1px solid var(--gold);
|
||||
}
|
||||
.cell b {
|
||||
font-weight: 600;
|
||||
}
|
||||
.cell span {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
.cell.self {
|
||||
background: repeating-linear-gradient(45deg, var(--panel) 0 4px, var(--panel-2) 4px 8px);
|
||||
}
|
||||
|
||||
@media (max-width: 1000px) {
|
||||
.tr {
|
||||
grid-template-columns: 40px minmax(180px, 1.6fr) 70px 1fr 80px 90px;
|
||||
}
|
||||
.tr > :nth-child(4),
|
||||
.tr > :nth-child(6),
|
||||
.tr > :nth-child(9) {
|
||||
display: none;
|
||||
}
|
||||
.matrix {
|
||||
grid-template-columns: 90px repeat(var(--n), 1fr);
|
||||
}
|
||||
.col span,
|
||||
.rowh span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,260 @@
|
||||
<script lang="ts">
|
||||
let mode = $state<'login' | 'register' | 'avatar'>('register');
|
||||
let nick = $state('');
|
||||
let hue = $state(32);
|
||||
let file = $state<string | null>(null);
|
||||
const initials = $derived((nick.trim() || 'Вы').slice(0, 2).toUpperCase());
|
||||
|
||||
function onFile(e: Event) {
|
||||
const f = (e.target as HTMLInputElement).files?.[0];
|
||||
if (!f) return;
|
||||
file = URL.createObjectURL(f);
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head><title>Вход · AI·CHESS</title></svelte:head>
|
||||
|
||||
<div class="login">
|
||||
<div class="card panel">
|
||||
<div class="tabs">
|
||||
<button class:on={mode === 'login'} onclick={() => (mode = 'login')}>Вход</button>
|
||||
<button class:on={mode === 'register' || mode === 'avatar'} onclick={() => (mode = 'register')}>Регистрация</button>
|
||||
</div>
|
||||
|
||||
{#if mode === 'login'}
|
||||
<form class="body" onsubmit={(e) => e.preventDefault()}>
|
||||
<h1 class="display">С возвращением в эфир</h1>
|
||||
<label><span class="kicker">Ник или email</span><input placeholder="danosito" /></label>
|
||||
<label><span class="kicker">Пароль</span><input type="password" placeholder="••••••••" /></label>
|
||||
<a href="/" class="btn primary">Войти ▸</a>
|
||||
<p class="hint">Нет аккаунта? <button type="button" onclick={() => (mode = 'register')}>Зарегистрироваться</button> — это бесплатно, платят только модели.</p>
|
||||
</form>
|
||||
{:else if mode === 'register'}
|
||||
<form class="body" onsubmit={(e) => { e.preventDefault(); mode = 'avatar'; }}>
|
||||
<h1 class="display">Выходите на ринг</h1>
|
||||
<label><span class="kicker">Ник (будет на табло)</span><input bind:value={nick} placeholder="grossmeister_vova" maxlength="20" /></label>
|
||||
<label><span class="kicker">Email</span><input type="email" placeholder="you@example.com" /></label>
|
||||
<label><span class="kicker">Пароль</span><input type="password" placeholder="минимум 8 символов" /></label>
|
||||
<button class="btn primary" type="submit">Дальше: аватар ▸</button>
|
||||
<p class="hint">Регистрация открытая. Люди играют в том же рейтинге, что и модели.</p>
|
||||
</form>
|
||||
{:else}
|
||||
<div class="body">
|
||||
<h1 class="display">Ваше лицо на табло</h1>
|
||||
<p class="lead">Аватар появится в скорбаге, в ленте и на мем-превью ваших матчей. Выбирайте с умом — это навсегда (нет, можно сменить).</p>
|
||||
<div class="avrow">
|
||||
<div class="preview">
|
||||
<div class="scorebug-demo">
|
||||
<div class="av" style:--hue={hue}>
|
||||
{#if file}<img src={file} alt="аватар" />{:else}<span class="display">{initials}</span>{/if}
|
||||
</div>
|
||||
<div class="nm">
|
||||
<b class="display">{nick.trim() || 'Ваш ник'}</b>
|
||||
<span class="kicker">1500 · новичок · белые</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<label class="drop">
|
||||
<input type="file" accept="image/*" onchange={onFile} />
|
||||
<span class="display">Загрузить фото</span>
|
||||
<small>PNG / JPG до 2 МБ · квадрат смотрится лучше</small>
|
||||
</label>
|
||||
<div class="kicker">или цвет инициалов</div>
|
||||
<div class="hues">
|
||||
{#each [32, 140, 200, 265, 330, 0] as h}
|
||||
<button class="hue" class:on={hue === h && !file} style:--hue={h} onclick={() => { hue = h; file = null; }} aria-label="цвет {h}"></button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="/" class="btn primary">Готово · в эфир ▸</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="side">
|
||||
<div class="kicker">Зачем регистрироваться</div>
|
||||
<ul>
|
||||
<li><b>Играть</b> против моделей и попадать в общий рейтинг.</li>
|
||||
<li><b>Прогнозировать</b> исходы запланированных матчей и копить очки.</li>
|
||||
<li><b>Запускать</b> матчи модель-против-модели с персонами и флагами.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.login {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: 440px 300px;
|
||||
gap: 24px;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
padding: 40px 20px;
|
||||
}
|
||||
.card {
|
||||
overflow: hidden;
|
||||
}
|
||||
.tabs {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.tabs button {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.14em;
|
||||
font-size: 12px;
|
||||
padding: 12px;
|
||||
color: var(--muted);
|
||||
border-bottom: 2px solid transparent;
|
||||
}
|
||||
.tabs button.on {
|
||||
color: var(--text);
|
||||
border-bottom-color: var(--gold);
|
||||
}
|
||||
.body {
|
||||
padding: 22px 22px 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
h1 {
|
||||
margin: 0 0 4px;
|
||||
font-size: 28px;
|
||||
}
|
||||
label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
input:not([type='file']) {
|
||||
background: #07080c;
|
||||
border: 1px solid var(--line-2);
|
||||
padding: 10px 12px;
|
||||
font-size: 14px;
|
||||
}
|
||||
input:focus {
|
||||
outline: 2px solid var(--gold);
|
||||
outline-offset: -1px;
|
||||
}
|
||||
.hint {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.hint button {
|
||||
color: var(--gold);
|
||||
text-decoration: underline;
|
||||
}
|
||||
.lead {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: var(--text-2);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.avrow {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
.scorebug-demo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px;
|
||||
background: linear-gradient(180deg, #141824, #0d1018);
|
||||
border: 1px solid var(--line);
|
||||
border-bottom: 3px solid var(--white-corner);
|
||||
}
|
||||
.av {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: linear-gradient(160deg, hsl(var(--hue) 70% 55%), hsl(var(--hue) 60% 35%));
|
||||
clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
|
||||
overflow: hidden;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.av img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.nm {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.nm b {
|
||||
font-size: 16px;
|
||||
}
|
||||
.controls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.drop {
|
||||
border: 1px dashed var(--line-2);
|
||||
padding: 14px;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
gap: 4px;
|
||||
}
|
||||
.drop:hover {
|
||||
border-color: var(--gold);
|
||||
}
|
||||
.drop input {
|
||||
display: none;
|
||||
}
|
||||
.drop span {
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.drop small {
|
||||
color: var(--dim);
|
||||
font-size: 10px;
|
||||
}
|
||||
.hues {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.hue {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background: hsl(var(--hue) 65% 50%);
|
||||
clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
|
||||
}
|
||||
.hue.on {
|
||||
outline: 2px solid var(--gold);
|
||||
}
|
||||
.side ul {
|
||||
margin: 10px 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
color: var(--text-2);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.side li b {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--gold);
|
||||
margin-right: 4px;
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.login {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.avrow {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,638 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import { onMount } from 'svelte';
|
||||
import { makeDemoGame, fmt, liveGames } from '#lib/mock.js';
|
||||
import Board from '#lib/components/Board.svelte';
|
||||
import EvalBar from '#lib/components/EvalBar.svelte';
|
||||
import EvalGraph from '#lib/components/EvalGraph.svelte';
|
||||
import Scorebug from '#lib/components/Scorebug.svelte';
|
||||
import MoveList from '#lib/components/MoveList.svelte';
|
||||
import LowerThird from '#lib/components/LowerThird.svelte';
|
||||
import TalkFeed from '#lib/components/TalkFeed.svelte';
|
||||
import CostMeter from '#lib/components/CostMeter.svelte';
|
||||
import Predict from '#lib/components/Predict.svelte';
|
||||
import Interview from '#lib/components/Interview.svelte';
|
||||
import Thumb from '#lib/components/Thumb.svelte';
|
||||
import Flags from '#lib/components/Flags.svelte';
|
||||
|
||||
const over = $derived(page.url.searchParams.get('over') === '1');
|
||||
const game = $derived(makeDemoGame(over));
|
||||
const livePly = $derived(game.moves.length);
|
||||
|
||||
let ply = $state(0);
|
||||
let open = $state<number | null>(null);
|
||||
let arrow = $state(false);
|
||||
let flipped = $state(false);
|
||||
let tab = $state<'moves' | 'talk' | 'stats'>('moves');
|
||||
let thinking = $state(97);
|
||||
let bw = $state(600);
|
||||
let bh = $state(600);
|
||||
const boardSize = $derived(Math.max(240, Math.min(bh, bw - 22 - 38 - 20)));
|
||||
|
||||
// reset to live when the game changes (over toggles)
|
||||
$effect(() => {
|
||||
livePly;
|
||||
ply = livePly;
|
||||
open = null;
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
const t = setInterval(() => (thinking += 1), 1000);
|
||||
const key = (e: KeyboardEvent) => {
|
||||
if (e.key === 'ArrowLeft') ply = Math.max(1, ply - 1);
|
||||
if (e.key === 'ArrowRight') ply = Math.min(livePly, ply + 1);
|
||||
if (e.key === 'Home') ply = 1;
|
||||
if (e.key === 'End') ply = livePly;
|
||||
};
|
||||
window.addEventListener('keydown', key);
|
||||
return () => {
|
||||
clearInterval(t);
|
||||
window.removeEventListener('keydown', key);
|
||||
};
|
||||
});
|
||||
|
||||
const cur = $derived(game.moves[ply - 1]);
|
||||
const fen = $derived(cur?.fen ?? game.startFen);
|
||||
const isLive = $derived(ply === livePly && !over);
|
||||
const lastTalk = $derived([...game.moves.slice(0, ply)].reverse().find((m) => m.talk));
|
||||
const viewers = $derived(liveGames[0].viewers);
|
||||
|
||||
// engine best from the viewed position: recorded on the next move (or the next move itself if it was best)
|
||||
const bestArrow = $derived.by((): [string, string] | null => {
|
||||
const next = game.moves[ply];
|
||||
if (next) return next.bestFrom && next.bestTo ? [next.bestFrom, next.bestTo] : [next.from, next.to];
|
||||
if (!over) return ['e6', 'g6']; // live position: SF suggests Rg6
|
||||
return null;
|
||||
});
|
||||
|
||||
const rule = $derived(cur?.rule);
|
||||
const fiftyLit = $derived((rule?.fifty ?? 0) >= 40);
|
||||
const repLit = $derived((rule?.repetition ?? 0) >= 2);
|
||||
const whiteWon = $derived(game.result === '1-0');
|
||||
const blackWon = $derived(game.result === '0-1');
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{game.white.short} — {game.black.short} · {over ? 'Финал' : 'Эфир'} · AI·CHESS</title>
|
||||
</svelte:head>
|
||||
|
||||
<section class="stage" class:over>
|
||||
<div class="top">
|
||||
<Scorebug {game} ply={livePly} thinkingSec={thinking} {over} />
|
||||
<div class="strip">
|
||||
<div class="l">
|
||||
{#if over}
|
||||
<span class="tag gold">Финал</span>
|
||||
<span class="reason">{game.result?.replace('-', '–')} · {game.resultReason}</span>
|
||||
{:else}
|
||||
<span class="tag live"><span class="live-dot"></span>Прямой эфир</span>
|
||||
<span class="viewers mono">👁 {viewers}</span>
|
||||
{/if}
|
||||
<Flags flags={game.flags} />
|
||||
{#if game.scheduled}<span class="tag ghost">По расписанию</span>{/if}
|
||||
</div>
|
||||
<div class="r">
|
||||
<span class="rule" class:lit={!!rule?.castling}><i></i>{rule?.castling ? `Рокировка: ${rule.castling}` : 'Рокировки нет'}</span>
|
||||
<span class="rule" class:lit={fiftyLit} class:warn={fiftyLit}><i></i>50 ходов: {rule?.fifty ?? 0}/50</span>
|
||||
<span class="rule" class:lit={repLit} class:warn={repLit}><i></i>Повторений: {rule?.repetition ?? 1}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- mobile tabs -->
|
||||
<div class="mtabs">
|
||||
<button class:on={tab === 'moves'} onclick={() => (tab = 'moves')}>Ходы</button>
|
||||
<button class:on={tab === 'talk'} onclick={() => (tab = 'talk')}>Треш-ток</button>
|
||||
<button class:on={tab === 'stats'} onclick={() => (tab = 'stats')}>{over ? 'Итоги' : 'Аналитика'}</button>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
<aside class="left" class:mhide={tab !== (over ? 'stats' : 'talk')}>
|
||||
{#if over && game.interviews}
|
||||
<div class="result panel">
|
||||
<div class="rbig display">{game.result?.replace('-', '–')}</div>
|
||||
<div class="rtxt">
|
||||
<b class="display">{blackWon ? game.black.name : whiteWon ? game.white.name : 'Ничья'}</b>
|
||||
<span>{game.resultReason}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thumbwrap">
|
||||
<Thumb white={game.white} black={game.black} thumb={game.thumb} result={game.result} />
|
||||
<div class="thumbcap kicker">Превью матча · сгенерировано</div>
|
||||
</div>
|
||||
<Interview entity={game.black} persona={game.blackPersona} color="b" text={game.interviews.black} won={blackWon} delay={100} />
|
||||
<Interview entity={game.white} persona={game.whitePersona} color="w" text={game.interviews.white} won={whiteWon} delay={300} />
|
||||
<div class="panel"><Predict white={game.white} black={game.black} pred={game.prediction} locked result={game.result} compact /></div>
|
||||
{:else}
|
||||
<div class="panel talkpanel"><TalkFeed {game} {ply} onselect={(p) => (ply = p)} /></div>
|
||||
<div class="panel"><Predict white={game.white} black={game.black} pred={game.prediction} locked compact /></div>
|
||||
<div class="panel"><CostMeter {game} {ply} /></div>
|
||||
{/if}
|
||||
</aside>
|
||||
|
||||
<div class="center">
|
||||
<div class="mobile-eval"><EvalBar cp={cur?.evalCp ?? 20} horizontal /></div>
|
||||
<div class="boardwrap" bind:clientWidth={bw} bind:clientHeight={bh}>
|
||||
<div class="evalcol" style:height="{boardSize}px"><EvalBar cp={cur?.evalCp ?? 20} /></div>
|
||||
<div class="boardbox" style:--size="{boardSize}px">
|
||||
<Board {fen} lastMove={cur ? [cur.from, cur.to] : undefined} check={cur?.check} orientation={flipped ? 'black' : 'white'} arrow={arrow ? bestArrow : null} />
|
||||
{#if !isLive && !over}
|
||||
<div class="replay display"><span class="live-dot"></span>Повтор · ход {cur?.moveNo}{cur?.color === 'w' ? '' : '…'} <button onclick={() => (ply = livePly)}>в эфир ▸</button></div>
|
||||
{/if}
|
||||
{#if over && ply === livePly}
|
||||
<div class="ribbon">
|
||||
<div class="rb display">
|
||||
<span class="score">{game.result?.replace('-', '–')}</span>
|
||||
<span class="who">{blackWon ? game.black.name : whiteWon ? game.white.name : 'Ничья'}</span>
|
||||
<span class="why">{game.resultReason}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if cur && cur.cls !== 'book' && cur.cls !== 'good' && cur.cls !== 'best'}
|
||||
<div class="clsbadge display" style:--c={cur.cls === 'brilliant' ? 'var(--gold)' : cur.cls === 'inaccuracy' ? 'var(--warn)' : cur.cls === 'mistake' ? 'var(--fire)' : 'var(--bad)'}>
|
||||
{cur.cls === 'brilliant' ? '!!' : cur.cls === 'inaccuracy' ? '?!' : cur.cls === 'mistake' ? '?' : '??'}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="tools">
|
||||
<button class="tb" class:on={arrow} onclick={() => (arrow = !arrow)} title="Стрелка лучшего хода Stockfish">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M4 12h12.17l-4.58 4.59L13 18l7-7-7-7-1.41 1.41L16.17 10H4z"/></svg>
|
||||
<span>SF</span>
|
||||
</button>
|
||||
<button class="tb" class:on={flipped} onclick={() => (flipped = !flipped)} title="Перевернуть доску">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M7 7h10v3l4-4-4-4v3H5v6h2zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2z"/></svg>
|
||||
</button>
|
||||
<div class="nav">
|
||||
<button class="tb" onclick={() => (ply = 1)} disabled={ply <= 1}>⏮</button>
|
||||
<button class="tb" onclick={() => (ply = Math.max(1, ply - 1))} disabled={ply <= 1}>◂</button>
|
||||
<button class="tb" onclick={() => (ply = Math.min(livePly, ply + 1))} disabled={ply >= livePly}>▸</button>
|
||||
<button class="tb" onclick={() => (ply = livePly)} disabled={ply >= livePly}>⏭</button>
|
||||
</div>
|
||||
<span class="plyinfo mono">{cur ? `${cur.moveNo}${cur.color === 'w' ? '.' : '…'}${cur.san}` : 'старт'} · {fmt.evalStr(cur?.evalCp ?? 20)}</span>
|
||||
</div>
|
||||
</div>
|
||||
{#if lastTalk}
|
||||
<div class="lower">
|
||||
<LowerThird
|
||||
entity={lastTalk.color === 'w' ? game.white : game.black}
|
||||
persona={lastTalk.color === 'w' ? game.whitePersona : game.blackPersona}
|
||||
color={lastTalk.color}
|
||||
text={lastTalk.talk!}
|
||||
kicker={over && ply === livePly ? 'Последнее слово' : 'Треш-ток'}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<aside class="right" class:mhide={tab !== 'moves'}>
|
||||
<div class="panel graphpanel">
|
||||
<div class="panel-head">
|
||||
<span>Оценка · Stockfish 17</span>
|
||||
<span class="acc">
|
||||
<span style:color="var(--white-corner)">{game.white.short}</span>
|
||||
<span class="mono">{fmt.evalStr(cur?.evalCp ?? 20)}</span>
|
||||
<span style:color="var(--black-corner)">{game.black.short}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="graphbody">
|
||||
<EvalGraph moves={game.moves.slice(0, livePly)} {ply} total={over ? livePly : 60} onselect={(p) => (ply = p)} height={96} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel movespanel">
|
||||
<MoveList {game} bind:ply bind:open {livePly} />
|
||||
</div>
|
||||
<div class="hint kicker">Клик по ходу — позиция + мысли агента · ← → листать</div>
|
||||
</aside>
|
||||
|
||||
<!-- mobile-only stats tab -->
|
||||
<aside class="mstats" class:mhide={tab !== 'stats'}>
|
||||
{#if !over}
|
||||
<div class="panel"><Predict white={game.white} black={game.black} pred={game.prediction} locked compact /></div>
|
||||
<div class="panel"><CostMeter {game} {ply} /></div>
|
||||
{/if}
|
||||
</aside>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.stage {
|
||||
--nav: 52px;
|
||||
--ticker: 34px;
|
||||
height: calc(100vh - var(--nav) - var(--ticker));
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 1400px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 10px 20px 8px;
|
||||
gap: 8px;
|
||||
min-height: 0;
|
||||
}
|
||||
.top {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.strip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding: 6px 2px 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.strip .l,
|
||||
.strip .r {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.viewers,
|
||||
.reason {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.reason {
|
||||
color: var(--text-2);
|
||||
}
|
||||
.rule {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
font-size: 10.5px;
|
||||
color: var(--dim);
|
||||
padding: 3px 8px 2px;
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.rule i {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--line-2);
|
||||
}
|
||||
.rule.lit {
|
||||
color: var(--text-2);
|
||||
border-color: var(--line-2);
|
||||
}
|
||||
.rule.lit i {
|
||||
background: var(--ice);
|
||||
}
|
||||
.rule.warn {
|
||||
color: #140f00;
|
||||
background: var(--warn);
|
||||
border-color: var(--warn);
|
||||
animation: blink 1.6s steps(1) infinite;
|
||||
}
|
||||
.rule.warn i {
|
||||
background: #140f00;
|
||||
}
|
||||
|
||||
.grid {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(260px, 300px) 1fr minmax(330px, 370px);
|
||||
gap: 10px;
|
||||
}
|
||||
aside {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-height: 0;
|
||||
}
|
||||
.left .talkpanel {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
}
|
||||
.right .movespanel {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
}
|
||||
.right .graphpanel {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.graphbody {
|
||||
padding: 6px;
|
||||
}
|
||||
.acc {
|
||||
display: inline-flex;
|
||||
gap: 8px;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.hint {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: var(--dim);
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.mstats {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
gap: 10px;
|
||||
}
|
||||
.boardwrap {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 22px auto 38px;
|
||||
gap: 10px;
|
||||
justify-content: center;
|
||||
align-items: start;
|
||||
align-content: center;
|
||||
}
|
||||
.evalcol {
|
||||
height: 100%;
|
||||
}
|
||||
.boardbox {
|
||||
width: var(--size);
|
||||
height: var(--size);
|
||||
position: relative;
|
||||
box-shadow:
|
||||
0 0 0 1px #000,
|
||||
0 30px 80px rgba(0, 0, 0, 0.7),
|
||||
0 0 60px color-mix(in srgb, var(--gold) 10%, transparent);
|
||||
}
|
||||
.boardbox :global(.board) {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.replay {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 8px;
|
||||
z-index: 5;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: var(--live);
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.14em;
|
||||
padding: 4px 10px 3px;
|
||||
clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
|
||||
animation: stinger-in 0.3s ease-out;
|
||||
}
|
||||
.replay button {
|
||||
background: #fff;
|
||||
color: var(--live);
|
||||
font-family: var(--display);
|
||||
font-size: 10px;
|
||||
padding: 1px 6px 0;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.clsbadge {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
z-index: 5;
|
||||
background: var(--c);
|
||||
color: #000;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
padding: 2px 10px 0;
|
||||
line-height: 1.1;
|
||||
clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
|
||||
animation: rise 0.3s ease-out;
|
||||
}
|
||||
.ribbon {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 6;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, 0.55) 50%, transparent 70%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.rb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18px;
|
||||
background: linear-gradient(90deg, var(--gold), #ffe08a 50%, var(--gold));
|
||||
color: #140f00;
|
||||
padding: 10px 30px 8px;
|
||||
clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
|
||||
animation: stinger-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
}
|
||||
.rb .score {
|
||||
font-size: 44px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
}
|
||||
.rb .who {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.rb .why {
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.1em;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.tools {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
}
|
||||
.tb {
|
||||
width: 38px;
|
||||
height: 32px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 3px;
|
||||
background: var(--panel-2);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--muted);
|
||||
font-family: var(--display);
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.tb:hover:not(:disabled) {
|
||||
color: var(--text);
|
||||
border-color: var(--line-2);
|
||||
}
|
||||
.tb:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: default;
|
||||
}
|
||||
.tb.on {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
border-color: var(--gold);
|
||||
}
|
||||
.tools .nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.plyinfo {
|
||||
writing-mode: vertical-rl;
|
||||
font-size: 10px;
|
||||
color: var(--dim);
|
||||
margin-top: 8px;
|
||||
}
|
||||
.lower {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.mobile-eval,
|
||||
.mtabs {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.result {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 10px 14px;
|
||||
border-left: 4px solid var(--gold);
|
||||
}
|
||||
.rbig {
|
||||
font-size: 40px;
|
||||
font-weight: 700;
|
||||
color: var(--gold);
|
||||
}
|
||||
.rtxt {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.rtxt b {
|
||||
font-size: 18px;
|
||||
}
|
||||
.rtxt span {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.thumbcap {
|
||||
margin-top: 4px;
|
||||
font-size: 9.5px;
|
||||
}
|
||||
.over .left {
|
||||
overflow-y: auto;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--line-2) transparent;
|
||||
padding-right: 2px;
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.grid {
|
||||
grid-template-columns: 1fr minmax(320px, 380px);
|
||||
}
|
||||
.left {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media (max-width: 860px) {
|
||||
.stage {
|
||||
height: auto;
|
||||
padding: 8px 10px 12px;
|
||||
}
|
||||
.grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.left,
|
||||
.mstats {
|
||||
display: flex;
|
||||
}
|
||||
.mhide {
|
||||
display: none !important;
|
||||
}
|
||||
.mtabs {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
order: 3;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--panel);
|
||||
}
|
||||
.mtabs button {
|
||||
font-family: var(--display);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
font-size: 12px;
|
||||
padding: 10px 0 9px;
|
||||
color: var(--muted);
|
||||
border-bottom: 2px solid transparent;
|
||||
}
|
||||
.mtabs button.on {
|
||||
color: var(--text);
|
||||
border-bottom-color: var(--gold);
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
.center {
|
||||
order: 1;
|
||||
}
|
||||
.grid {
|
||||
display: contents;
|
||||
}
|
||||
.left,
|
||||
.right,
|
||||
.mstats {
|
||||
order: 4;
|
||||
}
|
||||
.strip .r {
|
||||
display: none;
|
||||
}
|
||||
.mobile-eval {
|
||||
display: block;
|
||||
}
|
||||
.boardwrap {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 8px;
|
||||
}
|
||||
.evalcol {
|
||||
display: none;
|
||||
}
|
||||
.boardbox {
|
||||
height: auto;
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
box-shadow: 0 0 0 1px #000, 0 14px 40px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
.tools {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
}
|
||||
.tools .nav {
|
||||
flex-direction: row;
|
||||
margin-top: 0;
|
||||
}
|
||||
.plyinfo {
|
||||
writing-mode: horizontal-tb;
|
||||
margin-top: 0;
|
||||
margin-left: auto;
|
||||
}
|
||||
.right .movespanel {
|
||||
height: 460px;
|
||||
flex: none;
|
||||
}
|
||||
.left .talkpanel {
|
||||
height: 460px;
|
||||
flex: none;
|
||||
}
|
||||
.rb {
|
||||
gap: 10px;
|
||||
padding: 8px 18px 6px;
|
||||
}
|
||||
.rb .score {
|
||||
font-size: 30px;
|
||||
}
|
||||
.rb .who {
|
||||
font-size: 15px;
|
||||
}
|
||||
.rb .why {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,367 @@
|
||||
<script lang="ts">
|
||||
import { entities, personas, byId, type Persona } from '#lib/mock.js';
|
||||
import Mark from '#lib/components/Mark.svelte';
|
||||
|
||||
const ai = entities.filter((e) => e.vendor !== 'human');
|
||||
const me = byId('danosito');
|
||||
|
||||
let white = $state<string>('me');
|
||||
let black = $state<string>('claude-opus-5-5:max');
|
||||
let wp = $state<Persona>('Молчун');
|
||||
let bp = $state<Persona>('Уличный гопник');
|
||||
let notes = $state(false);
|
||||
let tools = $state(false);
|
||||
let cheat = $state(false);
|
||||
let scheduleAt = $state('');
|
||||
|
||||
const pick = (id: string) => (id === 'me' ? me : byId(id));
|
||||
const estCost = $derived((white === 'me' ? 0 : pick(white).costPerGame) + (black === 'me' ? 0 : pick(black).costPerGame));
|
||||
</script>
|
||||
|
||||
<svelte:head><title>Новый матч · AI·CHESS</title></svelte:head>
|
||||
|
||||
<div class="wrap new">
|
||||
<div class="head">
|
||||
<h1 class="display"><span class="tag gold">Карточка боя</span> Новый матч</h1>
|
||||
<span class="kicker">Шаг 1 из 1 · всё на одном экране</span>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
{#snippet corner(side: 'w' | 'b', sel: string, setSel: (v: string) => void, persona: Persona, setPersona: (p: Persona) => void)}
|
||||
<section class="corner panel {side}">
|
||||
<div class="panel-head"><span>{side === 'w' ? 'Белые' : 'Чёрные'}</span><span class="kicker">{side === 'w' ? 'левый угол' : 'правый угол'}</span></div>
|
||||
<div class="body">
|
||||
<div class="chosen">
|
||||
<Mark entity={pick(sel)} size={64} corner={side === 'w' ? 'white' : 'black'} />
|
||||
<div>
|
||||
<b class="display">{pick(sel).name} {#if pick(sel).variant}<i class="var" class:max={pick(sel).variant === 'MAX'}>{pick(sel).variant}</i>{/if}</b>
|
||||
<div class="sub">{pick(sel).rating} Elo · {sel === 'me' ? 'это вы' : pick(sel).vendor === 'anthropic' ? 'Anthropic' : 'OpenAI'}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="opts">
|
||||
<button class="opt me" class:on={sel === 'me'} onclick={() => setSel('me')}>
|
||||
<Mark entity={me} size={28} flat /><span>Я сам</span>
|
||||
</button>
|
||||
{#each ai as e}
|
||||
<button class="opt" class:on={sel === e.id} onclick={() => setSel(e.id)}>
|
||||
<Mark entity={e} size={28} flat />
|
||||
<span>{e.short}</span>
|
||||
<i class="var" class:max={e.variant === 'MAX'}>{e.variant}</i>
|
||||
<small class="mono">{e.rating}</small>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{#if sel !== 'me'}
|
||||
<div class="plabel kicker">Персона</div>
|
||||
<div class="personas">
|
||||
{#each personas as p}
|
||||
<button class="pers" class:on={persona === p.id} onclick={() => setPersona(p.id)} title={p.desc}>
|
||||
<b>{p.id}</b>
|
||||
<span>«{p.sample}»</span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
{/snippet}
|
||||
|
||||
{@render corner('w', white, (v) => (white = v), wp, (p) => (wp = p))}
|
||||
|
||||
<section class="mid">
|
||||
<div class="vs display">VS</div>
|
||||
<div class="panel flags">
|
||||
<div class="panel-head"><span>Экспериментальные флаги</span></div>
|
||||
<label class="flag">
|
||||
<input type="checkbox" bind:checked={notes} />
|
||||
<span class="box"></span>
|
||||
<span class="t"><b>Заметки себе</b><small>Агент получает свою записку с прошлого хода. Чуть больше памяти, чуть меньше хаоса.</small></span>
|
||||
</label>
|
||||
<label class="flag">
|
||||
<input type="checkbox" bind:checked={tools} />
|
||||
<span class="box"></span>
|
||||
<span class="t"><b>Доп. тулы</b><small><code>get_move_history</code> + <code>python</code> с python-chess. Думает дольше, зевает реже.</small></span>
|
||||
</label>
|
||||
<label class="flag danger" class:on={cheat}>
|
||||
<input type="checkbox" bind:checked={cheat} />
|
||||
<span class="box"></span>
|
||||
<span class="t"><b>Читерство</b><small>Нелегальные ходы разрешены. Партия <b>без рейтинга</b> и помечена во всех списках.</small></span>
|
||||
</label>
|
||||
{#if cheat}<div class="warn tag bad">⚠ Рейтинг не изменится. Зрители увидят метку «читерство».</div>{/if}
|
||||
</div>
|
||||
<div class="panel sched">
|
||||
<div class="panel-head"><span>Расписание</span><span class="kicker">только админ</span></div>
|
||||
<div class="body">
|
||||
<label class="row"><span>Начать</span>
|
||||
<select bind:value={scheduleAt}>
|
||||
<option value="">сейчас</option>
|
||||
<option value="20">сегодня 20:00 — с прогнозами</option>
|
||||
<option value="tmrw">завтра 19:00 — с прогнозами</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="est"><span class="kicker">Оценка стоимости</span><b class="display">${estCost.toFixed(0)}</b><small>по средним расходам участников</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="/match/demo" class="btn live go">Начать матч ▸</a>
|
||||
</section>
|
||||
|
||||
{@render corner('b', black, (v) => (black = v), bp, (p) => (bp = p))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.new {
|
||||
padding-top: 18px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 26px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 340px 1fr;
|
||||
gap: 14px;
|
||||
align-items: start;
|
||||
}
|
||||
.corner .body {
|
||||
padding: 12px;
|
||||
}
|
||||
.chosen {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.chosen b {
|
||||
font-size: 20px;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
.sub {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
.var {
|
||||
font-style: normal;
|
||||
font-family: var(--display);
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.14em;
|
||||
padding: 2px 5px 1px;
|
||||
background: var(--panel-3);
|
||||
color: var(--text-2);
|
||||
}
|
||||
.var.max {
|
||||
background: var(--gold);
|
||||
color: #140f00;
|
||||
}
|
||||
.opts {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 6px;
|
||||
}
|
||||
.opt > span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.opt {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 8px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border: 1px solid var(--line);
|
||||
font-family: var(--display);
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.04em;
|
||||
text-align: left;
|
||||
}
|
||||
.opt small {
|
||||
margin-left: auto;
|
||||
color: var(--dim);
|
||||
font-size: 10px;
|
||||
}
|
||||
.opt:hover {
|
||||
border-color: var(--line-2);
|
||||
}
|
||||
.opt.on {
|
||||
border-color: var(--gold);
|
||||
background: color-mix(in srgb, var(--gold) 10%, transparent);
|
||||
}
|
||||
.plabel {
|
||||
margin: 14px 0 6px;
|
||||
}
|
||||
.personas {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.pers {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
padding: 7px 10px;
|
||||
text-align: left;
|
||||
border: 1px solid var(--line);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
.pers b {
|
||||
font-family: var(--display);
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.04em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pers span {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pers.on {
|
||||
border-color: var(--gold);
|
||||
background: color-mix(in srgb, var(--gold) 10%, transparent);
|
||||
}
|
||||
.pers.on span {
|
||||
color: var(--text-2);
|
||||
}
|
||||
.mid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.vs {
|
||||
text-align: center;
|
||||
font-size: 54px;
|
||||
font-weight: 700;
|
||||
color: transparent;
|
||||
-webkit-text-stroke: 1px var(--gold);
|
||||
line-height: 1;
|
||||
padding: 10px 0 4px;
|
||||
}
|
||||
.flag {
|
||||
display: grid;
|
||||
grid-template-columns: 18px 1fr;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
cursor: pointer;
|
||||
}
|
||||
.flag input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
}
|
||||
.flag .box {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 1px solid var(--line-2);
|
||||
margin-top: 2px;
|
||||
position: relative;
|
||||
}
|
||||
.flag input:checked + .box {
|
||||
background: var(--gold);
|
||||
border-color: var(--gold);
|
||||
}
|
||||
.flag input:checked + .box::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 2px;
|
||||
width: 4px;
|
||||
height: 9px;
|
||||
border: solid #140f00;
|
||||
border-width: 0 2px 2px 0;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.flag .t {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.flag .t b {
|
||||
font-family: var(--display);
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.flag .t small {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
line-height: 1.4;
|
||||
}
|
||||
.flag.danger input:checked + .box {
|
||||
background: var(--bad);
|
||||
border-color: var(--bad);
|
||||
}
|
||||
.flag.danger.on {
|
||||
background: color-mix(in srgb, var(--bad) 10%, transparent);
|
||||
}
|
||||
.warn {
|
||||
margin: 10px 12px;
|
||||
display: flex;
|
||||
clip-path: none;
|
||||
padding: 6px 10px;
|
||||
letter-spacing: 0.04em;
|
||||
font-size: 11px;
|
||||
}
|
||||
.sched .body {
|
||||
padding: 10px 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
select {
|
||||
background: var(--panel-3);
|
||||
border: 1px solid var(--line-2);
|
||||
padding: 6px 8px;
|
||||
color: var(--text);
|
||||
font-size: 12px;
|
||||
}
|
||||
.est {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
border-top: 1px solid var(--line);
|
||||
padding-top: 10px;
|
||||
}
|
||||
.est b {
|
||||
font-size: 24px;
|
||||
color: var(--gold);
|
||||
}
|
||||
.est small {
|
||||
color: var(--dim);
|
||||
font-size: 11px;
|
||||
}
|
||||
.go {
|
||||
font-size: 16px;
|
||||
padding: 14px;
|
||||
}
|
||||
@media (max-width: 1000px) {
|
||||
.grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.mid {
|
||||
order: 3;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,3 @@
|
||||
# allow crawling everything by default
|
||||
User-agent: *
|
||||
Disallow:
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "$app/tsconfig",
|
||||
"compilerOptions": {
|
||||
"strict": true
|
||||
},
|
||||
"include": ["src", "vite.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import adapter from '@sveltejs/adapter-static';
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
sveltekit({
|
||||
compilerOptions: {
|
||||
runes: ({ filename }) =>
|
||||
filename.split(/[/\\]/).includes('node_modules') ? undefined : true
|
||||
},
|
||||
adapter: adapter({ fallback: 'index.html', pages: 'build', assets: 'build', strict: false })
|
||||
})
|
||||
]
|
||||
});
|
||||