From 61de2091b7394cd47d002024c03cdc7ca649cbf5 Mon Sep 17 00:00:00 2001 From: Lucas Pickering Date: Tue, 27 Feb 2024 19:49:18 -0500 Subject: [PATCH] Move checkbox to left side of toggle tables --- CHANGELOG.md | 6 ++++++ src/tui/view/common/table.rs | 5 +++-- src/tui/view/component/recipe.rs | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0c0167c..ee54db09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased] - ReleaseDate + +### Changed + +- Move checkbox to left side of toggle tables + ## [0.13.0] - 2024-02-21 ### Added diff --git a/src/tui/view/common/table.rs b/src/tui/view/common/table.rs index a7d31e2f..fa0c73b1 100644 --- a/src/tui/view/common/table.rs +++ b/src/tui/view/common/table.rs @@ -142,13 +142,14 @@ where let theme = &TuiContext::get().theme; // Include the given cells, then tack on the checkbox for enabled state Row::new( - self.cells.into_iter().map(Cell::from).chain(iter::once( + iter::once( Checkbox { checked: self.enabled, } .generate() .into(), - )), + ) + .chain(self.cells.into_iter().map(Cell::from)), ) .style(if self.enabled { theme.table.text diff --git a/src/tui/view/component/recipe.rs b/src/tui/view/component/recipe.rs index 47402a39..dde13a6c 100644 --- a/src/tui/view/component/recipe.rs +++ b/src/tui/view/component/recipe.rs @@ -294,13 +294,13 @@ impl<'a> Draw> for RecipePane { } } Tab::Query => frame.render_stateful_widget( - to_table(&recipe_state.query, ["Parameter", "Value", ""]) + to_table(&recipe_state.query, ["", "Parameter", "Value"]) .generate(), content_area, &mut recipe_state.query.state_mut(), ), Tab::Headers => frame.render_stateful_widget( - to_table(&recipe_state.headers, ["Header", "Value", ""]) + to_table(&recipe_state.headers, ["", "Header", "Value"]) .generate(), content_area, &mut recipe_state.headers.state_mut(), @@ -414,9 +414,9 @@ fn to_table<'a>( .collect_vec(), header: Some(header), column_widths: &[ + Constraint::Min(3), Constraint::Percentage(50), Constraint::Percentage(50), - Constraint::Min(3), ], ..Default::default() }