diff --git a/Cargo.lock b/Cargo.lock index b63888c..14defc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -195,6 +195,12 @@ dependencies = [ "serde", ] +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.9.0" @@ -561,6 +567,7 @@ dependencies = [ "clap", "color-eyre", "core", + "rand", "ratatui", "serde", "serde_json", @@ -2124,6 +2131,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + [[package]] name = "pretty_assertions" version = "1.4.1" @@ -2162,6 +2178,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "ratatui" version = "0.29.0" @@ -3191,6 +3237,7 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] diff --git a/core/src/components/popup.rs b/core/src/components/popup.rs index 6a1c695..c2c0980 100644 --- a/core/src/components/popup.rs +++ b/core/src/components/popup.rs @@ -63,7 +63,7 @@ impl Component for Popup { Action::DismissPopup => self.popup_text.clear(), Action::DisplayPopup(new_type, new_text) => { self.popup_type = new_type; - self.popup_text = new_text; + self.popup_text = format!("\n{new_text}"); } _ => {} } diff --git a/deja_vu/Cargo.toml b/deja_vu/Cargo.toml index 5cee449..7756600 100644 --- a/deja_vu/Cargo.toml +++ b/deja_vu/Cargo.toml @@ -39,6 +39,7 @@ tokio-util = "0.7.11" tracing = "0.1.41" tracing-error = "0.2.0" tracing-subscriber = { version = "0.3.18", features = ["env-filter", "serde"] } +rand = "0.8.5" [build-dependencies] anyhow = "1.0.86" diff --git a/deja_vu/src/app.rs b/deja_vu/src/app.rs index 7dff271..ae6ef72 100644 --- a/deja_vu/src/app.rs +++ b/deja_vu/src/app.rs @@ -36,6 +36,7 @@ use std::{ }; use color_eyre::Result; +use rand::random; use ratatui::{ crossterm::event::KeyEvent, layout::{Constraint, Direction, Layout}, @@ -246,10 +247,8 @@ impl App { } } Mode::Done => { - self.action_tx.send(Action::DisplayPopup( - popup::Type::Success, - String::from("COMPLETE\n\n\nThank you for using this tool!"), - ))?; + self.action_tx + .send(Action::DisplayPopup(popup::Type::Success, fortune()))?; } _ => {} } @@ -719,3 +718,19 @@ fn build_right_items(app: &App, cur_mode: Mode) -> Action { } Action::UpdateRight(labels, start_index, items) } + +fn fortune() -> String { + String::from(match random::() / 4 { + 0 => "FUN FACT\n\n\nComputers barely work.", + 1 => "CRASH OVERRIDE\n\n\n\"Hack the planet!\"", + 2 => "CATS\n\n\n\"All your base are belong to us!\"", + 3 => "HMM\n\n\nThis has all happened before...\n\nThis will all happen again.", + 4 => "CYPHER\n\n\n\"I don’t even see the code. All I see is blonde, brunette, red-head.\"", + 5 => "CONGRATULATIONS\n\n\nYour did it!", + 6 => "DID YOU KNOW?\n\n\nmacOS includes a built-in screen reader!", + 7 => "TIP OF THE DAY\n\n\nNever go full Snappy!", + 8 => "WORDS OF WISDOM\n\n\n\nIt’s not DNS,\n\nThere’s no way it’s DNS,\n\nIt was DNS.", + 9 => "HAL 9000\n\n\n\"I'm sorry Dave, I'm afraid I can't do that.\"", + _ => "COMPLETE\n\n\nThank you for using this tool!", + }) +}