feat: add friends sidebar layout

Move the friend list and search into a sticky left sidebar and keep library comparison in the right pane.
This commit is contained in:
strsv committed 2026-11-07 04:55:06 +03:00
1 parent 15f4951623
commit f73ed63b2b
3 files changed
+76 -32

No files matched your search

+9 -3
View File
@@ -1537,7 +1537,9 @@ function renderFriendCompare(data) {
<div class="compare-col"><h3>только у друга (${only.length})</h3>${friendGameList(only, false, friendsState.limit)}</div>
</div>`;
$("#friendClose").addEventListener("click", () => {
box.classList.add("hidden");
box.innerHTML = '<div class="empty">выберите друга, чтобы сравнить библиотеки</div>';
friendsState.compare = null;
document.querySelectorAll(".friend-card.active").forEach((card) => card.classList.remove("active"));
setFriendUrl(null);
});
box.querySelectorAll("button[data-appid]").forEach((button) => {
@@ -1619,11 +1621,15 @@ async function openFriendCompare(steamid) {
if (cached) {
friendsState.compare = cached;
renderFriendCompare(cached);
box.scrollIntoView({ behavior: "smooth", block: "start" });
if (window.matchMedia("(max-width: 980px)").matches) {
box.scrollIntoView({ behavior: "smooth", block: "start" });
}
return;
}
box.innerHTML = '<div class="muted">загрузка…</div>';
box.scrollIntoView({ behavior: "smooth", block: "start" });
if (window.matchMedia("(max-width: 980px)").matches) {
box.scrollIntoView({ behavior: "smooth", block: "start" });
}
try {
const data = await api(`/api/steam/friends/${encodeURIComponent(steamid)}`);
friendsState.cache.set(steamid, data);