Skip to content

Commit

Permalink
Merge pull request #111 from matthewmturner/feat/start-ui-cleanup
Browse files Browse the repository at this point in the history
Datafusion theme
  • Loading branch information
matthewmturner authored Aug 29, 2024
2 parents 9b317e0 + efff9b7 commit 846e401
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/app/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ fn context_tab_key_event_handler(app: &mut App, key: KeyEvent) {
KeyCode::Char('q') => app.state.should_quit = true,
tab @ (KeyCode::Char('s')
| KeyCode::Char('l')
| KeyCode::Char('h')
| KeyCode::Char('x')
| KeyCode::Char('f')) => tab_navigation_handler(app, tab),
_ => {}
Expand Down
2 changes: 1 addition & 1 deletion src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl<'app> App<'app> {

fn render_tabs(&self, area: Rect, buf: &mut Buffer) {
let titles = ui::SelectedTab::iter().map(ui::SelectedTab::title);
let highlight_style = (Color::default(), tailwind::GRAY.c700);
let highlight_style = (Color::default(), tailwind::ORANGE.c500);
let selected_tab_index = self.state.tabs.selected as usize;
Tabs::new(titles)
.highlight_style(highlight_style)
Expand Down
10 changes: 5 additions & 5 deletions src/ui/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ macro_rules! convert_array_values_to_cells {
}

pub fn record_batch_to_table_header_cells(record_batch: &RecordBatch) -> Vec<Cell> {
let mut cells = vec![Cell::new("#").bg(tailwind::LIME.c300).fg(tailwind::BLACK)];
let mut cells = vec![Cell::new("#").bg(tailwind::ORANGE.c300).fg(tailwind::BLACK)];
record_batch.schema_ref().fields().iter().for_each(|f| {
let cell = Cell::new(f.name().as_str())
.bg(tailwind::LIME.c300)
.bg(tailwind::ORANGE.c300)
.fg(tailwind::BLACK);
cells.push(cell);
});
Expand Down Expand Up @@ -169,9 +169,9 @@ mod tests {
assert_eq!(
header_cells,
vec![
Cell::new("#").bg(tailwind::LIME.c300).fg(tailwind::BLACK),
Cell::new("a").bg(tailwind::LIME.c300).fg(tailwind::BLACK),
Cell::new("b").bg(tailwind::LIME.c300).fg(tailwind::BLACK)
Cell::new("#").bg(tailwind::ORANGE.c300).fg(tailwind::BLACK),
Cell::new("a").bg(tailwind::ORANGE.c300).fg(tailwind::BLACK),
Cell::new("b").bg(tailwind::ORANGE.c300).fg(tailwind::BLACK)
]
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ impl SelectedTab {

const fn bg(self) -> Color {
match self {
Self::SQL => tailwind::EMERALD.c700,
Self::Logs => tailwind::EMERALD.c700,
Self::Context => tailwind::EMERALD.c700,
Self::History => tailwind::EMERALD.c700,
Self::SQL => tailwind::ORANGE.c700,
Self::Logs => tailwind::ORANGE.c700,
Self::Context => tailwind::ORANGE.c700,
Self::History => tailwind::ORANGE.c700,
#[cfg(feature = "flightsql")]
Self::FlightSQL => tailwind::EMERALD.c700,
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/tabs/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::app::App;
fn render_smart_widget(area: Rect, buf: &mut Buffer, app: &App) {
let logs = TuiLoggerSmartWidget::default()
.style_error(Style::default().fg(tailwind::RED.c700))
.style_debug(Style::default().fg(tailwind::ORANGE.c700))
.style_debug(Style::default().fg(tailwind::ORANGE.c500))
.style_warn(Style::default().fg(tailwind::YELLOW.c700))
.style_trace(Style::default().fg(tailwind::GRAY.c700))
.style_info(Style::default().fg(tailwind::WHITE))
Expand Down
4 changes: 2 additions & 2 deletions src/ui/tabs/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{app::App, ui::convert::record_batches_to_table};

pub fn render_sql_editor(area: Rect, buf: &mut Buffer, app: &App) {
let border_color = if app.state.sql_tab.editor_editable() {
tailwind::GREEN.c300
tailwind::ORANGE.c300
} else {
tailwind::WHITE
};
Expand All @@ -51,7 +51,7 @@ pub fn render_sql_results(area: Rect, buf: &mut Buffer, app: &App) {
q.num_rows().unwrap_or(0),
q.execution_time().as_millis()
))
.fg(tailwind::GREEN.c300);
.fg(tailwind::ORANGE.c500);
let maybe_table = record_batches_to_table(r);
match maybe_table {
Ok(table) => {
Expand Down

0 comments on commit 846e401

Please sign in to comment.