feat: initial SteamBase 1.0.0
This commit is contained in:
commit
d1aee28115
37 files changed
+6518
No files matched your search
@@ -0,0 +1,675 @@
|
||||
const CDN = "https://cdn.cloudflare.steamstatic.com/steam/apps";
|
||||
const STATUS_LABEL = {
|
||||
backlog: "в бэклоге",
|
||||
playing: "играю",
|
||||
played: "играл",
|
||||
nostalgia: "в память",
|
||||
tribute: "дань уважения",
|
||||
ignore: "скрыта",
|
||||
};
|
||||
const PER_PAGE = 60;
|
||||
|
||||
const state = {
|
||||
view: "library",
|
||||
page: 1,
|
||||
sort: "review",
|
||||
q: "",
|
||||
filters: { status: "", genre: "", tag: "", installed: false, unplayed: false, favorite: false },
|
||||
preset: null,
|
||||
loading: false,
|
||||
total: 0,
|
||||
meta: null,
|
||||
};
|
||||
|
||||
const $ = (sel) => document.querySelector(sel);
|
||||
const grid = $("#grid");
|
||||
const recoGrid = $("#recoGrid");
|
||||
let descTimer = null;
|
||||
|
||||
function esc(value) {
|
||||
return String(value ?? "")
|
||||
.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll('"', """)
|
||||
.replaceAll("'", "'");
|
||||
}
|
||||
|
||||
function decodeEntities(text) {
|
||||
return String(text ?? "")
|
||||
.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll(""", '"')
|
||||
.replaceAll("'", "'")
|
||||
.replaceAll(" ", " ");
|
||||
}
|
||||
|
||||
function stripHtml(html) {
|
||||
return decodeEntities(String(html ?? "").replace(/<[^>]+>/g, " "))
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
async function api(url, options = {}) {
|
||||
const res = await fetch(url, {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
...options,
|
||||
});
|
||||
if (!res.ok) {
|
||||
let message = res.statusText;
|
||||
try { message = (await res.json()).error || message; } catch (_) {}
|
||||
throw new Error(message);
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
|
||||
function coverUrl(appid) {
|
||||
return `/api/cover/${appid}`;
|
||||
}
|
||||
|
||||
function fmtHours(h) {
|
||||
if (!h) return "не запускалась";
|
||||
if (h < 1) return `${Math.round(h * 60)} мин`;
|
||||
return `${h >= 100 ? Math.round(h) : h.toFixed(1).replace(".0", "")} ч`;
|
||||
}
|
||||
|
||||
function initials(name) {
|
||||
return name.split(/\s+/).slice(0, 2).map((w) => w[0] || "").join("").toUpperCase();
|
||||
}
|
||||
|
||||
function statusChip(status) {
|
||||
if (!status || status === "backlog") return "";
|
||||
return `<span class="status-chip st-${status}">${STATUS_LABEL[status] || status}</span>`;
|
||||
}
|
||||
|
||||
function cardHtml(g, mode = "library") {
|
||||
const review = mode === "reco"
|
||||
? `<span class="badge score">${g.score}</span>`
|
||||
: (g.review != null ? `<span class="badge review ${g.review < 85 ? "warn" : ""}">${g.review}%</span>` : "");
|
||||
const installed = g.installed ? `<span class="badge installed" title="установлена">●</span>` : "";
|
||||
const genres = (g.genres || []).slice(0, 3).map((x) => `<span class="genre">${esc(x)}</span>`).join("");
|
||||
const meta = [
|
||||
g.year ? esc(g.year) : null,
|
||||
mode === "library" ? fmtHours(g.hours) : null,
|
||||
g.rating ? `${g.rating}/10` : null,
|
||||
].filter(Boolean).map((x) => `<span>${x}</span>`).join('<span class="dot"></span>');
|
||||
const desc = g.description
|
||||
? `<p class="card-desc">${esc(decodeEntities(g.description))}</p>`
|
||||
: g.desc_status === "missing"
|
||||
? `<p class="card-desc missing-desc">Краткое описание недоступно</p>`
|
||||
: `<p class="card-desc loading" data-appid="${g.appid}">Описание подгружается…</p>`;
|
||||
const matched = mode === "reco" && g.matched && g.matched.length
|
||||
? `<p class="matched">${g.matched.map(esc).join(" · ")}</p>` : "";
|
||||
return `
|
||||
<article class="card" data-appid="${g.appid}" tabindex="0">
|
||||
<div class="cover">
|
||||
<img data-appid="${g.appid}" loading="lazy" src="${coverUrl(g.appid)}" alt="">
|
||||
<div class="fallback">${esc(initials(g.name))}</div>
|
||||
${review}${installed}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h3 class="card-title">${esc(g.name)}</h3>
|
||||
<div class="card-meta">${meta}</div>
|
||||
<div class="card-genres">${genres}</div>
|
||||
${matched}
|
||||
${desc}
|
||||
<div class="card-status">${statusChip(g.status)}</div>
|
||||
</div>
|
||||
</article>`;
|
||||
}
|
||||
|
||||
function skeletons(n = 12) {
|
||||
return Array.from({ length: n }, () => `
|
||||
<article class="card skeleton">
|
||||
<div class="cover"></div>
|
||||
<div class="card-body">
|
||||
<div class="line" style="width:80%"></div>
|
||||
<div class="line" style="width:50%"></div>
|
||||
<div class="line" style="width:100%;height:40px"></div>
|
||||
</div>
|
||||
</article>`).join("");
|
||||
}
|
||||
|
||||
function attachCoverFallback(img) {
|
||||
if (img.dataset.bound) return;
|
||||
img.dataset.bound = "1";
|
||||
if (img.dataset.step == null) img.dataset.step = "0";
|
||||
const handler = () => {
|
||||
const step = img.dataset.step;
|
||||
if (step === "0") {
|
||||
img.dataset.step = "1";
|
||||
img.src = `${CDN}/${img.dataset.appid}/header.jpg`;
|
||||
} else {
|
||||
img.style.display = "none";
|
||||
img.closest(".cover").classList.add("noimg");
|
||||
}
|
||||
};
|
||||
img.addEventListener("error", handler);
|
||||
if (img.complete && img.naturalWidth === 0) handler();
|
||||
}
|
||||
|
||||
function bindImages(root) {
|
||||
root.querySelectorAll(".cover img").forEach(attachCoverFallback);
|
||||
}
|
||||
|
||||
function bindCards(root) {
|
||||
root.querySelectorAll(".card[data-appid], .mini[data-appid]").forEach((card) => {
|
||||
if (card.dataset.bound) return;
|
||||
card.dataset.bound = "1";
|
||||
const open = () => openGame(card.dataset.appid);
|
||||
card.addEventListener("click", open);
|
||||
if (card.tagName !== "BUTTON") {
|
||||
card.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Enter" || e.key === " ") { e.preventDefault(); open(); }
|
||||
});
|
||||
}
|
||||
});
|
||||
bindImages(root);
|
||||
}
|
||||
|
||||
function scheduleDescriptions() {
|
||||
clearTimeout(descTimer);
|
||||
descTimer = setTimeout(fillDescriptions, 3000);
|
||||
}
|
||||
|
||||
async function fillDescriptions() {
|
||||
const nodes = [...document.querySelectorAll(".card-desc.loading")];
|
||||
if (!nodes.length) return;
|
||||
const ids = [...new Set(nodes.map((n) => n.dataset.appid))];
|
||||
try {
|
||||
const data = await api(`/api/descriptions?ids=${ids.join(",")}`);
|
||||
nodes.forEach((node) => {
|
||||
const text = data[node.dataset.appid];
|
||||
if (text) {
|
||||
node.classList.remove("loading");
|
||||
node.textContent = decodeEntities(text);
|
||||
}
|
||||
});
|
||||
} catch (_) {}
|
||||
if (document.querySelector(".card-desc.loading")) {
|
||||
descTimer = setTimeout(fillDescriptions, 6000);
|
||||
}
|
||||
}
|
||||
|
||||
function toast(message) {
|
||||
let el = $("#toast");
|
||||
if (!el) {
|
||||
el = document.createElement("div");
|
||||
el.id = "toast";
|
||||
el.className = "toast";
|
||||
document.body.appendChild(el);
|
||||
}
|
||||
el.textContent = message;
|
||||
el.classList.add("show");
|
||||
clearTimeout(el._timer);
|
||||
el._timer = setTimeout(() => el.classList.remove("show"), 2600);
|
||||
}
|
||||
|
||||
/* ---------- meta ---------- */
|
||||
|
||||
async function loadMeta() {
|
||||
const meta = await api("/api/meta");
|
||||
state.meta = meta;
|
||||
$("#stats").innerHTML = [
|
||||
`<span class="stat"><b>${meta.total}</b> игр</span>`,
|
||||
`<span class="stat"><b>${meta.played}</b> играл</span>`,
|
||||
`<span class="stat"><b>${meta.hours.toLocaleString("ru-RU")}</b> ч</span>`,
|
||||
`<span class="stat"><b>${meta.installed}</b> установлено</span>`,
|
||||
`<span class="stat"><b>${meta.cached}</b> описаний</span>`,
|
||||
].join("");
|
||||
|
||||
const genre = $("#fGenre");
|
||||
const current = genre.value;
|
||||
genre.innerHTML = '<option value="">любой</option>' + meta.genres
|
||||
.map((g) => `<option value="${esc(g.name)}">${esc(g.name)} (${g.count})</option>`).join("");
|
||||
genre.value = current;
|
||||
|
||||
const tag = $("#fTag");
|
||||
const currentTag = tag.value;
|
||||
tag.innerHTML = '<option value="">любой</option>' + meta.tags
|
||||
.map((t) => `<option value="${esc(t.name)}">${esc(t.name)} (${t.count})</option>`).join("");
|
||||
tag.value = currentTag;
|
||||
|
||||
const processed = meta.cached + (meta.missing || 0);
|
||||
const pct = meta.total ? Math.round((processed / meta.total) * 100) : 0;
|
||||
$("#dpCount").textContent = `${meta.cached} / ${meta.total}`;
|
||||
$("#dpBar").style.width = `${pct}%`;
|
||||
$("#dpNote").textContent = meta.missing || meta.pending
|
||||
? `${meta.missing || 0} недоступно · ${meta.pending || 0} в очереди`
|
||||
: "все описания загружены";
|
||||
|
||||
const trTotal = (meta.translated || 0) + (meta.translate_pending || 0);
|
||||
$("#trCount").textContent = trTotal ? `${meta.translated} / ${trTotal}` : "—";
|
||||
$("#trBar").style.width = trTotal ? `${Math.round((meta.translated / trTotal) * 100)}%` : "0%";
|
||||
$("#trNote").textContent = trTotal
|
||||
? (meta.translate_pending ? `${meta.translate_pending} осталось` : "всё переведено")
|
||||
: "не требуется";
|
||||
}
|
||||
|
||||
/* ---------- library ---------- */
|
||||
|
||||
function filterParams() {
|
||||
const p = new URLSearchParams();
|
||||
if (state.q) p.set("q", state.q);
|
||||
if (state.filters.status) p.set("status", state.filters.status);
|
||||
if (state.filters.genre) p.set("genre", state.filters.genre);
|
||||
if (state.filters.tag) p.set("tag", state.filters.tag);
|
||||
if (state.filters.installed) p.set("installed", "1");
|
||||
if (state.filters.unplayed) p.set("unplayed", "1");
|
||||
if (state.filters.favorite) p.set("favorite", "1");
|
||||
p.set("sort", state.sort);
|
||||
p.set("per_page", PER_PAGE);
|
||||
return p;
|
||||
}
|
||||
|
||||
async function loadGames(reset = true) {
|
||||
if (state.loading) return;
|
||||
state.loading = true;
|
||||
$("#more").disabled = true;
|
||||
if (reset) {
|
||||
state.page = 1;
|
||||
state.total = 0;
|
||||
grid.innerHTML = skeletons(12);
|
||||
}
|
||||
try {
|
||||
const params = filterParams();
|
||||
params.set("page", state.page);
|
||||
const data = await api(`/api/games?${params}`);
|
||||
if (reset) grid.innerHTML = "";
|
||||
if (!data.items.length && reset) {
|
||||
grid.innerHTML = '<div class="empty">ничего не нашлось — ослабь фильтры</div>';
|
||||
}
|
||||
grid.insertAdjacentHTML("beforeend", data.items.map((g) => cardHtml(g)).join(""));
|
||||
bindCards(grid);
|
||||
state.total = data.total;
|
||||
$("#count").textContent = `${data.total.toLocaleString("ru-RU")} игр`;
|
||||
state.page += 1;
|
||||
$("#more").classList.toggle("hidden", state.page * PER_PAGE > data.total);
|
||||
scheduleDescriptions();
|
||||
} catch (err) {
|
||||
toast(err.message);
|
||||
} finally {
|
||||
state.loading = false;
|
||||
$("#more").disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- recommendations ---------- */
|
||||
|
||||
async function loadMoods() {
|
||||
try {
|
||||
const data = await api("/api/moods");
|
||||
const box = $("#moodChips");
|
||||
box.innerHTML = data.moods.map((m) =>
|
||||
`<button class="chip" data-preset="${esc(m.name)}" title="${esc(m.description)}">${esc(m.description)}</button>`
|
||||
).join("");
|
||||
box.querySelectorAll(".chip").forEach((chip) => {
|
||||
chip.addEventListener("click", () => {
|
||||
const active = chip.classList.contains("active");
|
||||
box.querySelectorAll(".chip").forEach((c) => c.classList.remove("active"));
|
||||
if (active) {
|
||||
state.preset = null;
|
||||
} else {
|
||||
chip.classList.add("active");
|
||||
state.preset = chip.dataset.preset;
|
||||
$("#moodText").value = "";
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
toast(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function runRecommend(scroll = true) {
|
||||
const text = $("#moodText").value.trim();
|
||||
if (!state.preset && !text) {
|
||||
toast("Выбери профиль или опиши настроение");
|
||||
return;
|
||||
}
|
||||
const btn = $("#recommendBtn");
|
||||
btn.disabled = true;
|
||||
recoGrid.innerHTML = skeletons(8);
|
||||
try {
|
||||
const body = {
|
||||
preset: state.preset,
|
||||
mood: state.preset ? null : text,
|
||||
unplayed_only: $("#optUnplayed").checked,
|
||||
include_tribute: $("#optTribute").checked,
|
||||
include_nostalgia: $("#optNostalgia").checked,
|
||||
min_review: Number($("#optReview").value),
|
||||
limit: 36,
|
||||
};
|
||||
const data = await api("/api/recommend", { method: "POST", body: JSON.stringify(body) });
|
||||
const mood = data.mood;
|
||||
$("#recoSummary").classList.remove("hidden");
|
||||
$("#recoSummary").innerHTML = `
|
||||
<div><b>${esc(mood.description || "подборка")}</b></div>
|
||||
<div class="chips">${(mood.tags ? Object.keys(mood.tags) : []).map((t) => `<span class="genre">${esc(t)}</span>`).join("")}</div>
|
||||
<div>${data.results.length} совпадений</div>`;
|
||||
recoGrid.innerHTML = data.results.length
|
||||
? data.results.map((g) => cardHtml(g, "reco")).join("")
|
||||
: '<div class="empty">ничего не нашлось — попробуй другие слова</div>';
|
||||
bindCards(recoGrid);
|
||||
scheduleDescriptions();
|
||||
if (scroll) $("#recoSummary").scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
} catch (err) {
|
||||
toast(err.message);
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- game modal ---------- */
|
||||
|
||||
function modalSkeleton() {
|
||||
return `<div class="modal-grid">
|
||||
<div class="modal-cover"><div class="fallback"></div></div>
|
||||
<div class="modal-body">
|
||||
<div class="line" style="width:60%;height:20px"></div>
|
||||
<div class="line" style="width:40%;margin-top:10px"></div>
|
||||
<div class="line" style="width:100%;height:70px;margin-top:18px"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
const modalStack = [];
|
||||
|
||||
async function openGame(appid, remember = true) {
|
||||
const id = String(appid);
|
||||
const modal = $("#modal");
|
||||
if (remember && modalStack[modalStack.length - 1] !== id) modalStack.push(id);
|
||||
$("#modalBody").innerHTML = modalSkeleton();
|
||||
if (!modal.open) modal.showModal();
|
||||
try {
|
||||
const g = await api(`/api/game/${id}?fetch=1`);
|
||||
renderModal(g);
|
||||
} catch (err) {
|
||||
$("#modalBody").innerHTML = `<div class="modal-body"><p class="muted">${esc(err.message)}</p></div>`;
|
||||
}
|
||||
}
|
||||
|
||||
function renderModal(g) {
|
||||
const statusOptions = Object.entries(STATUS_LABEL)
|
||||
.map(([k, v]) => `<option value="${k}" ${k === g.status ? "selected" : ""}>${v}</option>`).join("");
|
||||
const genres = (g.genres || []).map((x) => `<span class="genre">${esc(x)}</span>`).join("");
|
||||
const tags = (g.tags || []).map((x) => `<span class="genre">${esc(x)}</span>`).join("");
|
||||
const meta = [
|
||||
g.year ? `<span><b>${esc(g.year)}</b></span>` : "",
|
||||
g.review != null ? `<span><b>${g.review}%</b> отзывов</span>` : "",
|
||||
g.metacritic != null ? `<span>MC <b>${g.metacritic}</b></span>` : "",
|
||||
g.hours ? `<span><b>${fmtHours(g.hours)}</b></span>` : "",
|
||||
g.installed ? `<span class="muted">установлена${g.size_gb ? " · " + g.size_gb + " ГБ" : ""}</span>` : "",
|
||||
g.last_played ? `<span class="muted">последний запуск ${esc(g.last_played)}</span>` : "",
|
||||
].filter(Boolean).join("");
|
||||
|
||||
const about = g.about ? stripHtml(g.about) : "";
|
||||
const shortText = g.description
|
||||
? decodeEntities(g.description)
|
||||
: g.desc_status === "missing" ? "Краткое описание недоступно." : "Описание пока не загрузилось.";
|
||||
const attrs = (g.attributes || []).length
|
||||
? `<div class="chip-row">${g.attributes.map((a) => `<span class="genre">${esc(a.key)}: ${esc(a.value)}</span>`).join("")}</div>`
|
||||
: "";
|
||||
const similar = (g.similar || []).length
|
||||
? `<div class="similar-block">
|
||||
<h3>Похожие в библиотеке</h3>
|
||||
<div class="similar-row">
|
||||
${g.similar.map((s) => `
|
||||
<button type="button" class="mini" data-appid="${s.appid}" title="${esc(s.name)}">
|
||||
<div class="cover mini-cover">
|
||||
<img data-appid="${s.appid}" loading="lazy" src="${coverUrl(s.appid)}" alt="">
|
||||
<div class="fallback">${esc(initials(s.name))}</div>
|
||||
</div>
|
||||
<div class="mini-body">
|
||||
<span class="mini-title">${esc(s.name)}</span>
|
||||
<span class="mini-meta">${[s.review != null ? `${s.review}%` : null, s.year].filter(Boolean).join(" · ")}</span>
|
||||
</div>
|
||||
</button>`).join("")}
|
||||
</div>
|
||||
</div>`
|
||||
: "";
|
||||
|
||||
$("#modalBody").innerHTML = `
|
||||
<div class="modal-grid">
|
||||
<div class="modal-cover" id="modalCover">
|
||||
<img data-appid="${g.appid}" src="${coverUrl(g.appid)}" alt="">
|
||||
<div class="fallback">${esc(g.name)}</div>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-top">
|
||||
${modalStack.length > 1 ? `<button class="modal-back" id="modalBack" title="Назад">←</button>` : ""}
|
||||
<h2 class="modal-title">${esc(g.name)}</h2>
|
||||
<button class="modal-close" id="modalClose" title="Закрыть">×</button>
|
||||
</div>
|
||||
<div class="modal-meta">${meta}</div>
|
||||
<div class="chip-row">${genres}</div>
|
||||
<p class="modal-desc">${esc(shortText)}</p>
|
||||
${about ? `<details class="about-block"><summary>Полное описание</summary><p class="modal-desc about">${esc(about.slice(0, 2400))}${about.length > 2400 ? "…" : ""}</p></details>` : ""}
|
||||
${tags ? `<div class="chip-row">${tags}</div>` : ""}
|
||||
${similar}
|
||||
${attrs}
|
||||
<form class="personal" id="personalForm">
|
||||
<h3>Моя отметка</h3>
|
||||
<label>Статус<select id="pStatus">${statusOptions}</select></label>
|
||||
<label>Оценка (1–10)<input id="pRating" type="number" min="1" max="10" value="${g.rating || ""}"></label>
|
||||
<label class="check wide"><input type="checkbox" id="pFavorite" ${g.favorite ? "checked" : ""}> избранное</label>
|
||||
<label class="wide">Заметка<textarea id="pNotes" rows="2">${esc(g.notes || "")}</textarea></label>
|
||||
<div class="personal-actions">
|
||||
<button type="submit" class="save">Сохранить</button>
|
||||
<a class="steam-link" href="${g.steam_url}" target="_blank" rel="noopener">Открыть в Steam</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
attachCoverFallback($("#modalCover img"));
|
||||
|
||||
$("#modalClose").addEventListener("click", () => $("#modal").close());
|
||||
const back = $("#modalBack");
|
||||
if (back) {
|
||||
back.addEventListener("click", () => {
|
||||
modalStack.pop();
|
||||
const prev = modalStack[modalStack.length - 1];
|
||||
if (prev) openGame(prev, false);
|
||||
});
|
||||
}
|
||||
bindCards($("#modalBody"));
|
||||
$("#personalForm").addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
const payload = {
|
||||
status: $("#pStatus").value,
|
||||
rating: Number($("#pRating").value) || 0,
|
||||
favorite: $("#pFavorite").checked,
|
||||
notes: $("#pNotes").value,
|
||||
};
|
||||
const updated = await api(`/api/personal/${g.appid}`, { method: "POST", body: JSON.stringify(payload) });
|
||||
const card = document.querySelector(`.card[data-appid="${g.appid}"] .card-status`);
|
||||
if (card) card.innerHTML = statusChip(updated.status);
|
||||
toast("Сохранено");
|
||||
} catch (err) {
|
||||
toast(err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- events ---------- */
|
||||
|
||||
function debounce(fn, ms) {
|
||||
let timer;
|
||||
return (...args) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn(...args), ms);
|
||||
};
|
||||
}
|
||||
|
||||
function switchView(view) {
|
||||
state.view = view;
|
||||
document.querySelectorAll(".tab").forEach((t) => t.classList.toggle("active", t.dataset.view === view));
|
||||
$("#libraryView").classList.toggle("hidden", view !== "library");
|
||||
$("#recommendView").classList.toggle("hidden", view !== "recommend");
|
||||
try {
|
||||
const url = new URL(location.href);
|
||||
if (view === "recommend") url.searchParams.set("view", "recommend");
|
||||
else url.searchParams.delete("view");
|
||||
history.replaceState(null, "", url);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
document.querySelectorAll(".tab").forEach((tab) => {
|
||||
tab.addEventListener("click", () => switchView(tab.dataset.view));
|
||||
});
|
||||
|
||||
$("#search").addEventListener("input", debounce((e) => {
|
||||
state.q = e.target.value.trim();
|
||||
loadGames(true);
|
||||
}, 280));
|
||||
|
||||
$("#sort").addEventListener("change", (e) => {
|
||||
state.sort = e.target.value;
|
||||
loadGames(true);
|
||||
});
|
||||
|
||||
$("#fStatus").addEventListener("change", (e) => { state.filters.status = e.target.value; loadGames(true); });
|
||||
$("#fGenre").addEventListener("change", (e) => { state.filters.genre = e.target.value; loadGames(true); });
|
||||
$("#fTag").addEventListener("change", (e) => { state.filters.tag = e.target.value; loadGames(true); });
|
||||
$("#fInstalled").addEventListener("change", (e) => { state.filters.installed = e.target.checked; loadGames(true); });
|
||||
$("#fUnplayed").addEventListener("change", (e) => { state.filters.unplayed = e.target.checked; loadGames(true); });
|
||||
$("#fFavorite").addEventListener("change", (e) => { state.filters.favorite = e.target.checked; loadGames(true); });
|
||||
|
||||
$("#resetFilters").addEventListener("click", () => {
|
||||
state.filters = { status: "", genre: "", tag: "", installed: false, unplayed: false, favorite: false };
|
||||
state.q = "";
|
||||
$("#fStatus").value = "";
|
||||
$("#fGenre").value = "";
|
||||
$("#fTag").value = "";
|
||||
$("#fInstalled").checked = false;
|
||||
$("#fUnplayed").checked = false;
|
||||
$("#fFavorite").checked = false;
|
||||
$("#search").value = "";
|
||||
loadGames(true);
|
||||
});
|
||||
|
||||
$("#more").addEventListener("click", () => loadGames(false));
|
||||
|
||||
$("#recommendBtn").addEventListener("click", runRecommend);
|
||||
$("#moodText").addEventListener("input", () => {
|
||||
state.preset = null;
|
||||
document.querySelectorAll("#moodChips .chip").forEach((c) => c.classList.remove("active"));
|
||||
});
|
||||
$("#optReview").addEventListener("input", (e) => { $("#optReviewVal").textContent = `${e.target.value}%`; });
|
||||
|
||||
$("#prefetch").addEventListener("click", async () => {
|
||||
try {
|
||||
const r = await api("/api/prefetch", { method: "POST", body: JSON.stringify({ limit: 240, retry_missing: true }) });
|
||||
toast(`В очередь добавлено: ${r.queued}`);
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await new Promise((res) => setTimeout(res, 3000));
|
||||
await loadMeta();
|
||||
}
|
||||
} catch (err) {
|
||||
toast(err.message);
|
||||
}
|
||||
});
|
||||
|
||||
$("#modal").addEventListener("click", (e) => {
|
||||
if (e.target.id === "modal") $("#modal").close();
|
||||
});
|
||||
$("#modal").addEventListener("close", () => {
|
||||
modalStack.length = 0;
|
||||
});
|
||||
|
||||
document.addEventListener("wheel", (e) => {
|
||||
const row = e.target.closest(".similar-row");
|
||||
if (!row) return;
|
||||
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
|
||||
row.scrollLeft += e.deltaY;
|
||||
e.preventDefault();
|
||||
}, { passive: false });
|
||||
|
||||
let jobTimer = null;
|
||||
|
||||
async function pollJob() {
|
||||
try {
|
||||
const st = await api("/api/job");
|
||||
const busy = !!st.running;
|
||||
["#refreshInc", "#refreshFull", "#translate", "#translateAbout"].forEach((sel) => {
|
||||
const el = $(sel);
|
||||
if (el) el.disabled = busy;
|
||||
});
|
||||
const el = $("#jobStatus");
|
||||
if (busy) {
|
||||
const label = st.name === "translate" ? "перевод" : "обновление БД";
|
||||
const last = (st.output || []).slice(-1)[0] || "";
|
||||
el.textContent = `${label}… ${last}`.trim();
|
||||
await loadMeta();
|
||||
clearTimeout(jobTimer);
|
||||
jobTimer = setTimeout(pollJob, 1500);
|
||||
} else if (st.finished_at) {
|
||||
el.textContent = st.exit_code === 0 ? "готово" : `ошибка (код ${st.exit_code})`;
|
||||
if (st.exit_code === 0) {
|
||||
toast(st.name === "translate" ? "Перевод обновлён" : "База обновлена");
|
||||
await loadMeta();
|
||||
await loadGames(true);
|
||||
} else {
|
||||
toast("Не удалось выполнить — смотри лог в сайдбаре");
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
async function startJob(url, body, label) {
|
||||
try {
|
||||
await api(url, { method: "POST", body: JSON.stringify(body || {}) });
|
||||
$("#jobStatus").textContent = `${label}…`;
|
||||
["#refreshInc", "#refreshFull", "#translate", "#translateAbout"].forEach((sel) => {
|
||||
const el = $(sel);
|
||||
if (el) el.disabled = true;
|
||||
});
|
||||
pollJob();
|
||||
} catch (err) {
|
||||
toast(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
$("#translate").addEventListener("click", () =>
|
||||
startJob("/api/translate", { limit: 500 }, "перевод"));
|
||||
$("#translateAbout").addEventListener("click", () =>
|
||||
startJob("/api/translate", { limit: 300, about: true }, "перевод полных описаний"));
|
||||
$("#refreshInc").addEventListener("click", () =>
|
||||
startJob("/api/refresh", { mode: "incremental" }, "обновление"));
|
||||
$("#refreshFull").addEventListener("click", () => {
|
||||
if (!confirm("Полное обновление перечитает все игры, жанры и теги. Личные статусы, заметки и переводы сохранятся. Продолжить?")) return;
|
||||
startJob("/api/refresh", { mode: "full" }, "полное обновление");
|
||||
});
|
||||
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.key === "/" && !/input|textarea|select/i.test(document.activeElement.tagName)) {
|
||||
e.preventDefault();
|
||||
$("#search").focus();
|
||||
}
|
||||
});
|
||||
|
||||
/* ---------- boot ---------- */
|
||||
|
||||
(async function boot() {
|
||||
await Promise.all([loadMeta(), loadMoods()]);
|
||||
await loadGames(true);
|
||||
|
||||
const params = new URLSearchParams(location.search);
|
||||
if (params.get("view") === "recommend") {
|
||||
switchView("recommend");
|
||||
const preset = params.get("preset");
|
||||
const mood = params.get("mood");
|
||||
if (params.get("unplayed") === "0") $("#optUnplayed").checked = false;
|
||||
if (preset) {
|
||||
state.preset = preset;
|
||||
const chip = document.querySelector(`#moodChips .chip[data-preset="${CSS.escape(preset)}"]`);
|
||||
if (chip) chip.classList.add("active");
|
||||
}
|
||||
if (mood) $("#moodText").value = mood;
|
||||
if (preset || mood) await runRecommend(false);
|
||||
}
|
||||
if (params.get("game")) openGame(params.get("game"));
|
||||
})();
|
||||
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<defs>
|
||||
<linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0" stop-color="#f3b45c"/>
|
||||
<stop offset="1" stop-color="#5eead4"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="64" height="64" rx="16" fill="url(#g)"/>
|
||||
<text x="32" y="41" text-anchor="middle" font-family="Segoe UI, Arial, sans-serif"
|
||||
font-size="24" font-weight="800" fill="#090c12">SB</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 464 B |
@@ -0,0 +1,125 @@
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>SteamBase — библиотека и рекомендации</title>
|
||||
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link rel="stylesheet" href="/static/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<span class="logo">SB</span>
|
||||
<span>SteamBase</span>
|
||||
</div>
|
||||
<nav class="tabs">
|
||||
<button class="tab active" data-view="library">Библиотека</button>
|
||||
<button class="tab" data-view="recommend">Рекомендации</button>
|
||||
</nav>
|
||||
<div class="stats" id="stats"></div>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section id="libraryView" class="layout">
|
||||
<aside class="filters">
|
||||
<div class="filter-head">
|
||||
<h2>Фильтры</h2>
|
||||
<button id="resetFilters" class="link">сбросить</button>
|
||||
</div>
|
||||
|
||||
<label class="field">
|
||||
<span>Статус</span>
|
||||
<select id="fStatus">
|
||||
<option value="">любой</option>
|
||||
<option value="backlog">в бэклоге</option>
|
||||
<option value="playing">играю</option>
|
||||
<option value="played">играл</option>
|
||||
<option value="nostalgia">в память</option>
|
||||
<option value="tribute">дань уважения</option>
|
||||
<option value="ignore">скрытые</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span>Жанр</span>
|
||||
<select id="fGenre"><option value="">любой</option></select>
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span>Тег</span>
|
||||
<select id="fTag"><option value="">любой</option></select>
|
||||
</label>
|
||||
|
||||
<label class="check"><input type="checkbox" id="fInstalled"> установленные</label>
|
||||
<label class="check"><input type="checkbox" id="fUnplayed"> не запускались</label>
|
||||
<label class="check"><input type="checkbox" id="fFavorite"> избранные</label>
|
||||
|
||||
<div class="details-progress">
|
||||
<div class="dp-head">Описания <span id="dpCount"></span></div>
|
||||
<div class="bar"><i id="dpBar"></i></div>
|
||||
<div class="dp-note" id="dpNote"></div>
|
||||
<button id="prefetch" class="link">догрузить / повторить</button>
|
||||
|
||||
<div class="dp-head translate-head">Перевод <span id="trCount"></span></div>
|
||||
<div class="bar"><i id="trBar"></i></div>
|
||||
<div class="dp-note" id="trNote"></div>
|
||||
<button id="translate" class="link">перевести кратко</button>
|
||||
<button id="translateAbout" class="link">полные описания</button>
|
||||
|
||||
<div class="refresh-block">
|
||||
<div class="dp-head">База игр</div>
|
||||
<div class="refresh-actions">
|
||||
<button id="refreshInc" class="ghost">инкрементально</button>
|
||||
<button id="refreshFull" class="ghost">полностью</button>
|
||||
</div>
|
||||
<div class="dp-note" id="jobStatus"></div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div class="content">
|
||||
<div class="toolbar">
|
||||
<input id="search" type="search" placeholder="Поиск по названию…" autocomplete="off">
|
||||
<select id="sort">
|
||||
<option value="name">по названию</option>
|
||||
<option value="hours">по времени</option>
|
||||
<option value="review" selected>по отзывам</option>
|
||||
<option value="year">по году</option>
|
||||
<option value="added">по добавлению</option>
|
||||
</select>
|
||||
<span class="count" id="count"></span>
|
||||
</div>
|
||||
<div id="grid" class="grid"></div>
|
||||
<button id="more" class="more hidden">Показать ещё</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="recommendView" class="hidden">
|
||||
<div class="mood-panel">
|
||||
<div>
|
||||
<h1>Что хочется сейчас?</h1>
|
||||
<p class="muted">Выбери профиль или опиши словами — подберу из твоей библиотеки.</p>
|
||||
</div>
|
||||
<div id="moodChips" class="chips"></div>
|
||||
<textarea id="moodText" rows="2" placeholder="например: приключение, рпг, прокачка группы, подземелья"></textarea>
|
||||
<div class="options">
|
||||
<label class="check"><input type="checkbox" id="optUnplayed" checked> только неигранное</label>
|
||||
<label class="check"><input type="checkbox" id="optTribute"> учитывать tribute</label>
|
||||
<label class="check"><input type="checkbox" id="optNostalgia"> учитывать nostalgia</label>
|
||||
<label class="range">мин. отзывы <input type="range" id="optReview" min="0" max="95" step="5" value="65"><b id="optReviewVal">65%</b></label>
|
||||
</div>
|
||||
<button id="recommendBtn" class="primary">Подобрать</button>
|
||||
</div>
|
||||
<div id="recoSummary" class="reco-summary hidden"></div>
|
||||
<div id="recoGrid" class="grid"></div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<dialog id="modal" class="modal">
|
||||
<div id="modalBody"></div>
|
||||
</dialog>
|
||||
|
||||
<script src="/static/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,619 @@
|
||||
:root {
|
||||
--bg: #090c12;
|
||||
--bg-2: #0d121b;
|
||||
--panel: #111725;
|
||||
--panel-2: #151d2e;
|
||||
--text: #e9edf5;
|
||||
--muted: #93a0b8;
|
||||
--border: rgba(255, 255, 255, .075);
|
||||
--border-strong: rgba(255, 255, 255, .14);
|
||||
--accent: #f3b45c;
|
||||
--accent-2: #5eead4;
|
||||
--danger: #fb7185;
|
||||
--radius: 16px;
|
||||
--shadow: 0 18px 48px rgba(0, 0, 0, .45);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
html { color-scheme: dark; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
background:
|
||||
radial-gradient(1100px 600px at 85% -10%, rgba(94, 234, 212, .10), transparent 60%),
|
||||
radial-gradient(900px 500px at 0% 0%, rgba(243, 180, 92, .09), transparent 55%),
|
||||
var(--bg);
|
||||
color: var(--text);
|
||||
font: 15px/1.5 Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
|
||||
button, input, select, textarea { font: inherit; color: inherit; }
|
||||
button { cursor: pointer; }
|
||||
.hidden { display: none !important; }
|
||||
.muted { color: var(--muted); }
|
||||
|
||||
/* top bar */
|
||||
.topbar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 22px;
|
||||
padding: 14px 28px;
|
||||
background: rgba(9, 12, 18, .78);
|
||||
border-bottom: 1px solid var(--border);
|
||||
backdrop-filter: blur(14px);
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
font-weight: 750;
|
||||
font-size: 17px;
|
||||
letter-spacing: -.02em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 9px;
|
||||
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);
|
||||
}
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, .02);
|
||||
}
|
||||
|
||||
.tab {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
padding: 7px 16px;
|
||||
border-radius: 999px;
|
||||
font-size: 14px;
|
||||
transition: .18s;
|
||||
}
|
||||
.tab:hover { color: var(--text); }
|
||||
.tab.active {
|
||||
color: #0a0d13;
|
||||
background: linear-gradient(135deg, var(--accent), #ffd59a);
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.stats {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.stat {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
padding: 6px 11px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, .025);
|
||||
font-size: 12.5px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.stat b { color: var(--text); font-weight: 650; }
|
||||
|
||||
/* layout */
|
||||
main { padding: 24px 28px 70px; }
|
||||
|
||||
.layout {
|
||||
display: grid;
|
||||
grid-template-columns: 232px minmax(0, 1fr);
|
||||
gap: 26px;
|
||||
align-items: start;
|
||||
max-width: 1500px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.filters {
|
||||
position: sticky;
|
||||
top: 86px;
|
||||
max-height: calc(100vh - 110px);
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 18px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
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; }
|
||||
.filter-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
|
||||
.link { background: none; border: 0; padding: 0; color: var(--accent); font-size: 12px; }
|
||||
.link:hover { text-decoration: underline; }
|
||||
|
||||
.field { display: flex; flex-direction: column; gap: 6px; }
|
||||
.field span { font-size: 12px; color: var(--muted); }
|
||||
|
||||
select, input[type="search"], textarea {
|
||||
width: 100%;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--bg-2);
|
||||
padding: 9px 11px;
|
||||
outline: none;
|
||||
transition: border-color .15s, box-shadow .15s;
|
||||
}
|
||||
select:focus, input[type="search"]:focus, textarea:focus {
|
||||
border-color: rgba(243, 180, 92, .55);
|
||||
box-shadow: 0 0 0 3px rgba(243, 180, 92, .12);
|
||||
}
|
||||
textarea { resize: vertical; min-height: 54px; }
|
||||
|
||||
.check {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
font-size: 13.5px;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
|
||||
.check:hover { color: var(--text); }
|
||||
|
||||
.details-progress {
|
||||
margin-top: 6px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid var(--border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.dp-head { display: flex; justify-content: space-between; }
|
||||
.bar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
|
||||
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }
|
||||
.dp-note { font-size: 11px; color: #6e7c93; line-height: 1.35; }
|
||||
.translate-head { margin-top: 10px; }
|
||||
.refresh-block {
|
||||
margin-top: 10px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.refresh-actions { display: flex; gap: 6px; }
|
||||
.ghost {
|
||||
flex: 1;
|
||||
padding: 7px 8px;
|
||||
border-radius: 9px;
|
||||
border: 1px solid var(--border);
|
||||
background: rgba(255, 255, 255, .03);
|
||||
color: #c7d1e2;
|
||||
font-size: 11.5px;
|
||||
transition: .15s;
|
||||
}
|
||||
.ghost:hover { border-color: var(--accent); color: var(--accent); }
|
||||
.ghost:disabled { opacity: .5; cursor: wait; }
|
||||
|
||||
.content { min-width: 0; }
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.toolbar input { flex: 1; }
|
||||
.toolbar select { width: auto; min-width: 150px; }
|
||||
.count { color: var(--muted); font-size: 13px; white-space: nowrap; }
|
||||
|
||||
/* grid + cards */
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: var(--panel);
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: transform .18s, border-color .18s, box-shadow .18s;
|
||||
}
|
||||
.card:hover {
|
||||
transform: translateY(-3px);
|
||||
border-color: var(--border-strong);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.cover {
|
||||
position: relative;
|
||||
aspect-ratio: 2 / 3;
|
||||
background: linear-gradient(145deg, #1b2436, #0d121b);
|
||||
overflow: hidden;
|
||||
}
|
||||
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.cover .fallback {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: none;
|
||||
place-items: center;
|
||||
padding: 14px;
|
||||
text-align: center;
|
||||
font-weight: 700;
|
||||
font-size: 15px;
|
||||
color: rgba(255, 255, 255, .82);
|
||||
background:
|
||||
linear-gradient(145deg, rgba(243, 180, 92, .25), rgba(94, 234, 212, .12)),
|
||||
linear-gradient(145deg, #1b2436, #0d121b);
|
||||
}
|
||||
.cover.noimg .fallback { display: grid; }
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
padding: 3px 7px;
|
||||
border-radius: 7px;
|
||||
font-size: 11px;
|
||||
font-weight: 650;
|
||||
backdrop-filter: blur(6px);
|
||||
background: rgba(8, 11, 17, .72);
|
||||
border: 1px solid rgba(255, 255, 255, .1);
|
||||
}
|
||||
.badge.review { top: 8px; left: 8px; color: #b8f5e9; }
|
||||
.badge.review.warn { color: #ffd59a; }
|
||||
.badge.installed { top: 8px; right: 8px; color: var(--accent-2); }
|
||||
.badge.score { top: 8px; left: 8px; color: #0a0d13; background: linear-gradient(135deg, var(--accent), #ffd59a); border: 0; }
|
||||
|
||||
.card-body { display: flex; flex-direction: column; gap: 7px; padding: 11px 12px 13px; }
|
||||
.card-title {
|
||||
font-size: 14px;
|
||||
font-weight: 620;
|
||||
line-height: 1.25;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11.5px; color: var(--muted); }
|
||||
.card-meta .dot::before { content: "·"; margin-right: 6px; }
|
||||
.card-genres { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||
.genre {
|
||||
padding: 2px 7px;
|
||||
border-radius: 99px;
|
||||
font-size: 10.5px;
|
||||
color: #c7d1e2;
|
||||
background: rgba(255, 255, 255, .055);
|
||||
border: 1px solid rgba(255, 255, 255, .05);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.card-desc {
|
||||
margin: 2px 0 0;
|
||||
font-size: 11.5px;
|
||||
line-height: 1.45;
|
||||
color: #aab5c9;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
min-height: 48px;
|
||||
}
|
||||
.card-desc.loading { color: #5d6a80; font-style: italic; }
|
||||
.card-desc.missing-desc { color: #64708a; font-style: italic; }
|
||||
|
||||
.status-chip {
|
||||
align-self: flex-start;
|
||||
padding: 2px 8px;
|
||||
border-radius: 99px;
|
||||
font-size: 10.5px;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.st-backlog { color: #9aa6bd; background: rgba(154, 166, 189, .12); }
|
||||
.st-playing { color: #6ee7b7; background: rgba(110, 231, 183, .12); }
|
||||
.st-played { color: #93c5fd; background: rgba(147, 197, 253, .12); }
|
||||
.st-nostalgia { color: #c4b5fd; background: rgba(196, 181, 253, .12); }
|
||||
.st-tribute { color: #fcd34d; background: rgba(252, 211, 77, .12); }
|
||||
.st-ignore { color: #fda4af; background: rgba(253, 164, 175, .12); }
|
||||
|
||||
.more {
|
||||
display: block;
|
||||
margin: 26px auto 0;
|
||||
padding: 11px 28px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--border-strong);
|
||||
background: rgba(255, 255, 255, .04);
|
||||
color: var(--text);
|
||||
}
|
||||
.more:hover { border-color: var(--accent); color: var(--accent); }
|
||||
|
||||
.empty {
|
||||
grid-column: 1 / -1;
|
||||
padding: 60px 20px;
|
||||
text-align: center;
|
||||
color: var(--muted);
|
||||
border: 1px dashed var(--border-strong);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
/* recommendations */
|
||||
#recommendView { max-width: 1200px; margin: 0 auto; }
|
||||
|
||||
.mood-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
padding: 26px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 22px;
|
||||
background:
|
||||
radial-gradient(600px 200px at 100% 0%, rgba(94, 234, 212, .10), transparent 70%),
|
||||
linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .008));
|
||||
}
|
||||
.mood-panel h1 { font-size: 26px; }
|
||||
.mood-panel p { margin: 6px 0 0; }
|
||||
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.chip {
|
||||
padding: 7px 13px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--border);
|
||||
background: rgba(255, 255, 255, .03);
|
||||
color: #c9d3e4;
|
||||
font-size: 13px;
|
||||
transition: .15s;
|
||||
}
|
||||
.chip:hover { border-color: var(--border-strong); color: var(--text); }
|
||||
.chip.active {
|
||||
border-color: transparent;
|
||||
background: linear-gradient(135deg, rgba(243, 180, 92, .95), rgba(255, 213, 154, .95));
|
||||
color: #0a0d13;
|
||||
font-weight: 640;
|
||||
}
|
||||
|
||||
.options { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
|
||||
.range { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
|
||||
.range input { accent-color: var(--accent); }
|
||||
.range b { color: var(--text); font-weight: 600; min-width: 34px; }
|
||||
|
||||
.primary {
|
||||
align-self: flex-start;
|
||||
padding: 11px 26px;
|
||||
border: 0;
|
||||
border-radius: 12px;
|
||||
color: #0a0d13;
|
||||
font-weight: 700;
|
||||
background: linear-gradient(135deg, var(--accent), #ffd59a);
|
||||
box-shadow: 0 10px 26px rgba(243, 180, 92, .22);
|
||||
transition: .15s;
|
||||
}
|
||||
.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(243, 180, 92, .3); }
|
||||
.primary:disabled { opacity: .55; cursor: wait; transform: none; }
|
||||
|
||||
.reco-summary {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin: 22px 0 16px;
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.reco-summary .genre { font-size: 11.5px; }
|
||||
.reco-summary b { color: var(--text); }
|
||||
|
||||
.matched {
|
||||
margin: 2px 0 0;
|
||||
font-size: 11px;
|
||||
color: var(--accent-2);
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* modal */
|
||||
.modal {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
width: min(940px, calc(100vw - 36px));
|
||||
max-height: calc(100vh - 36px);
|
||||
border-radius: 22px;
|
||||
background: var(--panel);
|
||||
color: var(--text);
|
||||
box-shadow: var(--shadow);
|
||||
overflow: hidden;
|
||||
}
|
||||
.modal::backdrop { background: rgba(4, 6, 10, .72); backdrop-filter: blur(6px); }
|
||||
|
||||
.modal-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 300px minmax(0, 1fr);
|
||||
max-height: calc(100vh - 36px);
|
||||
}
|
||||
.modal-cover { position: relative; background: var(--bg-2); }
|
||||
.modal-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.modal-cover .fallback { display: none; }
|
||||
.modal-cover.noimg .fallback {
|
||||
position: absolute; inset: 0; display: grid; place-items: center;
|
||||
background: linear-gradient(145deg, rgba(243, 180, 92, .25), rgba(94, 234, 212, .12)), var(--bg-2);
|
||||
font-size: 22px; font-weight: 700; text-align: center; padding: 20px;
|
||||
}
|
||||
|
||||
.modal-body { padding: 24px 26px 26px; overflow-y: auto; }
|
||||
.modal-top { display: flex; gap: 12px; align-items: flex-start; }
|
||||
.modal-title { font-size: 24px; line-height: 1.2; }
|
||||
.modal-close {
|
||||
margin-left: auto;
|
||||
width: 34px; height: 34px;
|
||||
flex: 0 0 34px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid var(--border);
|
||||
background: rgba(255, 255, 255, .04);
|
||||
color: var(--muted);
|
||||
font-size: 17px;
|
||||
}
|
||||
.modal-close:hover { color: var(--text); border-color: var(--border-strong); }
|
||||
|
||||
.modal-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 16px; font-size: 13px; color: var(--muted); }
|
||||
.modal-meta b { color: var(--text); font-weight: 600; }
|
||||
|
||||
.similar-block { margin: 4px 0 18px; padding-top: 16px; border-top: 1px solid var(--border); }
|
||||
.similar-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
|
||||
.similar-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
overflow-x: auto;
|
||||
overscroll-behavior-x: contain;
|
||||
padding: 2px 2px 8px;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
.mini {
|
||||
flex: 0 0 102px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
background: var(--panel-2);
|
||||
overflow: hidden;
|
||||
text-align: left;
|
||||
color: inherit;
|
||||
transition: .15s;
|
||||
}
|
||||
.mini:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
|
||||
.mini .mini-cover { position: relative; aspect-ratio: 2 / 3; }
|
||||
.mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.mini .mini-body { padding: 7px 8px 9px; display: flex; flex-direction: column; gap: 3px; }
|
||||
.mini-title {
|
||||
font-size: 11.5px;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.mini-meta { font-size: 10px; color: var(--muted); }
|
||||
|
||||
.modal-back {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
flex: 0 0 34px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid var(--border);
|
||||
background: rgba(255, 255, 255, .04);
|
||||
color: var(--muted);
|
||||
font-size: 16px;
|
||||
}
|
||||
.modal-back:hover { color: var(--text); border-color: var(--border-strong); }
|
||||
|
||||
.modal-desc { margin: 0 0 16px; color: #c6d0e0; }
|
||||
.modal-desc.about { font-size: 13px; color: #a8b3c7; line-height: 1.6; }
|
||||
.about-block { margin: 0 0 16px; }
|
||||
.about-block summary { cursor: pointer; color: var(--accent-2); font-size: 13px; margin-bottom: 8px; }
|
||||
.about-block summary:hover { text-decoration: underline; }
|
||||
|
||||
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
|
||||
|
||||
.personal {
|
||||
margin-top: 20px;
|
||||
padding-top: 18px;
|
||||
border-top: 1px solid var(--border);
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
.personal h3 { grid-column: 1 / -1; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
|
||||
.personal label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
|
||||
.personal label.wide { grid-column: 1 / -1; }
|
||||
.personal label.check { flex-direction: row; align-items: center; gap: 9px; }
|
||||
.personal input, .personal select, .personal textarea {
|
||||
background: var(--bg-2);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
padding: 9px 11px;
|
||||
outline: none;
|
||||
transition: border-color .15s, box-shadow .15s;
|
||||
}
|
||||
.personal input:focus, .personal select:focus, .personal textarea:focus {
|
||||
border-color: rgba(243, 180, 92, .55);
|
||||
box-shadow: 0 0 0 3px rgba(243, 180, 92, .12);
|
||||
}
|
||||
.personal textarea { grid-column: 1 / -1; }
|
||||
.personal-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
|
||||
.save { padding: 9px 18px; border-radius: 10px; border: 0; background: var(--accent); color: #0a0d13; font-weight: 650; }
|
||||
.save:hover { background: #ffd59a; }
|
||||
.steam-link { margin-left: auto; font-size: 13px; color: var(--accent-2); text-decoration: none; }
|
||||
.steam-link:hover { text-decoration: underline; }
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 26px;
|
||||
transform: translateX(-50%) translateY(20px);
|
||||
padding: 10px 18px;
|
||||
border-radius: 12px;
|
||||
background: rgba(20, 26, 38, .95);
|
||||
border: 1px solid var(--border-strong);
|
||||
color: var(--text);
|
||||
font-size: 13px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: .25s;
|
||||
z-index: 100;
|
||||
}
|
||||
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
|
||||
|
||||
/* skeleton */
|
||||
.skeleton { pointer-events: none; }
|
||||
.skeleton .cover { background: linear-gradient(100deg, #131a28 30%, #1b2436 50%, #131a28 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
|
||||
.skeleton .card-body { gap: 9px; }
|
||||
.skeleton .line { height: 11px; border-radius: 6px; background: linear-gradient(100deg, #131a28 30%, #1b2436 50%, #131a28 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
|
||||
@keyframes shimmer { to { background-position: -200% 0; } }
|
||||
|
||||
::-webkit-scrollbar { width: 10px; height: 10px; }
|
||||
::-webkit-scrollbar-thumb { background: #26304a; border-radius: 99px; border: 2px solid var(--bg); }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.layout { grid-template-columns: 1fr; }
|
||||
.filters { position: static; flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
|
||||
.filter-head { width: 100%; }
|
||||
.field { flex: 1 1 160px; }
|
||||
.details-progress { flex: 1 1 100%; }
|
||||
.modal-grid { grid-template-columns: 1fr; }
|
||||
.modal-cover { max-height: 260px; }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
|
||||
.stats { width: 100%; justify-content: flex-start; }
|
||||
main { padding: 18px 16px 60px; }
|
||||
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
|
||||
.toolbar { flex-wrap: wrap; }
|
||||
.toolbar input { flex: 1 1 100%; }
|
||||
}
|
||||
Reference in new issue
Block a user