Skip to content

Commit 276c8ce

Browse files
committed
feat(tui): disable toast notifications
- Modified ToastManager.push/success/info/warning/error methods to return 0 immediately (no-op) - Commented out toast rendering block in rendering.rs - Applied same changes to both cortex-tui and cortex-tui-components toast modules
1 parent d201070 commit 276c8ce

3 files changed

Lines changed: 36 additions & 25 deletions

File tree

src/cortex-tui-components/src/toast.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,31 +276,37 @@ impl ToastManager {
276276

277277
/// Adds a toast to the manager and returns its ID.
278278
pub fn push(&mut self, mut toast: Toast) -> u64 {
279-
let id = self.next_id;
280-
self.next_id += 1;
281-
toast.id = id;
282-
self.toasts.insert(0, toast);
283-
id
279+
// Toast notifications disabled
280+
let _ = toast;
281+
0
284282
}
285283

286284
/// Adds a success toast and returns its ID.
287285
pub fn success(&mut self, message: impl Into<String>) -> u64 {
288-
self.push(Toast::success(message))
286+
// Toast notifications disabled
287+
let _ = message;
288+
0
289289
}
290290

291291
/// Adds an info toast and returns its ID.
292292
pub fn info(&mut self, message: impl Into<String>) -> u64 {
293-
self.push(Toast::info(message))
293+
// Toast notifications disabled
294+
let _ = message;
295+
0
294296
}
295297

296298
/// Adds a warning toast and returns its ID.
297299
pub fn warning(&mut self, message: impl Into<String>) -> u64 {
298-
self.push(Toast::warning(message))
300+
// Toast notifications disabled
301+
let _ = message;
302+
0
299303
}
300304

301305
/// Adds an error toast and returns its ID.
302306
pub fn error(&mut self, message: impl Into<String>) -> u64 {
303-
self.push(Toast::error(message))
307+
// Toast notifications disabled
308+
let _ = message;
309+
0
304310
}
305311

306312
/// Removes a specific toast by ID.

src/cortex-tui/src/runner/event_loop/rendering.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ impl EventLoop {
119119
// Apply selection highlight
120120
self.apply_selection_highlight(frame.buffer_mut());
121121

122-
// Render toast notifications
123-
if !self.app_state.toasts.is_empty() {
124-
let toast_widget = crate::widgets::ToastWidget::new(&self.app_state.toasts)
125-
.terminal_size(area.width, area.height);
126-
toast_widget.render(area, frame.buffer_mut());
127-
}
122+
// Toast notifications disabled
123+
// if !self.app_state.toasts.is_empty() {
124+
// let toast_widget = crate::widgets::ToastWidget::new(&self.app_state.toasts)
125+
// .terminal_size(area.width, area.height);
126+
// toast_widget.render(area, frame.buffer_mut());
127+
// }
128128
})?;
129129

130130
// Capture frame for TUI debugging

src/cortex-tui/src/widgets/toast.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,32 +275,37 @@ impl ToastManager {
275275

276276
/// Adds a toast to the manager and returns its ID.
277277
pub fn push(&mut self, mut toast: Toast) -> u64 {
278-
let id = self.next_id;
279-
self.next_id += 1;
280-
toast.id = id;
281-
// Insert at the beginning (newest first)
282-
self.toasts.insert(0, toast);
283-
id
278+
// Toast notifications disabled
279+
let _ = toast;
280+
0
284281
}
285282

286283
/// Adds a success toast and returns its ID.
287284
pub fn success(&mut self, message: impl Into<String>) -> u64 {
288-
self.push(Toast::success(message))
285+
// Toast notifications disabled
286+
let _ = message;
287+
0
289288
}
290289

291290
/// Adds an info toast and returns its ID.
292291
pub fn info(&mut self, message: impl Into<String>) -> u64 {
293-
self.push(Toast::info(message))
292+
// Toast notifications disabled
293+
let _ = message;
294+
0
294295
}
295296

296297
/// Adds a warning toast and returns its ID.
297298
pub fn warning(&mut self, message: impl Into<String>) -> u64 {
298-
self.push(Toast::warning(message))
299+
// Toast notifications disabled
300+
let _ = message;
301+
0
299302
}
300303

301304
/// Adds an error toast and returns its ID.
302305
pub fn error(&mut self, message: impl Into<String>) -> u64 {
303-
self.push(Toast::error(message))
306+
// Toast notifications disabled
307+
let _ = message;
308+
0
304309
}
305310

306311
/// Removes a specific toast by ID.

0 commit comments

Comments
 (0)