mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 20:45:33 -08:00
Dock the desktop app's terminal right by default and fit its collapsed strip
AI Assisted
This commit is contained in:
1 parent
efc96e91c2
commit
b73a4cebe7
6 files changed
+93
-2
No files matched your search
@@ -2,7 +2,7 @@
|
||||
// agent's terminal panel docked at the bottom with a drag handle.
|
||||
|
||||
import { mountTerminal } from './terminal.js';
|
||||
import { barNextSteps, folderName, windowTitleFor } from './meter.js';
|
||||
import { barNextSteps, defaultRightFraction, folderName, windowTitleFor } from './meter.js';
|
||||
|
||||
const { invoke, Channel } = window.__TAURI__.core;
|
||||
|
||||
@@ -924,6 +924,13 @@ async function main() {
|
||||
paneDock = state.termPanel.dock === 'right' ? 'right' : 'bottom';
|
||||
paneFraction = state.termPanel.fraction;
|
||||
paneCollapsed = Boolean(state.termPanel.collapsed);
|
||||
} else {
|
||||
// Nothing saved yet: start docked right, wide enough to keep the
|
||||
// console's own side-by-side panels from stacking, where the window
|
||||
// allows it.
|
||||
paneDock = 'right';
|
||||
paneFraction = defaultRightFraction(window.innerWidth, { minFraction: MIN_PANE, maxFraction: MAX_PANE });
|
||||
savePaneSettings();
|
||||
}
|
||||
applyPaneLayout();
|
||||
await loadAgentAvailability();
|
||||
|
||||
@@ -165,6 +165,13 @@
|
||||
#term-toolbar button:hover { background: #333; }
|
||||
#term-toolbar button[aria-pressed="true"] { color: #fff; border-color: #888; }
|
||||
#term-panel.collapsed #term-dock, #term-panel.collapsed #term-maximize { display: none; }
|
||||
/* Docked right and collapsed, the panel is a 28px-wide strip: "Expand"
|
||||
does not fit sideways, so it reads top-to-bottom instead, rotated the
|
||||
same way a reader would turn the panel to read it. */
|
||||
#workspace.dock-right #term-panel.collapsed #term-toolbar { padding: 6px 2px; align-items: center; }
|
||||
#workspace.dock-right #term-panel.collapsed #term-collapse {
|
||||
writing-mode: vertical-rl; text-orientation: mixed; padding: 6px 2px;
|
||||
}
|
||||
#term-badge { color: #d7ba7d; font-size: 14px; line-height: 1; }
|
||||
#term-badge[hidden] { display: none; }
|
||||
#term { flex: 1; min-height: 0; min-width: 0; padding: 4px; }
|
||||
|
||||
@@ -59,6 +59,27 @@ export function barNextSteps({ consoleDead = false, version = null } = {}) {
|
||||
return steps.map((step) => ({ ...step, label: step.action ? NEXT_STEP_LABELS[step.action] : null }));
|
||||
}
|
||||
|
||||
// Below this many px of its own width, the console's "Notes on this" aside
|
||||
// stacks under the main column instead of sitting beside it
|
||||
// (src/web-console/public/styles/responsive.css's 1080px breakpoint).
|
||||
export const CONSOLE_ASIDE_BREAKPOINT_PX = 1080;
|
||||
// A roomy default width for the terminal docked at the side, before the
|
||||
// console's own width is taken into account.
|
||||
const IDEAL_RIGHT_PANE_PX = 440;
|
||||
|
||||
/**
|
||||
* The terminal panel's width, as a share of the window, for a first run with
|
||||
* nothing saved yet: docked right, at whatever width keeps the console's own
|
||||
* aside panel from stacking, down to `minFraction` when the window is too
|
||||
* narrow for both (its own minimum still wins over squeezing the console).
|
||||
*/
|
||||
export function defaultRightFraction(windowWidth, { minFraction, maxFraction, idealPanePx = IDEAL_RIGHT_PANE_PX, consoleMinPx = CONSOLE_ASIDE_BREAKPOINT_PX } = {}) {
|
||||
const roomForConsole = Math.max(0, windowWidth - consoleMinPx);
|
||||
const panePx = Math.min(idealPanePx, roomForConsole);
|
||||
const fraction = windowWidth > 0 ? panePx / windowWidth : minFraction;
|
||||
return Math.min(maxFraction, Math.max(minFraction, fraction));
|
||||
}
|
||||
|
||||
/**
|
||||
* The OS window title for a project folder: its own name (the repo's, most
|
||||
* of the time) after "Plan2Code - ", so two or more windows read apart in a
|
||||
|
||||
Reference in new issue
Block a user