From 7840caedb5cf342658d379d3e756f1a17f6339f9 Mon Sep 17 00:00:00 2001 From: strsv Date: Sat, 7 Nov 2026 05:11:08 +0300 Subject: [PATCH] feat: compact recommendation controls Limit preset chips to two rows, move the run button into the prompt, collapse filters, add a sticky compact bar after results, and show feedback as hover icons on covers. --- web/static/app.js | 54 ++++++++++++++++++++++++++--- web/static/index.html | 80 +++++++++++++++++++++++++------------------ web/static/styles.css | 69 +++++++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 39 deletions(-) diff --git a/web/static/app.js b/web/static/app.js index da57aa6..0d453e3 100644 --- a/web/static/app.js +++ b/web/static/app.js @@ -297,9 +297,10 @@ function cardHtml(g, mode = "library") { ? `` : ""; const feedback = mode === "reco" ? `
- ${[["like", "в точку"], ["dislike", "не то"], ["played", "уже играл"], ["ignore", "не хочу"]] - .map(([verdict, label]) => ``).join("")} + ${[["like", "✓", "в точку"], ["dislike", "✕", "не то"], + ["played", "▶", "уже играл"], ["ignore", "⊘", "не хочу"]] + .map(([verdict, icon, label]) => ``).join("")}
` : ""; return `
@@ -307,7 +308,7 @@ function cardHtml(g, mode = "library") {
${esc(initials(g.name))}
- ${review}${installed}${shared}${selectBox} + ${review}${installed}${shared}${feedback}${selectBox}

${esc(g.name)}

@@ -316,7 +317,6 @@ function cardHtml(g, mode = "library") { ${matched} ${reasons} ${desc} - ${feedback}
${statusChip(g.status)}
`; @@ -974,11 +974,52 @@ async function loadMoods() { }); updateMoodTools(); fillCompareSelects(); + updateMoodChipsOverflow(); } catch (err) { toast(err.message); } } +function updateMoodChipsOverflow() { + const wrap = $("#moodChipsWrap"); + const chips = $("#moodChips"); + const more = $("#moodMore"); + if (!wrap || !chips || !more) return; + if (wrap.classList.contains("expanded")) { + more.classList.remove("hidden"); + more.textContent = "свернуть"; + return; + } + const overflow = chips.scrollHeight > wrap.clientHeight + 2; + more.classList.toggle("hidden", !overflow); + more.textContent = "ещё"; +} + +function collapseMoodPanel(description) { + const panel = $("#moodPanel"); + if (!panel) return; + $("#moodCompactText").textContent = description || "подборка"; + $("#moodCompact").classList.remove("hidden"); + panel.classList.add("compact"); +} + +function expandMoodPanel() { + const panel = $("#moodPanel"); + if (!panel) return; + panel.classList.remove("compact"); + $("#moodCompact").classList.add("hidden"); + panel.scrollIntoView({ behavior: "smooth", block: "start" }); + updateMoodChipsOverflow(); +} + +$("#moodMore").addEventListener("click", () => { + const wrap = $("#moodChipsWrap"); + wrap.classList.toggle("expanded"); + updateMoodChipsOverflow(); +}); +$("#moodCompactEdit").addEventListener("click", expandMoodPanel); +window.addEventListener("resize", debounce(updateMoodChipsOverflow, 150)); + function updateMoodTools() { const mood = state.moods.find((item) => item.name === state.preset); const custom = !!(mood && !mood.builtin); @@ -1263,6 +1304,9 @@ async function runRecommend(scroll = true) { $("#recoActions").classList.toggle("hidden", !data.results.length); bindCards(recoGrid); scheduleDescriptions(); + if (data.results.length) { + collapseMoodPanel(mood.description || text || "подборка"); + } if (scroll) $("#recoSummary").scrollIntoView({ behavior: "smooth", block: "start" }); } catch (err) { toast(err.message); diff --git a/web/static/index.html b/web/static/index.html index f8d1387..21bf517 100644 --- a/web/static/index.html +++ b/web/static/index.html @@ -289,12 +289,19 @@ try { -
+
+

Что хочется сейчас?

Выбери профиль или опиши словами — подберу из твоей библиотеки.

-
+
+
+
+
@@ -316,39 +323,44 @@ try {
- -
- - - - - - - - + - +
+ Параметры и фильтры +
+ + + + + + + + +
+
diff --git a/web/static/styles.css b/web/static/styles.css index 30cf2f2..0132822 100644 --- a/web/static/styles.css +++ b/web/static/styles.css @@ -584,6 +584,31 @@ html[data-theme="light"] .select-box { line-height: 1.45; } .feedback-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; } +.cover .feedback-row { + position: absolute; + left: 6px; + right: 6px; + bottom: 6px; + z-index: 4; + margin: 0; + padding: 4px; + border-radius: 8px; + background: rgba(8, 11, 17, .78); + opacity: 0; + transform: translateY(4px); + pointer-events: none; + transition: .15s; +} +.cover .feedback-row .fb { min-width: 26px; padding: 3px 6px; } +.card:hover .cover .feedback-row, +.card:focus-within .cover .feedback-row { + opacity: 1; + transform: none; + pointer-events: auto; +} +@media (hover: none) { + .cover .feedback-row { opacity: 1; transform: none; pointer-events: auto; } +} .feedback-row .fb { padding: 3px 7px; border-radius: 6px; @@ -890,6 +915,47 @@ html[data-theme="light"] .game-table tbody tr:hover { background: rgba(23, 32, 5 } .mood-panel h1 { font-size: 26px; } .mood-panel p { margin: 6px 0 0; } +.mood-panel.compact { + position: sticky; + top: 78px; + z-index: 15; + gap: 0; + padding: 10px 14px; + border-radius: 14px; + box-shadow: 0 12px 30px rgba(0, 0, 0, .32); +} +.mood-panel.compact > :not(.mood-compact) { display: none !important; } +.mood-compact { display: flex; align-items: center; gap: 12px; font-size: 13px; } +.mood-compact[hidden] { display: none; } +.mood-compact span { + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.mood-chips-wrap { max-height: 78px; overflow: hidden; } +.mood-chips-wrap.expanded { max-height: none; } +#moodMore { align-self: flex-start; } +.mood-search { position: relative; } +.mood-search textarea { padding-right: 118px; } +.mood-go { + position: absolute; + right: 8px; + bottom: 8px; + padding: 8px 14px; + border-radius: 9px; + font-size: 12.5px; +} +.mood-options { + padding: 0 10px; + border: 1px solid var(--border); + border-radius: 12px; + background: rgba(255, 255, 255, .015); +} +.mood-options summary { padding: 8px 0; cursor: pointer; font-size: 12px; color: var(--muted); } +.mood-options[open] summary { color: var(--text); } +.mood-options .options { padding-bottom: 10px; } .mood-tools { display: flex; flex-wrap: wrap; gap: 12px; margin-top: -4px; } .mood-editor { display: flex; @@ -1498,6 +1564,9 @@ html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c9c0ad; } .friends-sidebar { position: static; } .friends-list { max-height: 360px; } .friends-manual-row input { max-width: none; } + .mood-panel.compact { top: 8px; } + .mood-search textarea { padding-right: 104px; } + .mood-go { padding: 7px 10px; font-size: 12px; } .stats { width: 100%; justify-content: flex-start; } main { padding: 18px 16px 60px; } .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }