feat: new branding and collapsible filter sidebar

This commit is contained in:
strsv committed 2026-11-06 05:44:37 +03:00
1 parent d1aee28115
commit e433ca3842
10 files changed
+319 -28

No files matched your search

+2 -1
View File
@@ -17,7 +17,8 @@
## Возможности ## Возможности
- **Библиотека**: 2000+ игр, обложки, жанры, теги, отзывы, часы, статус установки. - **Библиотека**: 2000+ игр, обложки, жанры, теги, отзывы, часы, статус установки.
- **Поиск и фильтры**: по названию, жанру, тегу, статусу, установке, избранному. - **Поиск и фильтры**: по названию, жанру, тегу, статусу, установке, избранному;
панель фильтров сворачивается, закрепляется и на мобильных открывается как drawer.
- **Рекомендации**: 15 профилей настроения или свободный запрос на русском/английском. - **Рекомендации**: 15 профилей настроения или свободный запрос на русском/английском.
- **Похожие игры** в карточке: по тегам и жанрам, переход по клику, кнопка «назад». - **Похожие игры** в карточке: по тегам и жанрам, переход по клику, кнопка «назад».
- **Личные статусы**: `backlog`, `playing`, `played`, `tribute`, `nostalgia`, `ignore`, - **Личные статусы**: `backlog`, `playing`, `played`, `tribute`, `nostalgia`, `ignore`,
Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 KiB

After

Width:  |  Height:  |  Size: 796 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 KiB

After

Width:  |  Height:  |  Size: 710 KiB

+5 -1
View File
@@ -93,7 +93,11 @@ python web/server.py --port 9000
- Поиск по названию, фильтры по статусу/жанру/тегу, «установленные», «не запускались», - Поиск по названию, фильтры по статусу/жанру/тегу, «установленные», «не запускались»,
«избранные», сортировки по названию/времени/отзывам/году/добавлению. «избранные», сортировки по названию/времени/отзывам/году/добавлению.
- Кнопка «Показать ещё» подгружает следующую страницу (по 60 игр). - Кнопка «Показать ещё» подгружает следующую страницу (по 60 игр).
- Сайдбар: прогресс описаний, прогресс перевода, кнопки «догрузить / повторить», - Панель фильтров можно свернуть кнопкой в тулбаре и закрепить (иконка булавки):
закреплённая панель занимает место в сетке, откреплённая открывается как drawer
с затемнением; состояние запоминается. На мобильных панель всегда открывается как drawer.
- Сайдбар: блок «Сервис и перевод» по умолчанию свернут и раскрывается вниз по клику.
Внутри — прогресс описаний и перевода, кнопки «догрузить / повторить»,
«перевести кратко», «полные описания», а также «База игр» с инкрементальным и полным «перевести кратко», «полные описания», а также «База игр» с инкрементальным и полным
обновлением. обновлением.
- Обложки отдаются через `/api/cover/<appid>`: сервер сначала ищет файл в - Обложки отдаются через `/api/cover/<appid>`: сервер сначала ищет файл в
+113
View File
@@ -26,6 +26,118 @@ const grid = $("#grid");
const recoGrid = $("#recoGrid"); const recoGrid = $("#recoGrid");
let descTimer = null; let descTimer = null;
const FILTERS_KEY = "sb.filters";
const mobileMq = window.matchMedia("(max-width: 980px)");
function readFiltersState() {
let saved = {};
try { saved = JSON.parse(localStorage.getItem(FILTERS_KEY) || "{}"); } catch (_) {}
const mobile = mobileMq.matches;
return {
pinned: mobile ? false : saved.pinned !== false,
open: mobile ? false : saved.open !== false,
};
}
let filtersState = readFiltersState();
function saveFiltersState() {
try {
localStorage.setItem(FILTERS_KEY, JSON.stringify({
pinned: filtersState.pinned,
open: filtersState.open,
}));
} catch (_) {}
}
function applyFiltersState() {
const layout = document.querySelector(".layout");
const panel = $("#filtersPanel");
const backdrop = $("#filtersBackdrop");
const toggle = $("#filtersToggle");
const pin = $("#filtersPin");
const mobile = mobileMq.matches;
if (mobile) filtersState.pinned = false;
const pinned = filtersState.pinned;
const open = filtersState.open;
layout.classList.toggle("filters-unpinned", !pinned);
layout.classList.toggle("filters-collapsed", pinned && !open);
panel.classList.toggle("open", !pinned && open);
panel.classList.toggle("pinned", pinned);
backdrop.hidden = !(!pinned && open);
document.body.classList.toggle("drawer-open", !pinned && open);
pin.classList.toggle("active", pinned);
pin.setAttribute("aria-pressed", String(pinned));
pin.title = pinned ? "Открепить фильтры" : "Закрепить фильтры";
toggle.classList.toggle("active", open);
toggle.setAttribute("aria-expanded", String(open));
toggle.title = open ? "Скрыть фильтры" : "Показать фильтры";
}
function toggleFilters() {
filtersState.open = !filtersState.open;
saveFiltersState();
applyFiltersState();
}
function closeFilters() {
filtersState.open = false;
saveFiltersState();
applyFiltersState();
}
$("#filtersToggle").addEventListener("click", toggleFilters);
$("#filtersClose").addEventListener("click", closeFilters);
$("#filtersBackdrop").addEventListener("click", closeFilters);
$("#filtersPin").addEventListener("click", () => {
if (mobileMq.matches) return;
filtersState.pinned = !filtersState.pinned;
filtersState.open = true;
saveFiltersState();
applyFiltersState();
});
mobileMq.addEventListener("change", () => {
if (mobileMq.matches) {
filtersState.pinned = false;
filtersState.open = false;
} else {
filtersState = readFiltersState();
}
applyFiltersState();
});
document.addEventListener("keydown", (e) => {
if (e.key === "Escape" && filtersState.open && !document.querySelector("dialog[open]")) {
closeFilters();
}
});
applyFiltersState();
const MAINTENANCE_KEY = "sb.maintenance";
let maintenanceOpen = false;
try { maintenanceOpen = localStorage.getItem(MAINTENANCE_KEY) === "1"; } catch (_) {}
const maintenance = $("#maintenance");
const maintenanceToggle = $("#maintenanceToggle");
const maintenanceBody = $("#maintenanceBody");
function applyMaintenance(open) {
maintenanceOpen = open;
maintenance.classList.toggle("open", open);
maintenanceToggle.setAttribute("aria-expanded", String(open));
maintenanceBody.inert = !open;
maintenanceBody.setAttribute("aria-hidden", String(!open));
try { localStorage.setItem(MAINTENANCE_KEY, open ? "1" : "0"); } catch (_) {}
}
maintenanceToggle.addEventListener("click", () => applyMaintenance(!maintenanceOpen));
applyMaintenance(maintenanceOpen);
function esc(value) { function esc(value) {
return String(value ?? "") return String(value ?? "")
.replaceAll("&", "&amp;") .replaceAll("&", "&amp;")
@@ -506,6 +618,7 @@ function debounce(fn, ms) {
function switchView(view) { function switchView(view) {
state.view = view; state.view = view;
if (view !== "library") closeFilters();
document.querySelectorAll(".tab").forEach((t) => t.classList.toggle("active", t.dataset.view === view)); document.querySelectorAll(".tab").forEach((t) => t.classList.toggle("active", t.dataset.view === view));
$("#libraryView").classList.toggle("hidden", view !== "library"); $("#libraryView").classList.toggle("hidden", view !== "library");
$("#recommendView").classList.toggle("hidden", view !== "recommend"); $("#recommendView").classList.toggle("hidden", view !== "recommend");
+10 -5
View File
@@ -1,11 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<defs> <defs>
<linearGradient id="g" x1="0" y1="0" x2="1" y2="1"> <linearGradient id="f-bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#f3b45c"/> <stop offset="0" stop-color="#ffd08a"/>
<stop offset=".52" stop-color="#f3b45c"/>
<stop offset="1" stop-color="#5eead4"/> <stop offset="1" stop-color="#5eead4"/>
</linearGradient> </linearGradient>
<linearGradient id="f-play" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#ffffff"/>
<stop offset="1" stop-color="#c8fff5"/>
</linearGradient>
</defs> </defs>
<rect width="64" height="64" rx="16" fill="url(#g)"/> <rect width="64" height="64" rx="16" fill="url(#f-bg)"/>
<text x="32" y="41" text-anchor="middle" font-family="Segoe UI, Arial, sans-serif" <rect x="16" y="16" width="32" height="34" rx="8" fill="#0a0d13"/>
font-size="24" font-weight="800" fill="#090c12">SB</text> <path d="M29 24.5 L41 33 L29 41.5 Z" fill="url(#f-play)"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 672 B

+44 -3
View File
@@ -10,7 +10,7 @@
<body> <body>
<header class="topbar"> <header class="topbar">
<div class="brand"> <div class="brand">
<span class="logo">SB</span> <img class="logo" src="/static/logo.svg" alt="" width="34" height="34">
<span>SteamBase</span> <span>SteamBase</span>
</div> </div>
<nav class="tabs"> <nav class="tabs">
@@ -20,13 +20,25 @@
<div class="stats" id="stats"></div> <div class="stats" id="stats"></div>
</header> </header>
<div id="filtersBackdrop" class="filters-backdrop" hidden></div>
<main> <main>
<section id="libraryView" class="layout"> <section id="libraryView" class="layout">
<aside class="filters"> <aside class="filters" id="filtersPanel">
<div class="filter-head"> <div class="filter-head">
<h2>Фильтры</h2> <h2>Фильтры</h2>
<div class="filter-actions">
<button id="filtersPin" class="icon-btn pin active" type="button"
title="Открепить фильтры" aria-pressed="true">
<svg viewBox="0 0 24 24" width="15" height="15" fill="none"
stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M8 3h8l-1 6 3 3v2H6v-2l3-3-1-6Z"/>
<path d="M12 14v7"/>
</svg>
</button>
<button id="filtersClose" class="icon-btn drawer-close" type="button" title="Закрыть фильтры">×</button>
<button id="resetFilters" class="link">сбросить</button> <button id="resetFilters" class="link">сбросить</button>
</div> </div>
</div>
<label class="field"> <label class="field">
<span>Статус</span> <span>Статус</span>
@@ -55,7 +67,24 @@
<label class="check"><input type="checkbox" id="fUnplayed"> не запускались</label> <label class="check"><input type="checkbox" id="fUnplayed"> не запускались</label>
<label class="check"><input type="checkbox" id="fFavorite"> избранные</label> <label class="check"><input type="checkbox" id="fFavorite"> избранные</label>
<div class="details-progress"> <div class="maintenance" id="maintenance">
<button class="maintenance-toggle" id="maintenanceToggle" type="button"
aria-expanded="false" aria-controls="maintenanceBody">
<span class="maintenance-title">
<svg viewBox="0 0 24 24" width="15" height="15" fill="none"
stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
<path d="M14.7 6.3a4 4 0 0 0-5.4 5.4L4 17v3h3l5.3-5.3a4 4 0 0 0 5.4-5.4l-2.2 2.2-2-2 2.2-2.2Z"/>
</svg>
Сервис и перевод
</span>
<svg class="chev" viewBox="0 0 24 24" width="16" height="16" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M6 9l6 6 6-6"/>
</svg>
</button>
<div class="maintenance-body" id="maintenanceBody" inert aria-hidden="true">
<div class="maintenance-inner details-progress">
<div class="dp-head">Описания <span id="dpCount"></span></div> <div class="dp-head">Описания <span id="dpCount"></span></div>
<div class="bar"><i id="dpBar"></i></div> <div class="bar"><i id="dpBar"></i></div>
<div class="dp-note" id="dpNote"></div> <div class="dp-note" id="dpNote"></div>
@@ -76,10 +105,22 @@
<div class="dp-note" id="jobStatus"></div> <div class="dp-note" id="jobStatus"></div>
</div> </div>
</div> </div>
</div>
</div>
</aside> </aside>
<div class="content"> <div class="content">
<div class="toolbar"> <div class="toolbar">
<button id="filtersToggle" class="icon-btn" type="button" title="Скрыть фильтры"
aria-controls="filtersPanel" aria-expanded="true">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none"
stroke="currentColor" stroke-width="1.8" stroke-linecap="round">
<path d="M4 7h16M4 12h16M4 17h16"/>
<circle cx="9" cy="7" r="2.2" fill="var(--bg)"/>
<circle cx="15" cy="12" r="2.2" fill="var(--bg)"/>
<circle cx="8" cy="17" r="2.2" fill="var(--bg)"/>
</svg>
</button>
<input id="search" type="search" placeholder="Поиск по названию…" autocomplete="off"> <input id="search" type="search" placeholder="Поиск по названию…" autocomplete="off">
<select id="sort"> <select id="sort">
<option value="name">по названию</option> <option value="name">по названию</option>
+24
View File
@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="SteamBase">
<defs>
<linearGradient id="sb-bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#ffd08a"/>
<stop offset=".52" stop-color="#f3b45c"/>
<stop offset="1" stop-color="#5eead4"/>
</linearGradient>
<linearGradient id="sb-play" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#ffffff"/>
<stop offset="1" stop-color="#c8fff5"/>
</linearGradient>
</defs>
<rect width="64" height="64" rx="18" fill="url(#sb-bg)"/>
<g transform="rotate(-9 32 33)">
<rect x="17" y="16" width="33" height="29" rx="7" fill="#0a0d13" opacity=".18"/>
</g>
<g transform="rotate(-4 32 34)">
<rect x="15" y="21" width="35" height="30" rx="7" fill="#0a0d13" opacity=".38"/>
</g>
<rect x="14" y="25" width="36" height="31" rx="8" fill="#0a0d13"/>
<rect x="20" y="33" width="12" height="3" rx="1.5" fill="#5eead4" opacity=".9"/>
<rect x="20" y="39" width="9" height="3" rx="1.5" fill="#f3b45c" opacity=".9"/>
<path d="M36.5 33.5 L47 39.5 L36.5 45.5 Z" fill="url(#sb-play)"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+121 -18
View File
@@ -61,15 +61,11 @@ button { cursor: pointer; }
} }
.logo { .logo {
display: grid; width: 34px;
place-items: center; height: 34px;
width: 30px; flex: 0 0 34px;
height: 30px; display: block;
border-radius: 9px; border-radius: 10px;
font-size: 12px;
font-weight: 800;
color: #0a0d13;
background: linear-gradient(135deg, var(--accent), var(--accent-2));
box-shadow: 0 6px 18px rgba(243, 180, 92, .22); box-shadow: 0 6px 18px rgba(243, 180, 92, .22);
} }
@@ -145,11 +141,79 @@ main { padding: 24px 28px 70px; }
background: linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .008)); background: linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .008));
} }
.filter-head { display: flex; align-items: center; justify-content: space-between; } .layout.filters-collapsed { grid-template-columns: minmax(0, 1fr); }
.layout.filters-collapsed .filters { display: none; }
.layout.filters-unpinned { grid-template-columns: minmax(0, 1fr); }
.layout.filters-unpinned .filters {
position: fixed;
top: 86px;
left: 18px;
width: 268px;
max-height: calc(100vh - 110px);
z-index: 40;
background: #0f1520;
box-shadow: var(--shadow);
opacity: 0;
pointer-events: none;
transform: translateX(calc(-100% - 30px));
transition: transform .22s ease, opacity .22s ease;
will-change: transform;
}
.layout.filters-unpinned .filters.open {
opacity: 1;
pointer-events: auto;
transform: none;
}
.filter-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.filter-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); } .filter-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.filter-actions { display: flex; align-items: center; gap: 8px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-size: 12px; } .link { background: none; border: 0; padding: 0; color: var(--accent); font-size: 12px; }
.link:hover { text-decoration: underline; } .link:hover { text-decoration: underline; }
.icon-btn {
width: 42px;
height: 42px;
flex: 0 0 42px;
display: grid;
place-items: center;
border-radius: 11px;
border: 1px solid var(--border);
background: rgba(255, 255, 255, .03);
color: var(--muted);
transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover {
color: var(--text);
border-color: var(--border-strong);
background: rgba(255, 255, 255, .06);
}
.icon-btn.active {
color: var(--accent);
border-color: rgba(243, 180, 92, .45);
background: rgba(243, 180, 92, .09);
}
.filter-actions .icon-btn {
width: 28px;
height: 28px;
flex-basis: 28px;
border-radius: 8px;
font-size: 17px;
line-height: 1;
}
.drawer-close { display: none; }
.layout.filters-unpinned .drawer-close { display: grid; }
.filters-backdrop {
position: fixed;
inset: 62px 0 0 0;
z-index: 35;
background: rgba(4, 6, 10, .55);
backdrop-filter: blur(2px);
}
body.drawer-open { overflow: hidden; }
.field { display: flex; flex-direction: column; gap: 6px; } .field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--muted); } .field span { font-size: 12px; color: var(--muted); }
@@ -180,10 +244,44 @@ textarea { resize: vertical; min-height: 54px; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; } .check input { accent-color: var(--accent); width: 15px; height: 15px; }
.check:hover { color: var(--text); } .check:hover { color: var(--text); }
.details-progress { .maintenance {
margin-top: 6px; margin-top: 10px;
padding-top: 14px; padding-top: 10px;
border-top: 1px solid var(--border); border-top: 1px solid var(--border);
}
.maintenance-toggle {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 6px 2px;
border: 0;
background: none;
color: var(--muted);
font-size: 12px;
text-align: left;
}
.maintenance-toggle:hover { color: var(--text); }
.maintenance-title { display: flex; align-items: center; gap: 8px; }
.maintenance-title svg { color: var(--accent); }
.maintenance-toggle .chev { transition: transform .25s ease; }
.maintenance.open .maintenance-toggle .chev { transform: rotate(180deg); }
.maintenance-body {
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows .28s ease;
}
.maintenance-body > .maintenance-inner {
overflow: hidden;
min-height: 0;
}
.maintenance.open .maintenance-body { grid-template-rows: 1fr; }
.maintenance-inner > :first-child { margin-top: 12px; }
.details-progress {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
@@ -600,11 +698,16 @@ textarea { resize: vertical; min-height: 54px; }
::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 980px) { @media (max-width: 980px) {
.layout { grid-template-columns: 1fr; } .layout { grid-template-columns: minmax(0, 1fr); }
.filters { position: static; flex-direction: row; flex-wrap: wrap; align-items: flex-end; } .filters-backdrop { inset: 0; }
.filter-head { width: 100%; } .layout.filters-unpinned .filters {
.field { flex: 1 1 160px; } top: 76px;
.details-progress { flex: 1 1 100%; } left: 12px;
width: min(300px, calc(100vw - 24px));
max-height: calc(100vh - 96px);
flex-direction: column;
}
.pin { display: none; }
.modal-grid { grid-template-columns: 1fr; } .modal-grid { grid-template-columns: 1fr; }
.modal-cover { max-height: 260px; } .modal-cover { max-height: 260px; }
} }