refactor: use indoc! for better formatting of cat ascii art

This commit is contained in:
Erica Marigold 2025-02-02 18:46:13 +00:00
parent fc41a499e6
commit 764cddee0e
Signed by: DevComp
GPG key ID: 429EF1C337871656

View file

@ -1,10 +1,18 @@
use color_eyre::Result; use color_eyre::Result;
use indoc::indoc;
use ratatui::{prelude::*, widgets::*}; use ratatui::{prelude::*, widgets::*};
use tokio::sync::mpsc::UnboundedSender; use tokio::sync::mpsc::UnboundedSender;
use super::Component; use super::Component;
use crate::{action::Action, config::Config}; use crate::{action::Action, config::Config};
const CAT_ASCII_ART: &str = indoc! {r#"
|\__/,| (`\
|_ _ |.--.) )
( T ) /
(((^_(((/(((_>
"#};
#[derive(Default)] #[derive(Default)]
pub struct Cat { pub struct Cat {
command_tx: Option<UnboundedSender<Action>>, command_tx: Option<UnboundedSender<Action>>,
@ -38,13 +46,12 @@ impl Component for Cat {
} }
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> { fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
const CART: &str = r#" |\__/,| (`\
|_ _ |.--.) )
( T ) /
(((^_(((/(((_>"#;
frame.render_widget( frame.render_widget(
Paragraph::new(CART).style(Style::default().fg(Color::Magenta).add_modifier(Modifier::SLOW_BLINK | Modifier::BOLD)), Paragraph::new(CAT_ASCII_ART).style(
Style::default()
.fg(Color::Magenta)
.add_modifier(Modifier::SLOW_BLINK | Modifier::BOLD),
),
Rect { Rect {
x: area.width - 17, x: area.width - 17,
y: area.height - 4, y: area.height - 4,