This commit is contained in:
parent
de193a6e47
commit
047c8e08c0
1 changed files with 18 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
|||
use rand::{rngs::OsRng, seq::IndexedRandom, TryRngCore};
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use ratzilla::ratatui;
|
||||
|
||||
|
@ -15,6 +16,7 @@ use crate::app::password_locker::PasswordLocker;
|
|||
mod password_locker;
|
||||
|
||||
pub struct App {
|
||||
tabs: [&'static str; 3],
|
||||
transition_instant: Instant,
|
||||
selected_tab: usize,
|
||||
password_locker: PasswordLocker,
|
||||
|
@ -48,11 +50,23 @@ YJJJJJJJJJ????????????77777777777!!!!!!!!!!!~~~~~~
|
|||
YJJJJJJJJJJJ???????????77777777777!!!!!!!!!!!~~~~~
|
||||
"#;
|
||||
|
||||
const TABS: [&'static str; 3] = ["Whatzahoozits", "Thingamajigs", "Doohickeys"];
|
||||
const TABS: [&'static str; 10] = [
|
||||
"Doohickies",
|
||||
"Gadgets",
|
||||
"Gizmos",
|
||||
"Inators",
|
||||
"Thingamabobs",
|
||||
"Thingamajigs",
|
||||
"Doodads",
|
||||
"Dingies",
|
||||
"Trinkets",
|
||||
"Goobers",
|
||||
];
|
||||
|
||||
impl App {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
tabs: TABS.choose_multiple_array(&mut OsRng.unwrap_err()).unwrap(),
|
||||
transition_instant: Instant::now(),
|
||||
selected_tab: 0,
|
||||
password_locker: PasswordLocker::default(),
|
||||
|
@ -90,7 +104,7 @@ impl App {
|
|||
)
|
||||
.split(frame.area());
|
||||
frame.render_widget(
|
||||
Tabs::new(TABS)
|
||||
Tabs::new(self.tabs)
|
||||
.select(self.selected_tab)
|
||||
.fg(Color::Rgb(226, 190, 89))
|
||||
.bg(Color::Black)
|
||||
|
@ -114,7 +128,7 @@ impl App {
|
|||
|
||||
pub fn next_tab(&mut self) {
|
||||
self.transition_instant = Instant::now();
|
||||
if self.selected_tab == TABS.len() - 1 {
|
||||
if self.selected_tab == self.tabs.len() - 1 {
|
||||
self.selected_tab = 0;
|
||||
} else {
|
||||
self.selected_tab += 1;
|
||||
|
@ -124,7 +138,7 @@ impl App {
|
|||
pub fn prev_tab(&mut self) {
|
||||
self.transition_instant = Instant::now();
|
||||
if self.selected_tab == 0 {
|
||||
self.selected_tab = TABS.len() - 1;
|
||||
self.selected_tab = self.tabs.len() - 1;
|
||||
} else {
|
||||
self.selected_tab -= 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue