mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-11 14:10:42 +08:00
issue: Adjust to updated render props
This commit is contained in:
@@ -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<Box<dyn Any>>) {
|
||||
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::<BrowsePageProps>())
|
||||
.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<Box<dyn Any>>) {
|
||||
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<Box<dyn Any>>) {
|
||||
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::<HelpPageProps>())
|
||||
.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 {
|
||||
|
||||
Reference in New Issue
Block a user