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
+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();