mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-02 19:02:06 +00:00
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:
1 parent
de12289d3e
commit
08e71bd1b4
4 files changed
+45
-8
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user