Fix docs panel on mobile: lower hide threshold to 45 cols
The auto-hide threshold (100 cols) was hiding the panel before the vertical layout logic could apply. Now: - >= 80 cols: panel on the right (horizontal) - 45-79 cols: panel at the bottom (vertical, max 40% height) - < 45 cols: panel hidden Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
18
tui/app.py
18
tui/app.py
@@ -63,8 +63,9 @@ class GnizaApp(App):
|
||||
else:
|
||||
self.notify(f"{job.label} failed (exit code {message.return_code})", severity="error")
|
||||
|
||||
# Width threshold for auto-hiding the docs panel
|
||||
DOCS_AUTO_HIDE_WIDTH = 100
|
||||
# Width thresholds for docs panel
|
||||
DOCS_VERTICAL_WIDTH = 80 # Below: panel moves to bottom
|
||||
DOCS_HIDE_WIDTH = 45 # Below: panel hidden entirely
|
||||
|
||||
def action_toggle_docs(self) -> None:
|
||||
try:
|
||||
@@ -74,9 +75,6 @@ class GnizaApp(App):
|
||||
except NoMatches:
|
||||
pass
|
||||
|
||||
# Width threshold for switching docs panel to bottom
|
||||
DOCS_VERTICAL_WIDTH = 80
|
||||
|
||||
def on_resize(self, event: Resize) -> None:
|
||||
self._update_docs_layout(event.size.width)
|
||||
|
||||
@@ -87,15 +85,13 @@ class GnizaApp(App):
|
||||
def _update_docs_layout(self, width: int) -> None:
|
||||
try:
|
||||
panel = self.screen.query_one("#docs-panel")
|
||||
except NoMatches:
|
||||
return
|
||||
if not getattr(panel, "_user_toggled", False):
|
||||
panel.display = width >= self.DOCS_AUTO_HIDE_WIDTH
|
||||
# Switch layout direction based on width
|
||||
try:
|
||||
container = self.screen.query_one(".screen-with-docs")
|
||||
except NoMatches:
|
||||
return
|
||||
# Auto-hide only on very narrow screens (unless user toggled)
|
||||
if not getattr(panel, "_user_toggled", False):
|
||||
panel.display = width >= self.DOCS_HIDE_WIDTH
|
||||
# Switch layout direction
|
||||
if width < self.DOCS_VERTICAL_WIDTH:
|
||||
container.styles.layout = "vertical"
|
||||
panel.styles.width = "100%"
|
||||
|
||||
Reference in New Issue
Block a user