feat: initial SteamBase 1.0.0
This commit is contained in:
commit
d1aee28115
37 files changed
+6518
No files matched your search
+778
@@ -0,0 +1,778 @@
|
||||
"""Local web UI for SteamBase.
|
||||
|
||||
python SteamBase/web/server.py
|
||||
python SteamBase/web/server.py --port 8765 --open
|
||||
|
||||
Binds to 127.0.0.1 by default: no auth, do not expose it to the internet.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import queue
|
||||
import re
|
||||
import sqlite3
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import webbrowser
|
||||
from datetime import datetime, timezone
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
|
||||
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, os.path.join(BASE, "tools"))
|
||||
for stream in (sys.stdout, sys.stderr):
|
||||
try:
|
||||
stream.reconfigure(encoding="utf-8")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
import db
|
||||
import reco
|
||||
import steam_source
|
||||
import translate_details as td
|
||||
from fetch_details import fetch_app_details, save_details
|
||||
|
||||
try:
|
||||
STEAM_ROOT = steam_source.find_steam_root()
|
||||
except SystemExit:
|
||||
STEAM_ROOT = None
|
||||
LIB_CACHE = os.path.join(STEAM_ROOT, "appcache", "librarycache") if STEAM_ROOT else None
|
||||
CACHE_DIR = os.path.join(BASE, "cache", "covers")
|
||||
IMAGE_LOCK = threading.Lock()
|
||||
COVER_NAMES = ("library_600x900.jpg", "header.jpg")
|
||||
STEAM_COVER_NAMES = ("library_600x900.jpg", "header.jpg", "library_hero.jpg", "logo.png")
|
||||
|
||||
STATIC = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static")
|
||||
STATUSES = {"backlog", "playing", "played", "tribute", "nostalgia", "ignore"}
|
||||
CONTENT_TYPES = {
|
||||
".html": "text/html; charset=utf-8",
|
||||
".css": "text/css; charset=utf-8",
|
||||
".js": "application/javascript; charset=utf-8",
|
||||
".svg": "image/svg+xml",
|
||||
".png": "image/png",
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
".ico": "image/x-icon",
|
||||
}
|
||||
|
||||
|
||||
class DetailsService:
|
||||
"""Background cache filler for Steam Store descriptions."""
|
||||
|
||||
def __init__(self, db_path, delay=1.4):
|
||||
self.db_path = db_path
|
||||
self.delay = delay
|
||||
self._queue = queue.Queue()
|
||||
self._queued = set()
|
||||
self._queued_lock = threading.Lock()
|
||||
self._rate_lock = threading.Lock()
|
||||
self._last_request = 0.0
|
||||
threading.Thread(target=self._worker, daemon=True).start()
|
||||
|
||||
def _connect(self):
|
||||
con = db.connect(self.db_path)
|
||||
return con
|
||||
|
||||
def _throttle(self):
|
||||
with self._rate_lock:
|
||||
wait = self._last_request + self.delay - time.time()
|
||||
if wait > 0:
|
||||
time.sleep(wait)
|
||||
self._last_request = time.time()
|
||||
|
||||
def cached(self, appid):
|
||||
con = self._connect()
|
||||
try:
|
||||
row = con.execute(
|
||||
"SELECT short_description FROM game_details WHERE appid = ? AND status = 'ok'",
|
||||
(appid,)).fetchone()
|
||||
return row["short_description"] if row else None
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
def enqueue(self, appid):
|
||||
with self._queued_lock:
|
||||
if appid in self._queued:
|
||||
return
|
||||
self._queued.add(appid)
|
||||
self._queue.put(appid)
|
||||
|
||||
def enqueue_many(self, appids):
|
||||
for appid in appids:
|
||||
self.enqueue(appid)
|
||||
|
||||
def fetch_now(self, appid):
|
||||
con = self._connect()
|
||||
try:
|
||||
row = con.execute("SELECT status FROM game_details WHERE appid = ?", (appid,)).fetchone()
|
||||
if row and row["status"] in ("ok", "missing"):
|
||||
return
|
||||
finally:
|
||||
con.close()
|
||||
self._throttle()
|
||||
try:
|
||||
details = fetch_app_details(appid)
|
||||
con = self._connect()
|
||||
try:
|
||||
save_details(con, appid, details)
|
||||
finally:
|
||||
con.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _worker(self):
|
||||
while True:
|
||||
appid = self._queue.get()
|
||||
try:
|
||||
con = self._connect()
|
||||
try:
|
||||
row = con.execute("SELECT status FROM game_details WHERE appid = ?", (appid,)).fetchone()
|
||||
finally:
|
||||
con.close()
|
||||
if row and row["status"] in ("ok", "missing"):
|
||||
continue
|
||||
self._throttle()
|
||||
details = fetch_app_details(appid)
|
||||
con = self._connect()
|
||||
try:
|
||||
save_details(con, appid, details)
|
||||
finally:
|
||||
con.close()
|
||||
except urllib.error.HTTPError as exc:
|
||||
if exc.code == 429:
|
||||
time.sleep(60)
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
with self._queued_lock:
|
||||
self._queued.discard(appid)
|
||||
|
||||
|
||||
class JobManager:
|
||||
"""Runs a maintenance script in the background and exposes its state."""
|
||||
|
||||
def __init__(self):
|
||||
self._lock = threading.Lock()
|
||||
self._state = {
|
||||
"name": None, "running": False, "exit_code": None,
|
||||
"started_at": None, "finished_at": None, "output": [],
|
||||
}
|
||||
|
||||
def start(self, name, args):
|
||||
with self._lock:
|
||||
if self._state["running"]:
|
||||
return False
|
||||
self._state = {
|
||||
"name": name, "running": True, "exit_code": None,
|
||||
"started_at": datetime.now(timezone.utc).isoformat(timespec="seconds"),
|
||||
"finished_at": None, "output": [],
|
||||
}
|
||||
threading.Thread(target=self._run, args=(name, args), daemon=True).start()
|
||||
return True
|
||||
|
||||
def _run(self, name, args):
|
||||
code = None
|
||||
try:
|
||||
proc = subprocess.Popen(
|
||||
[sys.executable, "-u", *args], cwd=BASE,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
||||
text=True, encoding="utf-8", errors="replace",
|
||||
)
|
||||
for line in proc.stdout:
|
||||
with self._lock:
|
||||
self._state["output"].append(line.rstrip())
|
||||
self._state["output"] = self._state["output"][-80:]
|
||||
code = proc.wait()
|
||||
except Exception as exc:
|
||||
with self._lock:
|
||||
self._state["output"].append(str(exc))
|
||||
code = -1
|
||||
finally:
|
||||
with self._lock:
|
||||
self._state["running"] = False
|
||||
self._state["exit_code"] = code
|
||||
self._state["finished_at"] = datetime.now(timezone.utc).isoformat(timespec="seconds")
|
||||
if name == "import":
|
||||
try:
|
||||
DETAILS.enqueue_many(missing_detail_ids(1000))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def status(self):
|
||||
with self._lock:
|
||||
return {**self._state, "output": list(self._state["output"])}
|
||||
|
||||
|
||||
DETAILS = None
|
||||
JOBS = JobManager()
|
||||
|
||||
|
||||
def missing_detail_ids(limit=1000):
|
||||
con = connect()
|
||||
try:
|
||||
return [r["appid"] for r in con.execute("""
|
||||
SELECT g.appid FROM games g
|
||||
LEFT JOIN game_details d ON d.appid = g.appid
|
||||
LEFT JOIN game_playtime p ON p.appid = g.appid
|
||||
WHERE LOWER(g.type) = 'game' AND d.appid IS NULL
|
||||
ORDER BY (COALESCE(p.minutes,0) = 0) DESC, COALESCE(g.review_pct,0) DESC
|
||||
LIMIT ?""", (int(limit),))]
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
|
||||
def connect():
|
||||
con = db.connect(db.DEFAULT_DB)
|
||||
con.row_factory = sqlite3.Row
|
||||
return con
|
||||
|
||||
|
||||
def game_tags_map(con, appids):
|
||||
if not appids:
|
||||
return {}
|
||||
ph = ",".join("?" * len(appids))
|
||||
out = {}
|
||||
for r in con.execute(
|
||||
f"""SELECT gt.appid, tn.name FROM game_tags gt
|
||||
JOIN tag_names tn ON tn.tag_id = gt.tag_id
|
||||
WHERE gt.appid IN ({ph})
|
||||
ORDER BY tn.name""", appids):
|
||||
out.setdefault(r["appid"], []).append(r["name"])
|
||||
return out
|
||||
|
||||
|
||||
def game_genres_map(con, appids):
|
||||
if not appids:
|
||||
return {}
|
||||
ph = ",".join("?" * len(appids))
|
||||
out = {}
|
||||
for r in con.execute(f"SELECT appid, genre FROM game_genres WHERE appid IN ({ph}) ORDER BY genre", appids):
|
||||
out.setdefault(r["appid"], []).append(r["genre"])
|
||||
return out
|
||||
|
||||
|
||||
def details_map(con, appids):
|
||||
if not appids:
|
||||
return {}
|
||||
ph = ",".join("?" * len(appids))
|
||||
return {r["appid"]: r for r in con.execute(
|
||||
f"""SELECT d.*, t.short_description AS short_ru, t.about AS about_ru
|
||||
FROM game_details d
|
||||
LEFT JOIN game_translations t ON t.appid = d.appid
|
||||
WHERE d.appid IN ({ph})""", appids)}
|
||||
|
||||
|
||||
def clean_text(value):
|
||||
if not value:
|
||||
return None
|
||||
value = value.replace("\ufeff", "").strip()
|
||||
return value or None
|
||||
|
||||
|
||||
def strip_html(value):
|
||||
text = re.sub(r"<[^>]+>", " ", value or "")
|
||||
text = text.replace(" ", " ").replace("&", "&")
|
||||
return " ".join(text.split())
|
||||
|
||||
|
||||
def description_of(details):
|
||||
if not details:
|
||||
return None
|
||||
text = clean_text(details["short_ru"]) or clean_text(details["short_description"])
|
||||
if not text:
|
||||
about = details["about_ru"] or details["about"]
|
||||
text = strip_html(about)[:240].strip()
|
||||
return text or None
|
||||
|
||||
|
||||
def serialize(r, tags, genres, details):
|
||||
release = r["release_date"] or (details["release_date"] if details else None)
|
||||
year = None
|
||||
if release:
|
||||
for part in str(release).replace(".", "-").split("-"):
|
||||
if len(part) == 4 and part.isdigit():
|
||||
year = int(part)
|
||||
break
|
||||
return {
|
||||
"appid": r["appid"],
|
||||
"name": r["name"],
|
||||
"year": year,
|
||||
"review": r["review_pct"],
|
||||
"metacritic": r["metacritic"],
|
||||
"hours": round((r["minutes"] or 0) / 60, 1),
|
||||
"installed": bool(r["installed"]),
|
||||
"status": r["status"],
|
||||
"rating": r["rating"],
|
||||
"favorite": bool(r["favorite"]),
|
||||
"notes": r["notes"],
|
||||
"genres": genres,
|
||||
"tags": tags[:10],
|
||||
"description": description_of(details),
|
||||
"desc_status": (details["status"] if details else None),
|
||||
"developers": (details["developers"] if details else None),
|
||||
"publishers": (details["publishers"] if details else None),
|
||||
}
|
||||
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
server_version = "SteamBase/1.0"
|
||||
|
||||
def log_message(self, fmt, *args):
|
||||
if "/api/" in (args[0] if args else ""):
|
||||
return
|
||||
super().log_message(fmt, *args)
|
||||
|
||||
def _send(self, status, body, content_type="application/json; charset=utf-8",
|
||||
cache=False, max_age=86400):
|
||||
if isinstance(body, str):
|
||||
body = body.encode("utf-8")
|
||||
self.send_response(status)
|
||||
self.send_header("Content-Type", content_type)
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.send_header("Cache-Control",
|
||||
f"public, max-age={max_age}" if cache else "no-store")
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def _json(self, obj, status=200):
|
||||
self._send(status, json.dumps(obj, ensure_ascii=False), "application/json; charset=utf-8")
|
||||
|
||||
def _error(self, status, message):
|
||||
self._json({"error": message}, status)
|
||||
|
||||
def _body(self):
|
||||
length = int(self.headers.get("Content-Length") or 0)
|
||||
if not length:
|
||||
return {}
|
||||
return json.loads(self.rfile.read(length).decode("utf-8"))
|
||||
|
||||
def do_GET(self):
|
||||
parsed = urllib.parse.urlparse(self.path)
|
||||
path = parsed.path
|
||||
try:
|
||||
if path.startswith("/api/"):
|
||||
self._api_get(path, urllib.parse.parse_qs(parsed.query))
|
||||
return
|
||||
self._static(path)
|
||||
except Exception as exc:
|
||||
self._error(500, str(exc))
|
||||
|
||||
def do_POST(self):
|
||||
parsed = urllib.parse.urlparse(self.path)
|
||||
path = parsed.path
|
||||
try:
|
||||
if path == "/api/recommend":
|
||||
self._recommend(self._body())
|
||||
elif path == "/api/prefetch":
|
||||
body = self._body()
|
||||
ids = self._missing_ids(body.get("limit", 200), bool(body.get("retry_missing")))
|
||||
DETAILS.enqueue_many(ids)
|
||||
self._json({"queued": len(ids)})
|
||||
elif path.startswith("/api/personal/"):
|
||||
appid = int(path.rsplit("/", 1)[1])
|
||||
self._update_personal(appid, self._body())
|
||||
elif path == "/api/refresh":
|
||||
body = self._body()
|
||||
mode = body.get("mode", "incremental")
|
||||
if mode not in ("incremental", "full"):
|
||||
self._error(400, "unknown mode")
|
||||
return
|
||||
script = os.path.join(BASE, "tools", "import_steam.py")
|
||||
args = [script] + (["--incremental"] if mode == "incremental" else ["--refresh-tags"])
|
||||
if not JOBS.start("import", args):
|
||||
self._error(409, "another job is running")
|
||||
return
|
||||
self._json({"started": True, "mode": mode})
|
||||
elif path == "/api/translate":
|
||||
body = self._body()
|
||||
script = os.path.join(BASE, "tools", "translate_details.py")
|
||||
args = [script, "--limit", str(int(body.get("limit", 400)))]
|
||||
if body.get("about"):
|
||||
args.append("--about")
|
||||
if not JOBS.start("translate", args):
|
||||
self._error(409, "another job is running")
|
||||
return
|
||||
self._json({"started": True})
|
||||
else:
|
||||
self._error(404, "not found")
|
||||
except Exception as exc:
|
||||
self._error(500, str(exc))
|
||||
|
||||
def _static(self, path):
|
||||
if path in ("/", ""):
|
||||
path = "/index.html"
|
||||
rel = path.lstrip("/")
|
||||
if rel.startswith("static/"):
|
||||
rel = rel[len("static/"):]
|
||||
full = os.path.normpath(os.path.join(STATIC, rel))
|
||||
if not full.startswith(STATIC) or not os.path.isfile(full):
|
||||
self._error(404, "not found")
|
||||
return
|
||||
ext = os.path.splitext(full)[1].lower()
|
||||
with open(full, "rb") as f:
|
||||
self._send(200, f.read(), CONTENT_TYPES.get(ext, "application/octet-stream"))
|
||||
|
||||
def _serve_image(self, path):
|
||||
ext = os.path.splitext(path)[1].lower()
|
||||
with open(path, "rb") as f:
|
||||
data = f.read()
|
||||
self._send(200, data, CONTENT_TYPES.get(ext, "image/jpeg"),
|
||||
cache=True, max_age=2592000)
|
||||
|
||||
def _cover(self, appid):
|
||||
# 1. our own cache
|
||||
for name in COVER_NAMES:
|
||||
path = os.path.join(CACHE_DIR, str(appid), name)
|
||||
if os.path.isfile(path):
|
||||
self._serve_image(path)
|
||||
return
|
||||
# 2. art already downloaded by the Steam client
|
||||
if LIB_CACHE:
|
||||
for name in STEAM_COVER_NAMES:
|
||||
path = os.path.join(LIB_CACHE, str(appid), name)
|
||||
if os.path.isfile(path):
|
||||
self._serve_image(path)
|
||||
return
|
||||
# 3. download once from the CDN and keep it on disk
|
||||
for name in COVER_NAMES:
|
||||
path = os.path.join(CACHE_DIR, str(appid), name)
|
||||
data = None
|
||||
with IMAGE_LOCK:
|
||||
if os.path.isfile(path):
|
||||
with open(path, "rb") as f:
|
||||
data = f.read()
|
||||
else:
|
||||
url = f"https://cdn.cloudflare.steamstatic.com/steam/apps/{appid}/{name}"
|
||||
try:
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
|
||||
with urllib.request.urlopen(req, timeout=20) as resp:
|
||||
data = resp.read()
|
||||
if data:
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
tmp = path + ".tmp"
|
||||
with open(tmp, "wb") as f:
|
||||
f.write(data)
|
||||
os.replace(tmp, path)
|
||||
except Exception:
|
||||
data = None
|
||||
if data:
|
||||
self._send(200, data, "image/jpeg", cache=True, max_age=2592000)
|
||||
return
|
||||
self._error(404, "no cover")
|
||||
|
||||
def _api_get(self, path, qs):
|
||||
if path == "/api/meta":
|
||||
self._meta()
|
||||
elif path == "/api/games":
|
||||
self._games(qs)
|
||||
elif path == "/api/moods":
|
||||
self._moods()
|
||||
elif path == "/api/descriptions":
|
||||
ids = [int(x) for x in (qs.get("ids", [""])[0] or "").split(",") if x.isdigit()]
|
||||
con = connect()
|
||||
try:
|
||||
dm = details_map(con, ids)
|
||||
self._json({str(i): description_of(dm.get(i)) for i in ids})
|
||||
finally:
|
||||
con.close()
|
||||
elif path == "/api/job":
|
||||
self._json(JOBS.status())
|
||||
elif path.startswith("/api/cover/"):
|
||||
self._cover(int(path.rsplit("/", 1)[1]))
|
||||
elif path.startswith("/api/game/"):
|
||||
appid = int(path.rsplit("/", 1)[1])
|
||||
self._game(appid, qs)
|
||||
else:
|
||||
self._error(404, "not found")
|
||||
|
||||
def _meta(self):
|
||||
con = connect()
|
||||
try:
|
||||
total = con.execute("SELECT COUNT(*) c FROM games WHERE LOWER(type)='game'").fetchone()["c"]
|
||||
installed = con.execute("""SELECT COUNT(*) c FROM game_install i JOIN games g ON g.appid=i.appid
|
||||
WHERE i.installed=1 AND LOWER(g.type)='game'""").fetchone()["c"]
|
||||
played = con.execute("""SELECT COUNT(*) c FROM game_playtime p JOIN games g ON g.appid=p.appid
|
||||
WHERE p.minutes>0 AND LOWER(g.type)='game'""").fetchone()["c"]
|
||||
minutes = con.execute("""SELECT COALESCE(SUM(p.minutes),0) c FROM game_playtime p
|
||||
JOIN games g ON g.appid=p.appid WHERE LOWER(g.type)='game'""").fetchone()["c"]
|
||||
cached = con.execute("""SELECT COUNT(*) c FROM game_details d JOIN games g ON g.appid=d.appid
|
||||
WHERE d.status='ok' AND LOWER(g.type)='game'""").fetchone()["c"]
|
||||
missing = con.execute("""SELECT COUNT(*) c FROM game_details d JOIN games g ON g.appid=d.appid
|
||||
WHERE d.status='missing' AND LOWER(g.type)='game'""").fetchone()["c"]
|
||||
translated = con.execute("""SELECT COUNT(*) c FROM game_translations t
|
||||
JOIN games g ON g.appid=t.appid
|
||||
WHERE LOWER(g.type)='game'""").fetchone()["c"]
|
||||
untranslated = con.execute("""
|
||||
SELECT d.short_description, d.about FROM game_details d
|
||||
JOIN games g ON g.appid=d.appid
|
||||
LEFT JOIN game_translations t ON t.appid=d.appid
|
||||
WHERE d.status='ok' AND LOWER(g.type)='game' AND t.appid IS NULL
|
||||
""").fetchall()
|
||||
translate_pending = sum(
|
||||
1 for r in untranslated
|
||||
if td.looks_english(r["short_description"])
|
||||
or (not r["short_description"] and td.looks_english(r["about"]))
|
||||
)
|
||||
genres = [{"name": r["genre"], "count": r["c"]} for r in con.execute("""
|
||||
SELECT gg.genre, COUNT(*) c FROM game_genres gg JOIN games g ON g.appid=gg.appid
|
||||
WHERE LOWER(g.type)='game' GROUP BY gg.genre ORDER BY c DESC""")]
|
||||
tags = [{"name": r["name"], "count": r["c"]} for r in con.execute("""
|
||||
SELECT tn.name, COUNT(*) c FROM game_tags gt
|
||||
JOIN games g ON g.appid=gt.appid
|
||||
JOIN tag_names tn ON tn.tag_id=gt.tag_id
|
||||
WHERE LOWER(g.type)='game'
|
||||
GROUP BY tn.name ORDER BY c DESC LIMIT 80""")]
|
||||
statuses = {r["status"]: r["c"] for r in con.execute(
|
||||
"SELECT status, COUNT(*) c FROM personal GROUP BY status")}
|
||||
self._json({
|
||||
"total": total, "installed": installed, "played": played,
|
||||
"hours": round(minutes / 60), "cached": cached, "missing": missing,
|
||||
"pending": max(0, total - cached - missing),
|
||||
"translated": translated, "translate_pending": translate_pending,
|
||||
"genres": genres, "tags": tags, "statuses": statuses,
|
||||
})
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
def _games(self, qs):
|
||||
def q(name, default=None):
|
||||
return qs.get(name, [default])[0]
|
||||
|
||||
where = ["LOWER(g.type)='game'"]
|
||||
params = []
|
||||
if q("q"):
|
||||
where.append("g.name LIKE ? COLLATE NOCASE")
|
||||
params.append(f"%{q('q')}%")
|
||||
if q("genre"):
|
||||
where.append("EXISTS (SELECT 1 FROM game_genres gg WHERE gg.appid=g.appid AND gg.genre=?)")
|
||||
params.append(q("genre"))
|
||||
if q("tag"):
|
||||
where.append("""EXISTS (SELECT 1 FROM game_tags gt JOIN tag_names tn ON tn.tag_id=gt.tag_id
|
||||
WHERE gt.appid=g.appid AND tn.name=?)""")
|
||||
params.append(q("tag"))
|
||||
if q("status"):
|
||||
where.append("COALESCE(pe.status,'backlog') = ?")
|
||||
params.append(q("status"))
|
||||
if q("installed") == "1":
|
||||
where.append("COALESCE(i.installed,0) = 1")
|
||||
if q("unplayed") == "1":
|
||||
where.append("COALESCE(p.minutes,0) = 0")
|
||||
if q("favorite") == "1":
|
||||
where.append("COALESCE(pe.favorite,0) = 1")
|
||||
|
||||
sort = q("sort", "name")
|
||||
order = {
|
||||
"name": "g.name COLLATE NOCASE ASC",
|
||||
"hours": "COALESCE(p.minutes,0) DESC, g.name COLLATE NOCASE",
|
||||
"review": "COALESCE(g.review_pct,0) DESC, g.name COLLATE NOCASE",
|
||||
"year": "COALESCE(g.release_date,'') DESC, g.name COLLATE NOCASE",
|
||||
"added": "g.appid DESC",
|
||||
}.get(sort, "g.name COLLATE NOCASE ASC")
|
||||
|
||||
page = max(1, int(q("page", "1") or 1))
|
||||
per_page = min(120, max(12, int(q("per_page", "60") or 60)))
|
||||
base = f"""FROM games g
|
||||
JOIN game_playtime p ON p.appid=g.appid
|
||||
LEFT JOIN game_install i ON i.appid=g.appid
|
||||
LEFT JOIN personal pe ON pe.appid=g.appid
|
||||
LEFT JOIN game_details d ON d.appid=g.appid
|
||||
WHERE {' AND '.join(where)}"""
|
||||
con = connect()
|
||||
try:
|
||||
total = con.execute(f"SELECT COUNT(*) c {base}", params).fetchone()["c"]
|
||||
rows = con.execute(
|
||||
f"""SELECT g.appid, g.name, g.release_date, g.metacritic, g.review_pct,
|
||||
COALESCE(p.minutes,0) minutes, COALESCE(i.installed,0) installed,
|
||||
COALESCE(pe.status,'backlog') status, pe.rating,
|
||||
COALESCE(pe.favorite,0) favorite, pe.notes
|
||||
{base} ORDER BY {order} LIMIT ? OFFSET ?""",
|
||||
[*params, per_page, (page - 1) * per_page]).fetchall()
|
||||
ids = [r["appid"] for r in rows]
|
||||
tags = game_tags_map(con, ids)
|
||||
genres = game_genres_map(con, ids)
|
||||
details = details_map(con, ids)
|
||||
items = [serialize(r, tags.get(r["appid"], []), genres.get(r["appid"], []),
|
||||
details.get(r["appid"])) for r in rows]
|
||||
missing = [r["appid"] for r in rows if r["appid"] not in details]
|
||||
DETAILS.enqueue_many(missing)
|
||||
self._json({"total": total, "page": page, "per_page": per_page, "items": items})
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
def _game(self, appid, qs):
|
||||
con = connect()
|
||||
try:
|
||||
r = con.execute("""
|
||||
SELECT g.appid, g.name, g.type, g.release_date, g.metacritic, g.review_pct,
|
||||
COALESCE(p.minutes,0) minutes, p.last_played,
|
||||
COALESCE(i.installed,0) installed, i.size_bytes,
|
||||
COALESCE(pe.status,'backlog') status, pe.rating,
|
||||
COALESCE(pe.favorite,0) favorite, pe.notes
|
||||
FROM games g
|
||||
JOIN game_playtime p ON p.appid=g.appid
|
||||
LEFT JOIN game_install i ON i.appid=g.appid
|
||||
LEFT JOIN personal pe ON pe.appid=g.appid
|
||||
WHERE g.appid = ?""", (appid,)).fetchone()
|
||||
if not r:
|
||||
self._error(404, "unknown appid")
|
||||
return
|
||||
if qs.get("fetch", ["0"])[0] == "1":
|
||||
DETAILS.fetch_now(appid)
|
||||
con.close()
|
||||
con = connect()
|
||||
tags = game_tags_map(con, [appid]).get(appid, [])
|
||||
genres = game_genres_map(con, [appid]).get(appid, [])
|
||||
d = details_map(con, [appid]).get(appid)
|
||||
item = serialize(r, tags, genres, d)
|
||||
item.update({
|
||||
"size_gb": round((r["size_bytes"] or 0) / (1024 ** 3), 1),
|
||||
"last_played": r["last_played"],
|
||||
"about": (d["about_ru"] or d["about"]) if d else None,
|
||||
"steam_url": f"https://store.steampowered.com/app/{appid}/",
|
||||
})
|
||||
attrs = [{"key": a["key"], "value": a["value"]} for a in con.execute(
|
||||
"SELECT key, value FROM attributes WHERE appid=? ORDER BY key", (appid,))]
|
||||
item["attributes"] = attrs
|
||||
item["similar"] = reco.similar_games(con, appid, limit=6)
|
||||
self._json(item)
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
def _moods(self):
|
||||
con = connect()
|
||||
try:
|
||||
moods = [{"name": r["name"], "description": r["description"],
|
||||
"genres": json.loads(r["genres"]), "tags": json.loads(r["tags"])}
|
||||
for r in con.execute("SELECT * FROM moods ORDER BY name")]
|
||||
self._json({"moods": moods})
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
def _recommend(self, body):
|
||||
con = connect()
|
||||
try:
|
||||
db.seed_moods(con)
|
||||
try:
|
||||
mood = reco.load_mood(con, body.get("preset"), body.get("mood"))
|
||||
except (KeyError, ValueError):
|
||||
self._error(400, "unknown mood")
|
||||
return
|
||||
allowed = {"backlog", "playing", "played"}
|
||||
if body.get("include_tribute"):
|
||||
allowed.add("tribute")
|
||||
if body.get("include_nostalgia"):
|
||||
allowed.add("nostalgia")
|
||||
mood, results = reco.recommend(
|
||||
con, mood,
|
||||
allowed_statuses=allowed,
|
||||
unplayed_only=bool(body.get("unplayed_only")),
|
||||
min_review=int(body.get("min_review", 65)),
|
||||
allow_unknown=bool(body.get("allow_unknown")),
|
||||
limit=min(100, int(body.get("limit", 36))),
|
||||
)
|
||||
ids = [g["appid"] for g in results]
|
||||
details = details_map(con, ids)
|
||||
DETAILS.enqueue_many([i for i in ids if i not in details])
|
||||
for g in results:
|
||||
row = details.get(g["appid"])
|
||||
g["description"] = description_of(row)
|
||||
g["desc_status"] = row["status"] if row else None
|
||||
self._json({"mood": mood, "results": results})
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
def _update_personal(self, appid, body):
|
||||
con = connect()
|
||||
try:
|
||||
exists = con.execute("SELECT 1 FROM games WHERE appid=?", (appid,)).fetchone()
|
||||
if not exists:
|
||||
self._error(404, "unknown appid")
|
||||
return
|
||||
now = datetime.now(timezone.utc).isoformat(timespec="seconds")
|
||||
con.execute("INSERT OR IGNORE INTO personal (appid, status, updated_at) VALUES (?, 'backlog', ?)",
|
||||
(appid, now))
|
||||
sets, vals = [], []
|
||||
if "status" in body and body["status"] in STATUSES:
|
||||
sets.append("status=?")
|
||||
vals.append(body["status"])
|
||||
if "rating" in body:
|
||||
rating = int(body["rating"])
|
||||
sets.append("rating=?")
|
||||
vals.append(rating if 1 <= rating <= 10 else None)
|
||||
if "favorite" in body:
|
||||
sets.append("favorite=?")
|
||||
vals.append(1 if body["favorite"] else 0)
|
||||
if "notes" in body:
|
||||
sets.append("notes=?")
|
||||
vals.append(body["notes"])
|
||||
if not sets:
|
||||
self._error(400, "nothing to update")
|
||||
return
|
||||
sets.append("updated_at=?")
|
||||
vals.append(now)
|
||||
con.execute(f"UPDATE personal SET {', '.join(sets)} WHERE appid=?", [*vals, appid])
|
||||
con.commit()
|
||||
row = con.execute("SELECT * FROM personal WHERE appid=?", (appid,)).fetchone()
|
||||
self._json({k: row[k] for k in row.keys()})
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
def _missing_ids(self, limit, retry_missing=False):
|
||||
limit = int(limit)
|
||||
con = connect()
|
||||
try:
|
||||
if retry_missing:
|
||||
rows = con.execute("""
|
||||
SELECT d.appid FROM game_details d JOIN games g ON g.appid=d.appid
|
||||
WHERE d.status='missing' AND LOWER(g.type)='game'
|
||||
ORDER BY COALESCE(g.review_pct,0) DESC LIMIT ?""", (limit,)).fetchall()
|
||||
ids = [r["appid"] for r in rows]
|
||||
if ids:
|
||||
ph = ",".join("?" * len(ids))
|
||||
con.execute(f"DELETE FROM game_details WHERE appid IN ({ph})", ids)
|
||||
con.commit()
|
||||
return ids
|
||||
rows = con.execute("""
|
||||
SELECT g.appid FROM games g
|
||||
LEFT JOIN game_details d ON d.appid=g.appid
|
||||
LEFT JOIN game_playtime p ON p.appid=g.appid
|
||||
WHERE LOWER(g.type)='game' AND d.appid IS NULL
|
||||
ORDER BY (COALESCE(p.minutes,0)=0) DESC, COALESCE(g.review_pct,0) DESC
|
||||
LIMIT ?""", (limit,)).fetchall()
|
||||
return [r["appid"] for r in rows]
|
||||
finally:
|
||||
con.close()
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="SteamBase web UI")
|
||||
ap.add_argument("--host", default="127.0.0.1")
|
||||
ap.add_argument("--port", type=int, default=8765)
|
||||
ap.add_argument("--open", action="store_true")
|
||||
args = ap.parse_args()
|
||||
|
||||
global DETAILS
|
||||
con = db.connect(db.DEFAULT_DB)
|
||||
db.init(con)
|
||||
db.seed_moods(con)
|
||||
con.close()
|
||||
DETAILS = DetailsService(db.DEFAULT_DB, delay=1.4)
|
||||
|
||||
url = f"http://{args.host}:{args.port}/"
|
||||
print(f"SteamBase UI: {url}")
|
||||
if args.open:
|
||||
threading.Timer(0.7, lambda: webbrowser.open(url)).start()
|
||||
server = ThreadingHTTPServer((args.host, args.port), Handler)
|
||||
try:
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -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