diff --git a/core/Cargo.toml b/core/Cargo.toml index e724ecf..0b92777 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -42,6 +42,7 @@ lazy_static = "1.5.0" libc = "0.2.158" once_cell = "1.20.2" pretty_assertions = "1.4.0" +rand = "0.9.0" ratatui = { version = "0.29.0", features = ["serde", "macros"] } raw-cpuid = "11.2.0" regex = "1.11.1" diff --git a/core/src/components/popup.rs b/core/src/components/popup.rs index c2c0980..c95cce2 100644 --- a/core/src/components/popup.rs +++ b/core/src/components/popup.rs @@ -14,6 +14,7 @@ // along with Deja-vu. If not, see . // use color_eyre::Result; +use rand::random; use ratatui::{ prelude::*, widgets::{Block, Borders, Clear, Paragraph, Wrap}, @@ -95,3 +96,19 @@ impl Component for Popup { Ok(()) } } + +pub 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!", + }) +} diff --git a/deja_vu/Cargo.toml b/deja_vu/Cargo.toml index 7756600..5cee449 100644 --- a/deja_vu/Cargo.toml +++ b/deja_vu/Cargo.toml @@ -39,7 +39,6 @@ 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 a71427c..4c33576 100644 --- a/deja_vu/src/app.rs +++ b/deja_vu/src/app.rs @@ -36,7 +36,6 @@ use std::{ }; use color_eyre::Result; -use rand::random; use ratatui::{ crossterm::event::KeyEvent, layout::{Constraint, Direction, Layout}, @@ -258,7 +257,7 @@ impl App { } Mode::Done => { self.action_tx - .send(Action::DisplayPopup(popup::Type::Success, fortune()))?; + .send(Action::DisplayPopup(popup::Type::Success, popup::fortune()))?; } _ => {} } @@ -739,19 +738,3 @@ 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!", - }) -}