diff --git a/bin/commands/issue/select/ui.rs b/bin/commands/issue/select/ui.rs index a4834c8b..c4053ee1 100644 --- a/bin/commands/issue/select/ui.rs +++ b/bin/commands/issue/select/ui.rs @@ -263,10 +263,10 @@ impl<'a: 'static> Widget for BrowsePage<'a> { self.shortcuts.update(state); } - fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option>) { + fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option<&dyn Any>) { let props = props - .and_then(BrowsePageProps::from_boxed_any) - .unwrap_or(self.props.clone()); + .and_then(|props| props.downcast_ref::()) + .unwrap_or(&self.props); let page_size = area.height.saturating_sub(6) as usize; @@ -280,33 +280,21 @@ impl<'a: 'static> Widget for BrowsePage<'a> { self.issues.render( frame, table_area, - Some( - ContainerProps::default() - .hide_footer(props.show_search) - .to_boxed(), - ), + Some(&ContainerProps::default().hide_footer(props.show_search)), ); self.search.render(frame, search_area, None); } else { self.issues.render( frame, content_area, - Some( - ContainerProps::default() - .hide_footer(props.show_search) - .to_boxed(), - ), + Some(&ContainerProps::default().hide_footer(props.show_search)), ); } self.shortcuts.render( frame, shortcuts_area, - Some( - ShortcutsProps::default() - .shortcuts(&props.shortcuts) - .to_boxed(), - ), + Some(&ShortcutsProps::default().shortcuts(&props.shortcuts)), ); if page_size != props.page_size { @@ -387,7 +375,7 @@ impl Widget for Search { self.input.update(state); } - fn render(&self, frame: &mut ratatui::Frame, area: Rect, _props: Option>) { + fn render(&self, frame: &mut ratatui::Frame, area: Rect, _props: Option<&dyn Any>) { let layout = Layout::horizontal(Constraint::from_mins([0])) .horizontal_margin(1) .split(area); @@ -530,10 +518,10 @@ impl<'a: 'static> Widget for HelpPage<'a> { self.content.update(state); } - fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option>) { + fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option<&dyn Any>) { let props = props - .and_then(HelpPageProps::from_boxed_any) - .unwrap_or(self.props.clone()); + .and_then(|props| props.downcast_ref::()) + .unwrap_or(&self.props); let page_size = area.height.saturating_sub(6) as usize; @@ -544,11 +532,7 @@ impl<'a: 'static> Widget for HelpPage<'a> { self.shortcuts.render( frame, shortcuts_area, - Some( - ShortcutsProps::default() - .shortcuts(&props.shortcuts) - .to_boxed(), - ), + Some(&ShortcutsProps::default().shortcuts(&props.shortcuts)), ); if page_size != props.page_size {