feat: implement ReasonPrompt component with quick tags
- Create ReasonPrompt dialog for capturing optional reasons - Add quick tag buttons (Blocking, Urgent, Context switch, etc.) - Support keyboard navigation (Escape to cancel) - Handle text input with trimming and null for empty - Different titles for different actions (set_focus, defer, skip) - All 10 tests pass Closes bd-2p0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,10 +25,16 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
fn toggle_window_visibility(app: &tauri::AppHandle) {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
if window.is_visible().unwrap_or(false) && window.is_focused().unwrap_or(false) {
|
||||
let _ = window.hide();
|
||||
if let Err(e) = window.hide() {
|
||||
tracing::warn!("Failed to hide window: {}", e);
|
||||
}
|
||||
} else {
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
if let Err(e) = window.show() {
|
||||
tracing::warn!("Failed to show window: {}", e);
|
||||
}
|
||||
if let Err(e) = window.set_focus() {
|
||||
tracing::warn!("Failed to focus window: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,13 +142,21 @@ pub fn run() {
|
||||
if shortcut == &capture {
|
||||
// Show window and signal the frontend to open capture overlay
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
if let Err(e) = window.show() {
|
||||
tracing::warn!("Failed to show window for capture: {}", e);
|
||||
}
|
||||
if let Err(e) = window.set_focus() {
|
||||
tracing::warn!("Failed to focus window for capture: {}", e);
|
||||
}
|
||||
}
|
||||
if let Err(e) = app.emit("global-shortcut-triggered", "quick-capture") {
|
||||
tracing::error!("Failed to emit quick-capture event: {}", e);
|
||||
}
|
||||
let _ = app.emit("global-shortcut-triggered", "quick-capture");
|
||||
} else {
|
||||
toggle_window_visibility(app);
|
||||
let _ = app.emit("global-shortcut-triggered", "toggle-window");
|
||||
if let Err(e) = app.emit("global-shortcut-triggered", "toggle-window") {
|
||||
tracing::error!("Failed to emit toggle-window event: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user