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
+55 -11

No files matched your search

+7 -1
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);
if (window.matchMedia("(max-width: 980px)").matches) {
box.scrollIntoView({ behavior: "smooth", block: "start" });
}
return;
}
box.innerHTML = '<div class="muted">загрузка…</div>';
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);
+7 -1
View File
@@ -411,6 +411,8 @@ try {
<h1>Друзья</h1>
<div class="muted" id="friendsSummary"></div>
</div>
<div class="friends-layout">
<aside class="friends-sidebar">
<div class="friends-toolbar">
<input id="friendsSearch" type="search" placeholder="Поиск друга…" autocomplete="off"
aria-label="Поиск друга">
@@ -430,8 +432,12 @@ try {
<button id="friendCompareBtn" class="ghost" type="button">сравнить</button>
</div>
</details>
<div id="friendCompare" class="friend-compare hidden" aria-live="polite"></div>
<div id="friendsList" class="friends-list"></div>
</aside>
<section id="friendCompare" class="friend-compare" aria-live="polite">
<div class="empty" id="friendPlaceholder">выберите друга, чтобы сравнить библиотеки</div>
</section>
</div>
</div>
</section>
+41 -9
View File
@@ -947,6 +947,35 @@ html[data-theme="light"] .game-table tbody tr:hover { background: rgba(23, 32, 5
.compare-jaccard { margin-bottom: 4px; font-size: 13px; color: var(--text); }
.friends-page { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.friends-layout {
display: grid;
grid-template-columns: 300px minmax(0, 1fr);
gap: 18px;
align-items: start;
min-width: 0;
}
.friends-sidebar {
display: flex;
flex-direction: column;
gap: 10px;
position: sticky;
top: 84px;
min-width: 0;
}
.friends-sidebar .friends-toolbar {
flex-direction: column;
align-items: stretch;
gap: 6px;
}
.friends-sidebar .friends-toolbar input,
.friends-sidebar .friends-toolbar select,
.friends-sidebar .friends-toolbar .ghost {
flex: 0 0 auto;
width: 100%;
max-width: none;
min-width: 0;
}
.friends-sidebar .friends-toolbar .count { margin-left: 0; }
.friends-toolbar {
display: flex;
flex-wrap: wrap;
@@ -970,10 +999,13 @@ html[data-theme="light"] .game-table tbody tr:hover { background: rgba(23, 32, 5
.friends-manual-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 10px; }
.friends-manual-row input { flex: 1 1 220px; max-width: 320px; }
.friends-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
gap: 10px;
display: flex;
flex-direction: column;
gap: 8px;
min-width: 0;
max-height: calc(100vh - 330px);
overflow-y: auto;
padding-right: 4px;
}
.friend-card {
display: flex;
@@ -1413,6 +1445,9 @@ html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c9c0ad; }
.pin { display: none; }
.modal-grid { grid-template-columns: 1fr; }
.modal-cover { max-height: 260px; }
.friends-layout { grid-template-columns: 1fr; }
.friends-sidebar { position: static; }
.friends-list { max-height: 360px; }
}
@media (max-width: 720px) {
@@ -1420,12 +1455,9 @@ html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c9c0ad; }
.theme-toggle { position: absolute; top: 12px; right: 16px; }
.tabs { gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; }
.tab { padding: 6px 9px; font-size: 12px; white-space: nowrap; }
.friends-list { grid-template-columns: 1fr; }
.friends-toolbar { display: flex; }
.friends-toolbar input { flex: 1 1 100%; max-width: none; }
.friends-toolbar select { flex: 1 1 auto; min-width: 0; }
.friends-toolbar .ghost { flex: 0 0 auto; }
.friends-toolbar .count { flex: 1 1 100%; margin-left: 0; }
.friends-layout { grid-template-columns: 1fr; }
.friends-sidebar { position: static; }
.friends-list { max-height: 360px; }
.friends-manual-row input { max-width: none; }
.stats { width: 100%; justify-content: flex-start; }
main { padding: 18px 16px 60px; }