Give the assistant dock a size toggle, so a long answer can have the panel without hiding what it is about

This commit is contained in:
Gmer4Lfe
2026-08-06 22:44:00 -04:00
parent ba1979a662
commit b803fefebd
2 changed files with 38 additions and 1 deletions
+4
View File
@@ -536,6 +536,10 @@ body.vv-fullscreen #displaybox { padding-left: 1rem !important; padding-top: .5r
#vv-ai-dock-input:focus { outline: none; border-color: #2d4a6a; }
#vv-ai-dock-body { border-bottom: 1px solid #1c1c1c; padding: 9px 10px; overflow-y: auto;
font-size: 12px; line-height: 1.55; }
/* Always present, unlike the collapse button next to it — the size of the conversation is worth
changing before there is one, when you already know the answer will be long. */
.vv-ai-dock-grow { flex-shrink: 0; min-width: 26px; }
.vv-ai-dock-grow-on { color: #8fb0c4; border-color: #2d4a6a; background: #12191d; }
.vv-ai-dock-q { color: #8fb0c4; margin: 0 0 5px; }
.vv-ai-dock-q::before { content: ' '; color: #3a5a6a; }
.vv-ai-dock-a { color: #b8b8b8; margin: 0 0 11px; white-space: normal; }
+34 -1
View File
@@ -1066,6 +1066,8 @@ Still the same two servers, two households, the same media stack running itself.
style="display:none" title="Record what actually fixed this, against this script">Save fix</button>
<button class="vv-btn-sm" id="vv-ai-dock-hide" onclick="vvAiDockCollapse()"
style="display:none" title="Collapse — the conversation is kept">▾</button>
<button class="vv-btn-sm vv-ai-dock-grow" id="vv-ai-dock-grow" onclick="vvAiDockGrow()"
title="Give the conversation more of the panel">⤢</button>
</div>
</div>
<?php endif; ?>
@@ -1177,6 +1179,11 @@ function vvPost(url, data) {
}).then(r => r.json());
}
// Whether the assistant dock is holding the larger share of the panel. Persisted: someone working
// through a long answer wants it to still be big after a reload, not to re-expand every visit.
// Declared here rather than with the other dock state because vvFitRight() below reads it.
let vvAiDockBig = localStorage.getItem('vv-ai-dock-big') === '1';
function vvFitRight() {
const right = document.getElementById('vv-sched-right');
if (!right.classList.contains('vv-panel-visible')) return;
@@ -1209,8 +1216,12 @@ function vvFitRight() {
// its floor, and nothing ever raised it again.
const availH = Math.max(80, lf.getBoundingClientRect().top - 32
- toolbar.getBoundingClientRect().bottom);
// Expanded takes most of the panel rather than all of it. The view above is what the question
// is usually about — a log, a conf, a script — and a chat that covers it entirely turns every
// follow-up into a round trip through the collapse button.
const dockBody = document.getElementById('vv-ai-dock-body');
if (dockBody) dockBody.style.maxHeight = Math.max(90, Math.round(availH * 0.4)) + 'px';
const dockCap = vvAiDockBig ? 0.82 : 0.4;
if (dockBody) dockBody.style.maxHeight = Math.max(90, Math.round(availH * dockCap)) + 'px';
// Measured after the cap is applied, so this reads the clamped height, not the natural one.
const dock = document.getElementById('vv-ai-dock');
const dockH = dock ? dock.offsetHeight : 0;
@@ -2379,6 +2390,27 @@ function vvAiDockExpand() {
requestAnimationFrame(vvFitRight);
}
// Trades panel space between the conversation and whatever is above it. Separate from collapse,
// which is all-or-nothing: this is for reading a long answer without losing sight of the log.
function vvAiDockGrow() {
vvAiDockBig = !vvAiDockBig;
localStorage.setItem('vv-ai-dock-big', vvAiDockBig ? '1' : '0');
vvAiDockApplyGrow();
// Growing a hidden conversation would look like the button did nothing, so opening it is part
// of growing. Shrinking deliberately does not collapse — that is what the ▾ button is for.
if (vvAiDockBig) vvAiDockExpand();
else requestAnimationFrame(vvFitRight);
}
function vvAiDockApplyGrow() {
const b = document.getElementById('vv-ai-dock-grow');
if (!b) return;
b.textContent = vvAiDockBig ? '⤡' : '⤢';
b.title = vvAiDockBig ? 'Give the panel back to the view above'
: 'Give the conversation more of the panel';
b.classList.toggle('vv-ai-dock-grow-on', vvAiDockBig);
}
// Collapse is not clear. Re-expanding shows the same conversation, so you can shrink it to read
// the conf the answer was about and open it again without paying for the turn twice.
function vvAiDockCollapse() {
@@ -4900,6 +4932,7 @@ document.querySelectorAll('.vv-sched-card').forEach(card => {
requestAnimationFrame(function() {
vvRestoreInvert();
vvAiDockApplyGrow();
vvRestoreAdvancedMode();
vvRestoreSugStates();
vvApplyHighlighting();