mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-03 02:10:39 +08:00
lib: Remove compile-time width from footer
This commit is contained in:
@@ -412,12 +412,14 @@ impl Notifications {
|
||||
frame,
|
||||
area,
|
||||
FooterProps {
|
||||
cells: [search.into(), block.clone().into(), progress.clone().into()],
|
||||
cells: [search.into(), block.clone().into(), progress.clone().into()]
|
||||
.to_vec(),
|
||||
widths: [
|
||||
Constraint::Fill(1),
|
||||
Constraint::Min(block.width() as u16),
|
||||
Constraint::Min(4),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: self.props.cutoff,
|
||||
cutoff_after: self.props.cutoff_after,
|
||||
@@ -434,13 +436,15 @@ impl Notifications {
|
||||
seen.clone().into(),
|
||||
unseen.clone().into(),
|
||||
progress.clone().into(),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
widths: [
|
||||
Constraint::Fill(1),
|
||||
Constraint::Min(seen.width() as u16),
|
||||
Constraint::Min(unseen.width() as u16),
|
||||
Constraint::Min(4),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: self.props.cutoff,
|
||||
cutoff_after: self.props.cutoff_after,
|
||||
@@ -800,8 +804,8 @@ impl<'a> Render<()> for Help<'a> {
|
||||
frame,
|
||||
footer_area,
|
||||
FooterProps {
|
||||
cells: [String::new().into(), progress.clone().into()],
|
||||
widths: [Constraint::Fill(1), Constraint::Min(4)],
|
||||
cells: [String::new().into(), progress.clone().into()].to_vec(),
|
||||
widths: [Constraint::Fill(1), Constraint::Min(4)].to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: usize::MAX,
|
||||
cutoff_after: usize::MAX,
|
||||
|
||||
@@ -432,12 +432,14 @@ impl Issues {
|
||||
frame,
|
||||
area,
|
||||
FooterProps {
|
||||
cells: [search.into(), block.clone().into(), progress.clone().into()],
|
||||
cells: [search.into(), block.clone().into(), progress.clone().into()]
|
||||
.to_vec(),
|
||||
widths: [
|
||||
Constraint::Fill(1),
|
||||
Constraint::Min(block.width() as u16),
|
||||
Constraint::Min(4),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: self.props.cutoff,
|
||||
cutoff_after: self.props.cutoff_after,
|
||||
@@ -455,14 +457,16 @@ impl Issues {
|
||||
closed.clone().into(),
|
||||
sum.clone().into(),
|
||||
progress.clone().into(),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
widths: [
|
||||
Constraint::Fill(1),
|
||||
Constraint::Min(open.width() as u16),
|
||||
Constraint::Min(closed.width() as u16),
|
||||
Constraint::Min(sum.width() as u16),
|
||||
Constraint::Min(4),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: self.props.cutoff,
|
||||
cutoff_after: self.props.cutoff_after,
|
||||
@@ -822,8 +826,8 @@ impl<'a> Render<()> for Help<'a> {
|
||||
frame,
|
||||
footer_area,
|
||||
FooterProps {
|
||||
cells: [String::new().into(), progress.clone().into()],
|
||||
widths: [Constraint::Fill(1), Constraint::Min(4)],
|
||||
cells: [String::new().into(), progress.clone().into()].to_vec(),
|
||||
widths: [Constraint::Fill(1), Constraint::Min(4)].to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: usize::MAX,
|
||||
cutoff_after: usize::MAX,
|
||||
|
||||
@@ -457,12 +457,14 @@ impl Patches {
|
||||
frame,
|
||||
area,
|
||||
FooterProps {
|
||||
cells: [search.into(), block.clone().into(), progress.clone().into()],
|
||||
cells: [search.into(), block.clone().into(), progress.clone().into()]
|
||||
.to_vec(),
|
||||
widths: [
|
||||
Constraint::Fill(1),
|
||||
Constraint::Min(block.width() as u16),
|
||||
Constraint::Min(4),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: self.props.cutoff,
|
||||
cutoff_after: self.props.cutoff_after,
|
||||
@@ -482,7 +484,8 @@ impl Patches {
|
||||
archived.clone().into(),
|
||||
sum.clone().into(),
|
||||
progress.clone().into(),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
widths: [
|
||||
Constraint::Fill(1),
|
||||
Constraint::Min(draft.width() as u16),
|
||||
@@ -491,7 +494,8 @@ impl Patches {
|
||||
Constraint::Min(archived.width() as u16),
|
||||
Constraint::Min(sum.width() as u16),
|
||||
Constraint::Min(4),
|
||||
],
|
||||
]
|
||||
.to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: self.props.cutoff,
|
||||
cutoff_after: self.props.cutoff_after,
|
||||
@@ -859,8 +863,8 @@ impl<'a> Render<()> for Help<'a> {
|
||||
frame,
|
||||
footer_area,
|
||||
FooterProps {
|
||||
cells: [String::new().into(), progress.clone().into()],
|
||||
widths: [Constraint::Fill(1), Constraint::Min(4)],
|
||||
cells: [String::new().into(), progress.clone().into()].to_vec(),
|
||||
widths: [Constraint::Fill(1), Constraint::Min(4)].to_vec(),
|
||||
focus: self.props.focus,
|
||||
cutoff: usize::MAX,
|
||||
cutoff_after: usize::MAX,
|
||||
|
||||
@@ -13,9 +13,9 @@ use crate::ui::theme::style;
|
||||
use super::{Column, Render, Widget};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FooterProps<'a, const W: usize> {
|
||||
pub cells: [Text<'a>; W],
|
||||
pub widths: [Constraint; W],
|
||||
pub struct FooterProps<'a> {
|
||||
pub cells: Vec<Text<'a>>,
|
||||
pub widths: Vec<Constraint>,
|
||||
pub cutoff: usize,
|
||||
pub cutoff_after: usize,
|
||||
pub focus: bool,
|
||||
@@ -71,8 +71,8 @@ impl<A> Footer<A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, A, const W: usize> Render<FooterProps<'a, W>> for Footer<A> {
|
||||
fn render<B: Backend>(&self, frame: &mut ratatui::Frame, area: Rect, props: FooterProps<W>) {
|
||||
impl<'a, A> Render<FooterProps<'a>> for Footer<A> {
|
||||
fn render<B: Backend>(&self, frame: &mut ratatui::Frame, area: Rect, props: FooterProps) {
|
||||
let widths = props
|
||||
.widths
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user