feat(tui-v2): cap card width, fix hint casing, verb-first compact strip

Add max_width=72 to _board_card so Content cards don't stretch across
viewport. Capitalize Nostr QR Private hint. Compact mode global strip
now uses verb-first labels matching normal and dense modes.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.6 committed 2026-03-02 21:07:20 -05:00
1 parent de12289d3e
commit 08e71bd1b4
4 files changed
+45 -8

No files matched your search

+20
View File
@@ -1248,3 +1248,23 @@ Validation:
1. `poetry run pytest -q src/tests/test_tui_v2_textual_interactions.py src/tests/test_tui_v2_action_matrix.py`
2. Result: `58 passed`.
## 35) Progress Update (2026-03-03, Slice: Final Micro-Polish)
Completed:
1. Added max-width cap (72 chars) to `_board_card` renderer:
- Content cards no longer stretch across the full viewport.
- Long rows are truncated with ellipsis character.
- Note board max line width reduced from ~112 to 76 chars.
2. Capitalized Nostr action hint:
- Before: `qr private confirm`
- After: `QR Private (confirm)`
3. Compact mode global strip now uses verb-first labels:
- Before: `S Settings A Add C Create Seed R Remove Seed H Hide/Reveal E Export I Import B Backup Ctrl+P Cmd Compact`
- After: `Settings (S) Add (A) Seed+ (C) Seed- (R) Reveal (H) Export (E) Import (I) Backup (B) Cmd (Ctrl+P)`
Validation:
1. `poetry run pytest -q src/tests/test_tui_v2_textual_interactions.py src/tests/test_tui_v2_action_matrix.py`
2. Result: `58 passed`.
+11
View File
@@ -210,3 +210,14 @@
### Verification
- Focused TUI v2 gate: `58 passed`.
## Session Update (2026-03-03, Slice 9)
### Final micro-polish
- `_board_card` now has max_width=72 cap with ellipsis truncation for long rows.
- Nostr action hint capitalized: `QR Private (confirm)`.
- Compact mode global strip verb-first: `Settings (S) Add (A) ...`.
- All three modes (compact/dense/normal) now share consistent verb-first label style.
### Verification
- Focused TUI v2 gate: `58 passed`.
+12 -6
View File
@@ -906,7 +906,7 @@ def launch_tui2(
if kind:
context = f"{context} ({kind_l})"
if self._compact_layout:
global_row = "S Settings A Add C Create Seed R Remove Seed H Hide/Reveal E Export I Import B Backup Ctrl+P Cmd Compact"
global_row = "Settings (S) Add (A) Seed+ (C) Seed- (R) Reveal (H) Export (E) Import (I) Backup (B) Cmd (Ctrl+P)"
if self._viewport_width and self._viewport_width < 130:
context = context.replace("Entry ▣ ", "")
context = context.replace("Reveal", "Rev")
@@ -1901,10 +1901,16 @@ def launch_tui2(
]
@staticmethod
def _board_card(title: str, rows: list[str]) -> list[str]:
width = max([len(title), *[len(row) for row in rows], 12])
def _board_card(
title: str, rows: list[str], *, max_width: int = 72
) -> list[str]:
natural = max([len(title), *[len(row) for row in rows], 12])
width = min(natural, max_width)
capped_rows = [
r if len(r) <= width else f"{r[: width - 1]}\u2026" for r in rows
]
top = f"+- {title} " + "-" * max(1, width - len(title) - 2) + "+"
body = [f"| {row.ljust(width)} |" for row in rows]
body = [f"| {row.ljust(width)} |" for row in capped_rows]
bottom = "+" + "-" * (width + 2) + "+"
return [top, *body, bottom]
@@ -2240,9 +2246,9 @@ def launch_tui2(
tags_text=tags_text, notes_text=notes_text
),
(
"Actions: v reveal | g qr | qr private cfm | a archive"
"Actions: v reveal | g qr | QR Private (cfm) | a archive"
if self._dense_hires_layout
else "Actions: Reveal (v) | QR (g) | qr private confirm | Archive (a)"
else "Actions: Reveal (v) | QR (g) | QR Private (confirm) | Archive (a)"
),
]
return "\n".join(lines)
@@ -1263,7 +1263,7 @@ async def test_tui2_textual_compact_layout_hides_link_panel_and_can_restore() ->
await pilot.pause()
link_detail = app.query_one("#link-detail", Static)
assert link_detail.has_class("hidden")
assert "Compact" in _widget_text(app, "#action-strip")
assert "Settings (S)" in _widget_text(app, "#action-strip")
detail = _widget_text(app, "#entry-detail")
assert "Tags: alpha, beta" in detail
assert "Notes: compact note" in detail
@@ -1275,7 +1275,7 @@ async def test_tui2_textual_compact_layout_hides_link_panel_and_can_restore() ->
app._update_responsive_layout(width=120)
await pilot.pause()
assert link_detail.has_class("hidden")
assert "Compact" in _widget_text(app, "#action-strip")
assert "Settings (S)" in _widget_text(app, "#action-strip")
@pytest.mark.anyio