tenseleyflow/loader / 29164ee

Browse files

Simplify approval bar to single Static with inline Rich markup

Authored by espadonne
SHA
29164ee4919966cbebbaa2fa4ac520ba562dd54c
Parents
e3cb8ed
Tree
1fbcc58

1 changed file

StatusFile+-
M src/loader/ui/widgets/approval_bar.py 11 43
src/loader/ui/widgets/approval_bar.pymodified
@@ -1,7 +1,6 @@
11
 """Approval bar widget for command confirmation (Claude Code style)."""
22
 
33
 from textual.app import ComposeResult
4
-from textual.containers import Horizontal
54
 from textual.message import Message
65
 from textual.widgets import Static
76
 from textual.binding import Binding
@@ -25,7 +24,8 @@ class ApprovalBar(Widget, can_focus=True):
2524
 
2625
     DEFAULT_CSS = """
2726
     ApprovalBar {
28
-        height: 3;
27
+        height: auto;
28
+        max-height: 4;
2929
         display: none;
3030
         padding: 0 1;
3131
         background: $warning 15%;
@@ -37,31 +37,8 @@ class ApprovalBar(Widget, can_focus=True):
3737
         display: block;
3838
     }
3939
 
40
-    ApprovalBar #approval-container {
40
+    ApprovalBar #approval-content {
4141
         width: 100%;
42
-        height: 3;
43
-    }
44
-
45
-    ApprovalBar #approval-tool {
46
-        color: $warning;
47
-        text-style: bold;
48
-        padding-right: 1;
49
-    }
50
-
51
-    ApprovalBar #approval-preview {
52
-        color: $text;
53
-    }
54
-
55
-    ApprovalBar #approval-keys {
56
-        color: $text-muted;
57
-        text-align: right;
58
-        width: auto;
59
-        dock: right;
60
-    }
61
-
62
-    ApprovalBar #approval-keys .key {
63
-        color: $success;
64
-        text-style: bold;
6542
     }
6643
     """
6744
 
@@ -88,13 +65,7 @@ class ApprovalBar(Widget, can_focus=True):
8865
         self.can_focus = True
8966
 
9067
     def compose(self) -> ComposeResult:
91
-        with Horizontal(id="approval-container"):
92
-            yield Static("", id="approval-tool")
93
-            yield Static("", id="approval-preview")
94
-            yield Static(
95
-                "[Y]es  [n]o  [e]dit",
96
-                id="approval-keys",
97
-            )
68
+        yield Static("", id="approval-content")
9869
 
9970
     def show_approval(self, tool_name: str, message: str, details: str = "") -> None:
10071
         """Show the approval bar with a pending action.
@@ -107,17 +78,14 @@ class ApprovalBar(Widget, can_focus=True):
10778
         self._tool_name = tool_name
10879
         self._full_command = details
10980
 
110
-        # Update the display
111
-        tool_label = self.query_one("#approval-tool", Static)
112
-        preview_label = self.query_one("#approval-preview", Static)
113
-
114
-        tool_label.update(f"[{tool_name}]")
115
-
116
-        # Truncate preview if too long
11781
         preview = details if details else message
118
-        if len(preview) > 60:
119
-            preview = preview[:57] + "..."
120
-        preview_label.update(preview)
82
+        if len(preview) > 70:
83
+            preview = preview[:67] + "..."
84
+        content = self.query_one("#approval-content", Static)
85
+        content.update(
86
+            f"[bold $warning]\\[{tool_name}][/] {preview}  "
87
+            f"[bold green]\\[Y][/]es  [bold red]\\[n][/]o  [bold]\\[e][/]dit"
88
+        )
12189
 
12290
         # Show the bar
12391
         self.add_class("visible")