Disable the fold button when no run is long enough to fold

This commit is contained in:
2026-10-14 22:07:21 +02:00
parent 14e0ddc7b9
commit e09dabd441
3 changed files with 22 additions and 3 deletions
+9 -1
View File
@@ -164,6 +164,7 @@ function toggleRun(hash: string) {
}
function toggleCollapseAll() {
if (!built.value.collapsible) return showToast("nothing to fold: no run of 3 or more plain commits");
collapseAll.value = !collapseAll.value;
toggled.value = new Set();
}
@@ -244,7 +245,13 @@ onUnmounted(() => {
<span v-if="repo" class="path">{{ repo.root }}</span>
<span class="spacer" />
<span v-if="repo" class="stats">{{ visibleCommits.length }} commits · {{ visibleRefs.length }}/{{ repo.refs.length }} refs</span>
<button class="collapse" :class="{ on: collapseAll }" title="c" @click="toggleCollapseAll">
<button
class="collapse"
:class="{ on: collapseAll && built.collapsible }"
:disabled="!built.collapsible"
:title="built.collapsible ? 'c' : 'Nothing to fold: no run of 3 or more commits without a branch, tag or merge'"
@click="toggleCollapseAll"
>
<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round">
<circle cx="8" cy="2.5" r="1.6" />
<circle cx="8" cy="13.5" r="1.6" />
@@ -362,6 +369,7 @@ onUnmounted(() => {
.spacer { flex: 1; }
.stats { color: var(--text-dim); font-size: 12px; }
.collapse { display: inline-flex; align-items: center; gap: 6px; }
.collapse:disabled { opacity: 0.4; cursor: default; background: none; }
.collapse.on { border-color: var(--accent); color: var(--accent); background: #b197fc1a; }
.main { flex: 1; display: flex; min-height: 0; }
.list { flex: 1; overflow: auto; position: relative; }