diff --git a/web/static/app.js b/web/static/app.js index 1894554..9c5513b 100644 --- a/web/static/app.js +++ b/web/static/app.js @@ -1537,7 +1537,9 @@ function renderFriendCompare(data) {

только у друга (${only.length})

${friendGameList(only, false, friendsState.limit)}
`; $("#friendClose").addEventListener("click", () => { - box.classList.add("hidden"); + box.innerHTML = '
выберите друга, чтобы сравнить библиотеки
'; + 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 = '
загрузка…
'; - 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); diff --git a/web/static/index.html b/web/static/index.html index 0242fb6..dbf75e5 100644 --- a/web/static/index.html +++ b/web/static/index.html @@ -411,27 +411,33 @@ try {

Друзья

-
- - - - +
+ +
+
выберите друга, чтобы сравнить библиотеки
+
-
- сравнить по SteamID64 -
- - -
-
- -
diff --git a/web/static/styles.css b/web/static/styles.css index e536707..3a3f5d2 100644 --- a/web/static/styles.css +++ b/web/static/styles.css @@ -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; }