ui: add tui-skeleton for a fun loading animation
This commit is contained in:
+20
-9
@@ -13,6 +13,7 @@ use tui_input::{Input, backend::crossterm::EventHandler};
|
||||
use futures::{StreamExt, future::FutureExt};
|
||||
|
||||
use ratatui::prelude::*;
|
||||
use tui_skeleton::{AnimationMode, SkeletonList, SkeletonText};
|
||||
|
||||
use crate::{events::AudioRecordRequest, prediction::{BandcampResult, PossibleResponse}, scene::{ConversationEntry, PlaylistEntry, Scene, StageActions, StageDirection}, tts::start_tts};
|
||||
|
||||
@@ -138,15 +139,25 @@ impl App {
|
||||
}
|
||||
|
||||
fn draw_options(&mut self, frame: &mut Frame, area: Rect) {
|
||||
frame.render_stateful_widget(
|
||||
List::new(self.scene.reply_options().clone())
|
||||
.block(Block::bordered().border_style(style::Color::LightGreen).title("Reply Options (Press 'Ctrl+R' to regenerate, Ctrl+Enter to use)"))
|
||||
.style(ratatui::style::Color::White)
|
||||
.highlight_symbol("> ")
|
||||
.highlight_style(style::Style::new().bold().fg(style::Color::Cyan)),
|
||||
area,
|
||||
&mut self.reply_state
|
||||
);
|
||||
let borders = Block::bordered().border_style(style::Color::LightGreen).title("Reply Options (Press 'Ctrl+R' to regenerate, Ctrl+Enter to use)");
|
||||
if self.scene.reply_options().len() == 0 && self.is_requesting {
|
||||
let list = SkeletonText::new(std::time::SystemTime::now().duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap().as_millis() as u64)
|
||||
.braille(true)
|
||||
.line_widths(&[0.25, 0.5, 0.4, 0.6])
|
||||
.mode(AnimationMode::Noise)
|
||||
.block(borders);
|
||||
frame.render_widget(list, area);
|
||||
} else {
|
||||
frame.render_stateful_widget(
|
||||
List::new(self.scene.reply_options().clone())
|
||||
.block(borders)
|
||||
.style(ratatui::style::Color::White)
|
||||
.highlight_symbol("> ")
|
||||
.highlight_style(style::Style::new().bold().fg(style::Color::Cyan)),
|
||||
area,
|
||||
&mut self.reply_state
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_user_input(&mut self, frame: &mut Frame, area: Rect) {
|
||||
|
||||
Reference in New Issue
Block a user