Skip to content

Commit

Permalink
feat(term): show big text on login
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed Apr 30, 2024
1 parent f648d8d commit d4a5b18
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
50 changes: 50 additions & 0 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion crates/synd_term/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ graphql_client = { workspace = true }
html2text = { version = "0.12" }
itertools = { workspace = true }
nom = { version = "7.1.3", default-features = false, features = ["std"] }
nucleo = "0.5.0"
open = "5.1.0"
parse_duration = { workspace = true }
ratatui = { version = "=0.26.1" }
Expand All @@ -46,9 +47,9 @@ toml = { version = "0.8.12", default-features = true }
tracing = { workspace = true }
tracing-appender = "0.2.3"
tracing-subscriber = { workspace = true }
tui-big-text = "0.4.3"
unicode-segmentation = "1.10.1"
url = { workspace = true }
nucleo = "0.5.0"
# https://github.com/arkbig/throbber-widgets-tui/pull/5
# throbber-widgets-tui = "0.3.0"

Expand Down
23 changes: 20 additions & 3 deletions crates/synd_term/src/ui/components/authentication.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use ratatui::{
prelude::{Alignment, Buffer, Constraint, Layout, Rect},
style::{Modifier, Style},
style::{Modifier, Style, Stylize},
text::{Line, Span, Text},
widgets::{
Block, Borders, HighlightSpacing, List, ListItem, ListState, Paragraph, StatefulWidget,
Widget,
},
};
use synd_auth::device_flow::DeviceAuthorizationResponse;
use tui_big_text::{BigText, PixelSize};

use crate::{
application::Direction,
Expand Down Expand Up @@ -84,8 +85,24 @@ impl Authentication {
fn render_login(&self, area: Rect, buf: &mut Buffer, cx: &Context<'_>) {
let area = area.centered(40, 50);

let vertical = Layout::vertical([Constraint::Length(2), Constraint::Min(1)]);
let [title_area, methods_area] = vertical.areas(area);
let vertical = Layout::vertical([
Constraint::Length(9),
Constraint::Length(2),
Constraint::Min(2),
]);

let [big_text_area, title_area, methods_area] = vertical.areas(area);

// Render big "syndicationd"
if let Ok(big_text) = BigText::builder()
.pixel_size(PixelSize::HalfWidth)
.style(Style::new().white())
.alignment(Alignment::Center)
.lines(vec!["Syndicationd".into()])
.build()
{
big_text.render(big_text_area, buf);
}

let title = Self::login_title(cx);

Expand Down

0 comments on commit d4a5b18

Please sign in to comment.