Skip to content

Commit

Permalink
Merge PR #20 from josueBarretogit/bump-rataui-version
Browse files Browse the repository at this point in the history
bump ratatui to 0.28.0
  • Loading branch information
josueBarretogit authored Aug 22, 2024
2 parents e7a9f82 + f3bea80 commit 7c910a5
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 82 deletions.
74 changes: 44 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ include = [

[dependencies]
anyhow = "1.0.86"
crossterm = { version = "0.27.0", features = ["event-stream"] }
ratatui = { version = "0.28.0", features = ["all-widgets", "palette", "unstable-widget-ref"] }
ratatui-image = { version = "1.0.5", features = ["rustix"]}
throbber-widgets-tui = "0.7.0"
tui-input = "0.10.0"
tui-widget-list = "0.12.0"
crossterm = { version = "0.28.1", features = ["event-stream"] }
directories = "5.0.1"
image = "0.25.1"
ratatui = { version = "0.27.0", features = ["all-widgets", "palette", "unstable-widget-ref"] }
ratatui-image = { git = "https://github.com/josueBarretogit/ratatui-image", version = "1.0.2", features = ["rustix"]}
reqwest = { version = "0.12.4", features = ["json"] }
serde = { version = "1.0.203", features = ["derive"] }
tokio = { version = "1.38.0", features = ["full"] }
throbber-widgets-tui = "0.6.0"
strum = "0.26.2"
strum_macros = "0.26"
color-eyre = "0.6.2"
tui-input = "0.8.0"
futures = "0.3.28"
bytes = { version = "1", features = ["serde"] }
serde_json = "1.0.117"
tui-widget-list = "0.10.0"
once_cell = "1.19.0"
chrono = "0.4.38"
open = "5"
Expand Down
2 changes: 1 addition & 1 deletion src/backend/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crossterm::execute;
use crossterm::terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen};
use futures::{FutureExt, StreamExt};
use ratatui::backend::Backend;
use ratatui::prelude::*;
use ratatui::Terminal;
use tokio::sync::mpsc::UnboundedSender;
use tokio::task::JoinHandle;

Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![forbid(unsafe_code)]
#![allow(dead_code)]
#![allow(deprecated)]
use std::time::Duration;

use clap::Parser;
Expand Down
7 changes: 5 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use std::io::Cursor;

use image::io::Reader;
use ratatui::prelude::*;
use ratatui::widgets::*;
use ratatui::layout::{Constraint, Direction, Layout, Rect};
use ratatui::style::{Color, Style, Stylize};
use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, Paragraph, Widget};
use ratatui::Frame;
use tokio::sync::mpsc::UnboundedSender;
use tokio::task::JoinSet;
use tui_input::Input;
Expand Down
11 changes: 7 additions & 4 deletions src/view/pages/feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ use std::io::Cursor;

use crossterm::event::{KeyCode, KeyEvent, MouseEvent, MouseEventKind};
use image::io::Reader;
use ratatui::prelude::*;
use ratatui::widgets::*;
use ratatui::buffer::Buffer;
use ratatui::layout::{Constraint, Layout, Margin, Rect};
use ratatui::style::{Color, Style};
use ratatui::text::{Line, Span, ToSpan};
use ratatui::widgets::{Block, Paragraph, StatefulWidget, Tabs, Widget};
use ratatui::Frame;
use throbber_widgets_tui::{Throbber, ThrobberState};
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
use tokio::task::JoinSet;
use tui_input::backend::crossterm::EventHandler;
use tui_input::Input;

use self::text::ToSpan;
use crate::backend::database::{get_history, MangaHistoryResponse, MangaHistoryType};
use crate::backend::error_log::{write_to_error_log, ErrorType};
use crate::backend::fetch::MangadexClient;
Expand Down Expand Up @@ -435,7 +438,7 @@ impl Feed {
impl Component for Feed {
type Actions = FeedActions;

fn render(&mut self, area: ratatui::prelude::Rect, frame: &mut Frame<'_>) {
fn render(&mut self, area: Rect, frame: &mut Frame<'_>) {
let layout = Layout::vertical([Constraint::Percentage(20), Constraint::Percentage(80)]);

let [tabs_area, history_area] = layout.areas(area);
Expand Down
11 changes: 7 additions & 4 deletions src/view/pages/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ use std::io::Cursor;
use crossterm::event::{KeyCode, KeyEvent};
use image::io::Reader;
use image::DynamicImage;
use ratatui::prelude::*;
use ratatui::widgets::*;
use ratatui::buffer::Buffer;
use ratatui::layout::{Constraint, Layout, Margin, Rect};
use ratatui::style::Stylize;
use ratatui::text::{Line, Span, ToSpan};
use ratatui::widgets::{Block, List, StatefulWidget, Widget};
use ratatui::Frame;
use ratatui_image::protocol::StatefulProtocol;
use ratatui_image::{Resize, StatefulImage};
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
use tokio::task::JoinSet;

use self::text::ToSpan;
use crate::backend::error_log::{write_to_error_log, ErrorType};
use crate::backend::fetch::MangadexClient;
use crate::backend::tui::Events;
Expand Down Expand Up @@ -78,7 +81,7 @@ pub struct Home {
impl Component for Home {
type Actions = HomeActions;

fn render(&mut self, area: ratatui::prelude::Rect, frame: &mut Frame<'_>) {
fn render(&mut self, area: Rect, frame: &mut Frame<'_>) {
let layout = Layout::vertical([Constraint::Percentage(50), Constraint::Percentage(50)]).margin(1);
let buf = frame.buffer_mut();

Expand Down
11 changes: 7 additions & 4 deletions src/view/pages/manga.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
use crossterm::event::{KeyCode, KeyEvent, MouseEvent, MouseEventKind};
use ratatui::prelude::*;
use ratatui::widgets::*;
use ratatui::buffer::Buffer;
use ratatui::layout::{Constraint, Direction, Layout, Rect};
use ratatui::style::{Style, Stylize};
use ratatui::text::{Line, Span, ToSpan};
use ratatui::widgets::{Block, Clear, List, ListState, Paragraph, StatefulWidget, Widget, Wrap};
use ratatui::Frame;
use ratatui_image::protocol::StatefulProtocol;
use ratatui_image::{Resize, StatefulImage};
use strum::Display;
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
use tokio::task::JoinSet;

use self::text::ToSpan;
use crate::backend::database::{
get_chapters_history_status, save_history, set_chapter_downloaded, MangaReadingHistorySave, SetChapterDownloaded,
};
Expand Down Expand Up @@ -915,7 +918,7 @@ impl MangaPage {
impl Component for MangaPage {
type Actions = MangaPageActions;

fn render(&mut self, area: ratatui::prelude::Rect, frame: &mut ratatui::Frame<'_>) {
fn render(&mut self, area: Rect, frame: &mut Frame<'_>) {
let layout = Layout::default()
.direction(Direction::Horizontal)
.constraints([Constraint::Percentage(15), Constraint::Percentage(85)]);
Expand Down
9 changes: 6 additions & 3 deletions src/view/pages/reader.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use crossterm::event::KeyCode;
use image::io::Reader;
use image::GenericImageView;
use ratatui::prelude::*;
use ratatui::widgets::*;
use ratatui::buffer::Buffer;
use ratatui::layout::{Constraint, Layout, Margin, Rect};
use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, Paragraph, StatefulWidget, Widget};
use ratatui::Frame;
use ratatui_image::protocol::StatefulProtocol;
use ratatui_image::{Resize, StatefulImage};
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
Expand Down Expand Up @@ -75,7 +78,7 @@ pub struct MangaReader {
impl Component for MangaReader {
type Actions = MangaReaderActions;

fn render(&mut self, area: ratatui::prelude::Rect, frame: &mut Frame<'_>) {
fn render(&mut self, area: Rect, frame: &mut Frame<'_>) {
let buf = frame.buffer_mut();

let layout = Layout::horizontal([Constraint::Fill(1), Constraint::Fill(self.current_page_size), Constraint::Fill(1)]);
Expand Down
10 changes: 7 additions & 3 deletions src/view/pages/search.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crossterm::event::{self, KeyCode, KeyEvent, MouseButton, MouseEvent, MouseEventKind};
use ratatui::prelude::*;
use ratatui::widgets::*;
use ratatui::layout::{Constraint, Direction, Layout, Margin, Rect};
use ratatui::style::{Color, Style, Stylize};
use ratatui::text::{Line, Span, ToSpan};
use ratatui::widgets::{Block, Paragraph, StatefulWidget, StatefulWidgetRef, Widget, Wrap};
use ratatui::Frame;
use ratatui_image::protocol::StatefulProtocol;
use throbber_widgets_tui::{Throbber, ThrobberState};
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
Expand All @@ -9,7 +12,6 @@ use tui_input::backend::crossterm::EventHandler;
use tui_input::Input;
use tui_widget_list::ListState;

use self::text::ToSpan;
use crate::backend::database::{save_plan_to_read, MangaPlanToReadSave};
use crate::backend::error_log::{write_to_error_log, ErrorType};
use crate::backend::fetch::MangadexClient;
Expand Down Expand Up @@ -582,6 +584,8 @@ impl SearchPage {

#[cfg(test)]
mod test {
use ratatui::buffer::Buffer;

use super::*;
use crate::view::widgets::press_key;

Expand Down
Loading

0 comments on commit 7c910a5

Please sign in to comment.