From a11b0e239fc19496867d3364d29cee3aa2f0dc95 Mon Sep 17 00:00:00 2001 From: Sachith Date: Fri, 2 Feb 2024 19:45:09 +0530 Subject: [PATCH] Help banner and fixes --- index.html | 10 ++++------ src/base.rs | 3 +++ src/base/banner.rs | 29 +++++++++++++++++++++++++++++ src/base/prompt.rs | 7 +++---- src/lib.rs | 6 +++--- src/texts.rs | 21 ++++++++++----------- styles/styles.css | 3 +-- 7 files changed, 53 insertions(+), 26 deletions(-) create mode 100644 src/base/banner.rs diff --git a/index.html b/index.html index b34b824..6354c7d 100644 --- a/index.html +++ b/index.html @@ -3,15 +3,15 @@ Termfolio - + - + - + - + @@ -20,6 +20,4 @@ - - diff --git a/src/base.rs b/src/base.rs index 92111d0..b775a9d 100644 --- a/src/base.rs +++ b/src/base.rs @@ -1,7 +1,9 @@ use leptos::{component, create_signal, view, For, IntoView, SignalGet}; use std::collections::VecDeque; +mod banner; mod prompt; +use banner::Banner; use prompt::Prompt; #[component] @@ -14,6 +16,7 @@ pub fn Base() -> impl IntoView { view! {
+ ________________ __ _____________ __ ________ + /_ __/ ____/ __ \/ |/ / ____/ __ \/ / / _/ __ \ + / / / __/ / /_/ / /|_/ / /_ / / / / / / // / / / + / / / /___/ _, _/ / / / __/ / /_/ / /____/ // /_/ / +/_/ /_____/_/ |_/_/ /_/_/ \____/_____/___/\____/ + + +Hello, welcome to Termfolio. Type one of these commands - + + about - View about me + github - View about Github profile + repos - View about my pinned repos / projects + links - View contact info and links + help - View this help section + theme - Cycle through themes + credits - View credits and repo"#; + +#[component] +pub fn Banner() -> impl IntoView { + view! { +

"user@termfolio:~$ "

+

"help"

+
+            
+
+ } +} diff --git a/src/base/prompt.rs b/src/base/prompt.rs index 1bf17cc..9dd4c95 100644 --- a/src/base/prompt.rs +++ b/src/base/prompt.rs @@ -9,7 +9,6 @@ use leptos_use::{ UseColorModeOptions, UseColorModeReturn, UseCycleListOptions, UseCycleListReturn, }; use std::collections::VecDeque; -use termfolio::autocomplete; #[component] pub fn Prompt( @@ -50,7 +49,7 @@ pub fn Prompt( spawn_local(async move { let value = value.trim().replace("<", "‹").replace(">", "›"); - let val = value.split_once(' ').unwrap_or((&value, " ")); + let val = value.split_once(' ').unwrap_or((&value, "")); match val.0 { "clear" => { @@ -79,7 +78,7 @@ pub fn Prompt( } updater.update(|hist| { - if value != "" && hist.front() != Some(&value) { + if !value.is_empty() && hist.front() != Some(&value) { hist.push_front(value); if hist.len() > 20 { hist.pop_back(); @@ -133,7 +132,7 @@ pub fn Prompt( //Autocomplete "Tab" => { ev.prevent_default(); - inp.set_value(autocomplete(&inp.value())); + inp.set_value(termfolio::autocomplete(&inp.value())); } _ => {} } diff --git a/src/lib.rs b/src/lib.rs index 51ca6c9..e0f4eb9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,12 +26,12 @@ impl Command { async fn printout(&self) -> String { match self { - Self::Help => format!("{}{}", texts::LOGO_V2, texts::HELP), + Self::Help => String::from(texts::HELP), Self::About => fetch::get_about(), Self::Github => fetch::get_github().await, Self::Repos => fetch::get_repos().await, Self::Links => fetch::get_contacts().to_string(), - Self::Credits => format!("{}{}", texts::LOGO_V1, texts::CREDITS), + Self::Credits => String::from(texts::CREDITS), Self::Bash(bash) => Bash::printout(&bash), } } @@ -103,7 +103,7 @@ pub fn autocomplete(inp: &str) -> &str { let inp = inp.trim(); let comms = [ - "help", "about", "github", "repos", "links", "theme", "credits", + "help", "about", "github", "repos", "links", "theme", "credits", "neofetch", ]; if !inp.is_empty() { diff --git a/src/texts.rs b/src/texts.rs index abe520a..d6e4161 100644 --- a/src/texts.rs +++ b/src/texts.rs @@ -1,18 +1,10 @@ -pub const LOGO_V1: &str = r#" dMMMMMMP dMMMMMP dMMMMb dMMMMMMMMb dMMMMMP .aMMMb dMP dMP .aMMMb - dMP dMP dMP.dMP dMP"dMP"dMP dMP dMP"dMP dMP amr dMP"dMP - dMP dMMMP dMMMMK dMP dMP dMP dMMMP dMP dMP dMP dMP dMP dMP - dMP dMP dMP"AMF dMP dMP dMP dMP dMP.aMP dMP dMP dMP.aMP -dMP dMMMMMP dMP dMP dMP dMP dMP dMP VMMMP" dMMMMMP dMP VMMMP" -"#; - -pub const LOGO_V2: &str = r#" ________________ __ _____________ __ ________ +pub const HELP: &str = r#" ________________ __ _____________ __ ________ /_ __/ ____/ __ \/ |/ / ____/ __ \/ / / _/ __ \ / / / __/ / /_/ / /|_/ / /_ / / / / / / // / / / / / / /___/ _, _/ / / / __/ / /_/ / /____/ // /_/ / /_/ /_____/_/ |_/_/ /_/_/ \____/_____/___/\____/ -"#; + -pub const HELP: &str = r#" Hello, welcome to Termfolio. Type one of these commands - about - View about me @@ -23,7 +15,14 @@ Hello, welcome to Termfolio. Type one of these comma theme - Cycle through themes credits - View credits and repo"#; -pub const CREDITS: &str = r#" +pub const CREDITS: &str = r#" _____ ______________ _________ _____ _ _____ _____ +|_ _| ___| ___ \ \/ || ___| _ | | |_ _| _ | + | | | |__ | |_/ / . . || |_ | | | | | | | | | | | + | | | __|| /| |\/| || _| | | | | | | | | | | | + | | | |___| |\ \| | | || | \ \_/ / |_____| |_\ \_/ / + \_/ \____/\_| \_\_| |_/\_| \___/\_____/\___/ \___/ + + Terminal style portfolio website, made using Rust. Made by Sachith C Shetty diff --git a/styles/styles.css b/styles/styles.css index 68f4087..747e7b8 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -32,7 +32,6 @@ input { form { display: inline-block; - margin-right: 10px; margin-bottom: 0px; /* caret-shape: block; */ caret-color: var(--green); @@ -123,5 +122,5 @@ form { /* Links */ a { - text-decoration-thickness: 2px; + text-decoration-thickness: 1px; }