Skip to content

Commit 4e9fcda

Browse files
authored
feat(ui): Add option to hide icon in panel widgets (#134)
1 parent f610a2f commit 4e9fcda

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

titan_cli/ui/tui/textual_components.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,21 @@ def _mount():
201201
# App is closing or worker was cancelled
202202
pass
203203

204-
def panel(self, text: str, panel_type: str = "info") -> None:
204+
def panel(self, text: str, panel_type: str = "info", show_icon: bool = True) -> None:
205205
"""
206206
Show a panel with consistent styling.
207207
208208
Args:
209209
text: Text to display in the panel
210210
panel_type: Type of panel - "info", "success", "warning", or "error"
211+
show_icon: Whether to show the type icon (default: True)
211212
212213
Example:
213214
ctx.textual.panel("Operation completed successfully!", panel_type="success")
214215
ctx.textual.panel("Warning: This action cannot be undone", panel_type="warning")
216+
ctx.textual.panel("Info without icon", panel_type="info", show_icon=False)
215217
"""
216-
panel_widget = Panel(text=text, panel_type=panel_type)
218+
panel_widget = Panel(text=text, panel_type=panel_type, show_icon=show_icon)
217219
self.mount(panel_widget)
218220

219221
def dim_text(self, text: str) -> None:

titan_cli/ui/tui/widgets/panel.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,19 @@ class Panel(Widget):
5151
}
5252
"""
5353

54-
def __init__(self, text: str, panel_type: str = "info", **kwargs):
54+
def __init__(self, text: str, panel_type: str = "info", show_icon: bool = True, **kwargs):
5555
"""
5656
Initialize panel.
5757
5858
Args:
5959
text: Text to display
6060
panel_type: Type of panel (info, success, warning, error)
61+
show_icon: Whether to show the icon (default: True)
6162
"""
6263
super().__init__(**kwargs)
6364
self.text = text
6465
self.panel_type = panel_type
66+
self.show_icon = show_icon
6567

6668
# Add CSS class based on type
6769
self.add_class(panel_type)
@@ -77,5 +79,12 @@ def compose(self) -> ComposeResult:
7779
}
7880

7981
icon = icons.get(self.panel_type, Icons.INFO)
82+
83+
# Format text with or without icon
84+
if self.show_icon and icon:
85+
text = f"{icon} {self.text}"
86+
else:
87+
text = self.text
88+
8089
with Container():
81-
yield Label(f"{icon} {self.text}")
90+
yield Label(text)

titan_cli/ui/tui/widgets/prompt_selection_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def compose(self):
9696
yield BoldText(self.question)
9797

9898
# Instructions
99-
yield DimText("↑/↓: Navegar │ Space: Seleccionar/Deseleccionar │ Enter: Continuar")
99+
yield DimText("↑/↓: Navigate │ Space: Select/Deselect │ Enter: Continue")
100100

101101
# Create Selection objects for SelectionList
102102
selections = [

0 commit comments

Comments
 (0)