feat: selected items

This commit is contained in:
kodi
2026-03-13 12:26:17 +01:00
parent 7ab233be2c
commit e43d49540d
3 changed files with 43 additions and 10 deletions
+19 -8
View File
@@ -913,19 +913,30 @@ function scrollCurrentRowIntoView(pane) {
function updatePaneFocusLine(pane) { function updatePaneFocusLine(pane) {
const model = paneState(pane); const model = paneState(pane);
const focusLine = document.getElementById(`${pane}-focus-line`); const focusLine = document.getElementById(`${pane}-focus-line`);
if (!focusLine) { const nameEl = document.getElementById(`${pane}-focus-name`);
const selectedEl = document.getElementById(`${pane}-focus-selected`);
if (!focusLine || !nameEl || !selectedEl) {
return; return;
} }
let label = "—";
if (!Array.isArray(model.visibleItems) || model.currentRowIndex < 0 || model.currentRowIndex >= model.visibleItems.length) { if (!Array.isArray(model.visibleItems) || model.currentRowIndex < 0 || model.currentRowIndex >= model.visibleItems.length) {
focusLine.textContent = "—"; label = "—";
return; } else {
}
const item = model.visibleItems[model.currentRowIndex]; const item = model.visibleItems[model.currentRowIndex];
if (!item) { if (item) {
focusLine.textContent = "—"; label = item.isParent ? "../" : (item.name || "—");
return; }
}
nameEl.textContent = label;
const selectedCount = Array.isArray(model.selectedItems) ? model.selectedItems.length : 0;
if (selectedCount > 0) {
selectedEl.textContent = `Selected: ${selectedCount} ${selectedCount === 1 ? "item" : "items"}`;
selectedEl.classList.remove("hidden");
} else {
selectedEl.textContent = "";
selectedEl.classList.add("hidden");
} }
focusLine.textContent = item.isParent ? "../" : (item.name || "—");
} }
function renderPaneItems(pane) { function renderPaneItems(pane) {
+16
View File
@@ -137,11 +137,27 @@ h1 {
color: var(--color-text-muted); color: var(--color-text-muted);
font-size: 12px; font-size: 12px;
line-height: 1.25; line-height: 1.25;
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
.pane-focus-name {
flex: 1 1 auto;
min-width: 0;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.pane-focus-selected {
flex: 0 0 auto;
white-space: nowrap;
color: var(--color-text-secondary, var(--color-text-primary));
opacity: 0.9;
}
.toolbar { .toolbar {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
+8 -2
View File
@@ -49,7 +49,10 @@
<ul id="left-items" class="list"></ul> <ul id="left-items" class="list"></ul>
</div> </div>
</div> </div>
<div id="left-focus-line" class="pane-focus-line" aria-live="polite"></div> <div id="left-focus-line" class="pane-focus-line" aria-live="polite">
<span id="left-focus-name" class="pane-focus-name"></span>
<span id="left-focus-selected" class="pane-focus-selected hidden"></span>
</div>
</section> </section>
<section class="panel pane" id="right-pane" data-pane="right"> <section class="panel pane" id="right-pane" data-pane="right">
@@ -73,7 +76,10 @@
<ul id="right-items" class="list"></ul> <ul id="right-items" class="list"></ul>
</div> </div>
</div> </div>
<div id="right-focus-line" class="pane-focus-line" aria-live="polite"></div> <div id="right-focus-line" class="pane-focus-line" aria-live="polite">
<span id="right-focus-name" class="pane-focus-name"></span>
<span id="right-focus-selected" class="pane-focus-selected hidden"></span>
</div>
</section> </section>
</main> </main>