diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-19 21:32:40 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-19 23:06:48 +0300 |
| commit | d2074b12f1b2a2a97e188f0241863d6cb858efaf (patch) | |
| tree | 99de2372409ac78a2ccf5cd16fc10ddfbf55174b /src/app/input/mod.rs | |
| parent | aa89f536a28ad11d5931649e7a178863346b6d69 (diff) | |
feat: add hosted product announcements
Diffstat (limited to 'src/app/input/mod.rs')
| -rw-r--r-- | src/app/input/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/app/input/mod.rs b/src/app/input/mod.rs index 93152e55..18dd8856 100644 --- a/src/app/input/mod.rs +++ b/src/app/input/mod.rs @@ -62,6 +62,7 @@ impl App { match self.state.mode { Mode::Onboarding => self.handle_onboarding_key(key), Mode::ReleaseNotes => self.handle_release_notes_key(key), + Mode::ProductAnnouncement => self.handle_product_announcement_key(key), Mode::Navigate => unreachable!(), Mode::RenameWorkspace | Mode::RenameTab | Mode::RenamePane => { handle_rename_key(&mut self.state, key) @@ -128,6 +129,32 @@ impl App { } } + pub(crate) fn handle_product_announcement_key(&mut self, key: KeyEvent) { + match key.code { + KeyCode::Up | KeyCode::Char('k') => self.scroll_product_announcement(-1), + KeyCode::Down | KeyCode::Char('j') => self.scroll_product_announcement(1), + KeyCode::PageUp => self.scroll_product_announcement(-8), + KeyCode::PageDown => self.scroll_product_announcement(8), + KeyCode::Home => { + if let Some(announcement) = &mut self.state.product_announcement { + announcement.scroll = 0; + } + } + KeyCode::End => { + let max_scroll = self.state.product_announcement_max_scroll(); + if let Some(announcement) = &mut self.state.product_announcement { + announcement.scroll = max_scroll; + } + } + _ => { + if let Some(ModalAction::Close) = modal_action_from_key(&key, RELEASE_NOTES_ACTIONS) + { + self.dismiss_product_announcement(); + } + } + } + } + pub(super) fn handle_mouse(&mut self, mouse: MouseEvent) { if self.handle_overlay_mouse(mouse) { return; |
