-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ens searchbar and input field, missing API request
- Loading branch information
Showing
7 changed files
with
74 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
pub const RATE_LIMIT: usize = 60; | ||
|
||
pub const GENERAL_HELP_TEXT: [&str] = | ||
pub const GENERAL_HELP_TEXT: &str = | ||
"<esc>: Cancel, q: Quit, ?: Keybindings, s: Focus on the Search bar"; | ||
|
||
pub const SEARCH_HELP_TEXT: [&str] = | ||
pub const SEARCH_HELP_TEXT: &str = | ||
"Type either an ENS or Ethereum-based address to search for a position"; | ||
|
||
pub const TICK_RATE: u64 = 200; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pub mod constants; | ||
pub mod event; | ||
pub mod event_handling; | ||
pub mod list; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
use ratatui::{prelude::*, widgets::*}; | ||
|
||
use super::spinner::Spinner; | ||
use crate::app::App; | ||
|
||
pub fn render_search_block<'a>(word: &str) -> Block<'a> { | ||
let searching_block = Block::default() | ||
.title(format!( | ||
"{} Searching for {word}", | ||
Spinner::default().to_string() | ||
)) | ||
.border_style(Style::default().fg(Color::Green)) | ||
pub fn render_search_block<'a>( | ||
outer: Rect, | ||
app: &'a mut App, | ||
) -> Option<(ratatui::widgets::Paragraph<'a>, Rect)> { | ||
let [searchbar, _, _] = *Layout::default() | ||
.direction(Direction::Vertical) | ||
.constraints([Constraint::Max(3), Constraint::Min(0), Constraint::Max(1)].as_ref()) | ||
.split(outer) | ||
else { | ||
return None; | ||
}; | ||
|
||
let searchbar_block = Block::default() | ||
.border_style(Style::default()) | ||
.title(format!("Search by Address / ENS")) | ||
.borders(Borders::ALL) | ||
.border_type(BorderType::Plain); | ||
|
||
searching_block | ||
let input = Paragraph::new(app.input.as_str()) | ||
.style(Style::default().fg(Color::White)) | ||
.block(searchbar_block); | ||
|
||
Some((input, searchbar)) | ||
} |