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.
This commit is contained in:
1 parent
6644a94d8c
commit
7840caedb5
3 files changed
+164
-39
No files matched your search
+49
-5
@@ -297,9 +297,10 @@ function cardHtml(g, mode = "library") {
|
|||||||
? `<ul class="reasons">${g.reasons.map((reason) => `<li>${esc(reason)}</li>`).join("")}</ul>` : "";
|
? `<ul class="reasons">${g.reasons.map((reason) => `<li>${esc(reason)}</li>`).join("")}</ul>` : "";
|
||||||
const feedback = mode === "reco" ? `
|
const feedback = mode === "reco" ? `
|
||||||
<div class="feedback-row">
|
<div class="feedback-row">
|
||||||
${[["like", "в точку"], ["dislike", "не то"], ["played", "уже играл"], ["ignore", "не хочу"]]
|
${[["like", "✓", "в точку"], ["dislike", "✕", "не то"],
|
||||||
.map(([verdict, label]) => `<button class="fb${g.feedback === verdict ? " active" : ""}" type="button"
|
["played", "▶", "уже играл"], ["ignore", "⊘", "не хочу"]]
|
||||||
data-verdict="${verdict}" data-appid="${g.appid}">${label}</button>`).join("")}
|
.map(([verdict, icon, label]) => `<button class="fb${g.feedback === verdict ? " active" : ""}" type="button"
|
||||||
|
data-verdict="${verdict}" data-appid="${g.appid}" title="${label}" aria-label="${label}">${icon}</button>`).join("")}
|
||||||
</div>` : "";
|
</div>` : "";
|
||||||
return `
|
return `
|
||||||
<article class="card" data-appid="${g.appid}" tabindex="0" role="button" aria-label="Открыть ${esc(g.name)}">
|
<article class="card" data-appid="${g.appid}" tabindex="0" role="button" aria-label="Открыть ${esc(g.name)}">
|
||||||
@@ -307,7 +308,7 @@ function cardHtml(g, mode = "library") {
|
|||||||
<img data-appid="${g.appid}" loading="lazy" width="300" height="450"
|
<img data-appid="${g.appid}" loading="lazy" width="300" height="450"
|
||||||
src="${coverUrl(g.appid)}" alt="">
|
src="${coverUrl(g.appid)}" alt="">
|
||||||
<div class="fallback">${esc(initials(g.name))}</div>
|
<div class="fallback">${esc(initials(g.name))}</div>
|
||||||
${review}${installed}${shared}${selectBox}
|
${review}${installed}${shared}${feedback}${selectBox}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h3 class="card-title">${esc(g.name)}</h3>
|
<h3 class="card-title">${esc(g.name)}</h3>
|
||||||
@@ -316,7 +317,6 @@ function cardHtml(g, mode = "library") {
|
|||||||
${matched}
|
${matched}
|
||||||
${reasons}
|
${reasons}
|
||||||
${desc}
|
${desc}
|
||||||
${feedback}
|
|
||||||
<div class="card-status">${statusChip(g.status)}</div>
|
<div class="card-status">${statusChip(g.status)}</div>
|
||||||
</div>
|
</div>
|
||||||
</article>`;
|
</article>`;
|
||||||
@@ -974,11 +974,52 @@ async function loadMoods() {
|
|||||||
});
|
});
|
||||||
updateMoodTools();
|
updateMoodTools();
|
||||||
fillCompareSelects();
|
fillCompareSelects();
|
||||||
|
updateMoodChipsOverflow();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast(err.message);
|
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() {
|
function updateMoodTools() {
|
||||||
const mood = state.moods.find((item) => item.name === state.preset);
|
const mood = state.moods.find((item) => item.name === state.preset);
|
||||||
const custom = !!(mood && !mood.builtin);
|
const custom = !!(mood && !mood.builtin);
|
||||||
@@ -1263,6 +1304,9 @@ async function runRecommend(scroll = true) {
|
|||||||
$("#recoActions").classList.toggle("hidden", !data.results.length);
|
$("#recoActions").classList.toggle("hidden", !data.results.length);
|
||||||
bindCards(recoGrid);
|
bindCards(recoGrid);
|
||||||
scheduleDescriptions();
|
scheduleDescriptions();
|
||||||
|
if (data.results.length) {
|
||||||
|
collapseMoodPanel(mood.description || text || "подборка");
|
||||||
|
}
|
||||||
if (scroll) $("#recoSummary").scrollIntoView({ behavior: "smooth", block: "start" });
|
if (scroll) $("#recoSummary").scrollIntoView({ behavior: "smooth", block: "start" });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast(err.message);
|
toast(err.message);
|
||||||
|
|||||||
+46
-34
@@ -289,12 +289,19 @@ try {
|
|||||||
</div>
|
</div>
|
||||||
<button id="csGo" class="primary" type="button">Подобрать по ответам</button>
|
<button id="csGo" class="primary" type="button">Подобрать по ответам</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="mood-panel">
|
<div class="mood-panel" id="moodPanel">
|
||||||
|
<div class="mood-compact hidden" id="moodCompact">
|
||||||
|
<span id="moodCompactText"></span>
|
||||||
|
<button id="moodCompactEdit" class="link" type="button">изменить</button>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h1>Что хочется сейчас?</h1>
|
<h1>Что хочется сейчас?</h1>
|
||||||
<p class="muted">Выбери профиль или опиши словами — подберу из твоей библиотеки.</p>
|
<p class="muted">Выбери профиль или опиши словами — подберу из твоей библиотеки.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="moodChips" class="chips"></div>
|
<div class="mood-chips-wrap" id="moodChipsWrap">
|
||||||
|
<div id="moodChips" class="chips"></div>
|
||||||
|
</div>
|
||||||
|
<button id="moodMore" class="link hidden" type="button">ещё</button>
|
||||||
<div class="mood-tools">
|
<div class="mood-tools">
|
||||||
<button id="coldStartOpen" class="link" type="button">пройти опрос</button>
|
<button id="coldStartOpen" class="link" type="button">пройти опрос</button>
|
||||||
<button id="moodCreate" class="link" type="button">+ свой профиль</button>
|
<button id="moodCreate" class="link" type="button">+ свой профиль</button>
|
||||||
@@ -316,39 +323,44 @@ try {
|
|||||||
<button id="meCancel" class="link" type="button">отмена</button>
|
<button id="meCancel" class="link" type="button">отмена</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="moodText" rows="2" placeholder="например: приключение, рпг, прокачка группы, подземелья"></textarea>
|
<div class="mood-search">
|
||||||
<div class="options">
|
<textarea id="moodText" rows="2" placeholder="например: приключение, рпг, прокачка группы, подземелья"></textarea>
|
||||||
<label class="check"><input type="checkbox" id="optUnplayed" checked> только неигранное</label>
|
<button id="recommendBtn" class="primary mood-go">Подобрать</button>
|
||||||
<label class="check"><input type="checkbox" id="optTribute"> учитывать tribute</label>
|
|
||||||
<label class="check"><input type="checkbox" id="optNostalgia"> учитывать nostalgia</label>
|
|
||||||
<label class="check"><input type="checkbox" id="optPlayed"> учитывать пройденные</label>
|
|
||||||
<label class="range">мин. отзывы <input type="range" id="optReview" min="0" max="95" step="5" value="65"><b id="optReviewVal">65%</b></label>
|
|
||||||
<label class="range">время
|
|
||||||
<select id="optSession" aria-label="Доступное время">
|
|
||||||
<option value="">любое</option>
|
|
||||||
<option value="short">30 минут</option>
|
|
||||||
<option value="evening">вечер</option>
|
|
||||||
<option value="weekend">выходные</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="range">сутки
|
|
||||||
<select id="optTimeOfDay" aria-label="Время суток">
|
|
||||||
<option value="">не учитывать</option>
|
|
||||||
<option value="morning">утро</option>
|
|
||||||
<option value="day">день</option>
|
|
||||||
<option value="evening">вечер</option>
|
|
||||||
<option value="night">ночь</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="range">вкус
|
|
||||||
<select id="optTaste" aria-label="Профиль вкуса">
|
|
||||||
<option value="">весь</option>
|
|
||||||
<option value="solo">соло</option>
|
|
||||||
<option value="coop">с друзьями</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
<button id="recommendBtn" class="primary">Подобрать</button>
|
<details class="mood-options" id="moodOptions">
|
||||||
|
<summary>Параметры и фильтры</summary>
|
||||||
|
<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="check"><input type="checkbox" id="optPlayed"> учитывать пройденные</label>
|
||||||
|
<label class="range">мин. отзывы <input type="range" id="optReview" min="0" max="95" step="5" value="65"><b id="optReviewVal">65%</b></label>
|
||||||
|
<label class="range">время
|
||||||
|
<select id="optSession" aria-label="Доступное время">
|
||||||
|
<option value="">любое</option>
|
||||||
|
<option value="short">30 минут</option>
|
||||||
|
<option value="evening">вечер</option>
|
||||||
|
<option value="weekend">выходные</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="range">сутки
|
||||||
|
<select id="optTimeOfDay" aria-label="Время суток">
|
||||||
|
<option value="">не учитывать</option>
|
||||||
|
<option value="morning">утро</option>
|
||||||
|
<option value="day">день</option>
|
||||||
|
<option value="evening">вечер</option>
|
||||||
|
<option value="night">ночь</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="range">вкус
|
||||||
|
<select id="optTaste" aria-label="Профиль вкуса">
|
||||||
|
<option value="">весь</option>
|
||||||
|
<option value="solo">соло</option>
|
||||||
|
<option value="coop">с друзьями</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
</div>
|
</div>
|
||||||
<div class="compare-panel">
|
<div class="compare-panel">
|
||||||
<button id="compareToggle" class="link" type="button">сравнить пресеты</button>
|
<button id="compareToggle" class="link" type="button">сравнить пресеты</button>
|
||||||
|
|||||||
@@ -584,6 +584,31 @@ html[data-theme="light"] .select-box {
|
|||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
}
|
}
|
||||||
.feedback-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
|
.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 {
|
.feedback-row .fb {
|
||||||
padding: 3px 7px;
|
padding: 3px 7px;
|
||||||
border-radius: 6px;
|
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 h1 { font-size: 26px; }
|
||||||
.mood-panel p { margin: 6px 0 0; }
|
.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-tools { display: flex; flex-wrap: wrap; gap: 12px; margin-top: -4px; }
|
||||||
.mood-editor {
|
.mood-editor {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -1498,6 +1564,9 @@ html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c9c0ad; }
|
|||||||
.friends-sidebar { position: static; }
|
.friends-sidebar { position: static; }
|
||||||
.friends-list { max-height: 360px; }
|
.friends-list { max-height: 360px; }
|
||||||
.friends-manual-row input { max-width: none; }
|
.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; }
|
.stats { width: 100%; justify-content: flex-start; }
|
||||||
main { padding: 18px 16px 60px; }
|
main { padding: 18px 16px 60px; }
|
||||||
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
|
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
|
||||||
|
|||||||
Reference in new issue
Block a user