mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
more fancy spinner, cleanup tabs
This commit is contained in:
parent
a34bab22fa
commit
b782472a63
4 changed files with 27 additions and 19 deletions
35
src/app.rs
35
src/app.rs
|
|
@ -21,9 +21,7 @@ use crossterm::event::{Event, KeyEvent};
|
|||
use std::{cell::Cell, cell::RefCell, rc::Rc};
|
||||
use tui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
style::Modifier,
|
||||
style::Style,
|
||||
layout::{Constraint, Direction, Layout, Margin, Rect},
|
||||
widgets::{Block, Borders, Tabs},
|
||||
Frame,
|
||||
};
|
||||
|
|
@ -489,21 +487,28 @@ impl App {
|
|||
|
||||
//TODO: make this dynamic
|
||||
fn draw_tabs<B: Backend>(&self, f: &mut Frame<B>, r: Rect) {
|
||||
let r = r.inner(&Margin {
|
||||
vertical: 0,
|
||||
horizontal: 1,
|
||||
});
|
||||
|
||||
let tabs = &[
|
||||
strings::TAB_STATUS,
|
||||
strings::TAB_LOG,
|
||||
strings::TAB_STASHING,
|
||||
strings::TAB_STASHES,
|
||||
];
|
||||
|
||||
f.render_widget(
|
||||
Tabs::default()
|
||||
.block(Block::default().borders(Borders::BOTTOM))
|
||||
.titles(&[
|
||||
strings::TAB_STATUS,
|
||||
strings::TAB_LOG,
|
||||
strings::TAB_STASHING,
|
||||
strings::TAB_STASHES,
|
||||
])
|
||||
.style(Style::default())
|
||||
.highlight_style(
|
||||
self.theme
|
||||
.tab(true)
|
||||
.modifier(Modifier::UNDERLINED),
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::BOTTOM)
|
||||
.border_style(self.theme.block(false)),
|
||||
)
|
||||
.titles(tabs)
|
||||
.style(self.theme.tab(false))
|
||||
.highlight_style(self.theme.tab(true))
|
||||
.divider(strings::TAB_DIVIDER)
|
||||
.select(self.tab),
|
||||
r,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
use std::io;
|
||||
use tui::{backend::Backend, buffer::Cell, Terminal};
|
||||
|
||||
static SPINNER_CHARS: &[char] = &['|', '/', '-', '\\'];
|
||||
// static SPINNER_CHARS: &[char] = &['◢', '◣', '◤', '◥'];
|
||||
// static SPINNER_CHARS: &[char] = &['⢹', '⢺', '⢼', '⣸', '⣇', '⡧', '⡗', '⡏'];
|
||||
static SPINNER_CHARS: &[char] =
|
||||
&['⣷', '⣯', '⣟', '⡿', '⢿', '⣻', '⣽', '⣾'];
|
||||
|
||||
///
|
||||
#[derive(Default)]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub static TAB_STATUS: &str = "Status [1]";
|
|||
pub static TAB_LOG: &str = "Log [2]";
|
||||
pub static TAB_STASHING: &str = "Stashing [3]";
|
||||
pub static TAB_STASHES: &str = "Stashes [4]";
|
||||
pub static TAB_DIVIDER: &str = " | ";
|
||||
pub static TAB_DIVIDER: &str = " | ";
|
||||
|
||||
pub static CMD_SPLITTER: &str = " ";
|
||||
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ impl Theme {
|
|||
|
||||
pub fn tab(&self, selected: bool) -> Style {
|
||||
if selected {
|
||||
Style::default().fg(self.selected_tab)
|
||||
self.text(true, false).modifier(Modifier::UNDERLINED)
|
||||
} else {
|
||||
Style::default()
|
||||
self.text(false, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue