Skip to content

Commit

Permalink
Temp fix, need to revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
shettysach committed Aug 25, 2024
1 parent 17eba89 commit 988f193
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 76 deletions.
15 changes: 15 additions & 0 deletions configs/lang_icons/github.txt

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
38 changes: 17 additions & 21 deletions configs/neofetch.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
___
,o88888
,o8888888'
,:o:o:oooooo. ,8O88Pd8888"
,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
, ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
, ..:.::o:ooOoOO8O888O8O,COCOO"
, . ..:.::o:ooOoOOOO8OOOOCOCO"
. ..:.::o:ooOoOoOO8O8OCCCC"o
. ..:.::o:ooooOoCoCCC"o:o
. ..:.::o:o:,cooooCo"oo:o:
` . . ..:.:cocoooo"'o:o:::'
.` . ..::ccccoc"'o:o:o:::'
:.:. ,c:cccc"':.:.:.:.:.'
..:.:"'`::::c:"'..:.:.:.:.:.'
...:.'.:.::::"' . . . . .'
.. . ....:."' ` . . . ''
. . . ...."'
.. . ."'
.
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⡤⠔⠒⠂⠀⠀⠀⠐⠒⠂⠤⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⢊⡥⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠢⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠚⢁⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠲⢄⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⠁⡰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠱⡄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⠁⢸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠘⡄⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⢠⠀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠊⠀⠀⠀⢸⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠙⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠀⠀⠀⡸⠁⠀⠀⠀⠀⠸⡇⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⠀⢀⣼⣿⣿⣷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠈⠀⠀⠀⠀⢰⡅⠀⠀⠀⠀⠀⢰⠇⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡀⠸⠷⠿⠿⢿⣿⡿⠀⠀⠀⠀⠀⠀⢀⣤⣶⣶⣶⣤⡀⠀⠀⠸⡇⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡟⠀⠀⠀⠀⠀⠉⠀⠀⢀⠀⠀⠀⠀⢸⣯⣿⣿⣿⣿⡿⠀⠀⠀⠙⠤⡀⠀⠀⠀⡏⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡼⠟⠀⠀⣢⠀⠀⠀⠀⠀⠶⣿⡄⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⡟⠀⠀⡜⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢳⠀⠀⠙⡏⠑⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⢸⠀⡠⠊⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⡴⠒⠉⠉⠺⣧⡀⠀⠘⢦⡇⠈⠉⢲⠤⣀⡀⠀⠀⠀⠀⠀⣀⣤⠀⠀⠀⠀⠀⠸⣀⡼⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⣿⠀⠰⣤⠀⠀⠈⠻⣦⣀⠀⠈⠓⠤⢎⡀⠀⠀⡝⠉⠉⢙⣋⡠⠛⠁⠀⠀⠀⠀⣸⣋⣠⣤⣤⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⠤⠒⠛⠣⣀⠻⣧⠀⠀⠀⠈⢿⣿⠑⠢⢄⣀⡈⠉⠉⠙⠒⠉⠉⠁⠀⠀⠀⠀⣀⣤⣾⡿⠟⠉⠉⠀⠈⢢⡀⠀⠀⠀⠀⠀
⣀⣼⠃⠀⠀⠀⠀⠈⢹⣿⣧⣄⣀⣀⣴⣿⣆⠀⠠⢉⠛⠱⠷⠲⠒⠀⣲⣶⣶⣶⡶⢿⣫⠥⠋⠀⣠⣴⠞⠀⠀⣸⠿⠀⠀⠀⠀⠀
⠀⠘⠇⠀⠀⣀⣀⣠⣾⠥⠾⣿⡀⠀⣾⣿⠈⠑⠢⠤⣈⣑⣢⣄⣀⣰⣿⡿⠿⢿⣟⣉⣀⣠⠤⠾⠭⠥⠖⠒⠉⠉⠳⡀⠀⠀⠀⠀
21 changes: 21 additions & 0 deletions sans.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⡤⠔⠒⠂⠀⠀⠀⠐⠒⠂⠤⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⢊⡥⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠢⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠚⢁⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠲⢄⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⠁⡰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠱⡄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⠁⢸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠤⠘⡄⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⢠⠀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠊⠀⠀⠀⢸⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠙⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠀⠀⠀⡸⠁⠀⠀⠀⠀⠸⡇⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⠀⢀⣼⣿⣿⣷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠈⠀⠀⠀⠀⢰⡅⠀⠀⠀⠀⠀⢰⠇⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡀⠸⠷⠿⠿⢿⣿⡿⠀⠀⠀⠀⠀⠀⢀⣤⣶⣶⣶⣤⡀⠀⠀⠸⡇⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡟⠀⠀⠀⠀⠀⠉⠀⠀⢀⠀⠀⠀⠀⢸⣯⣿⣿⣿⣿⡿⠀⠀⠀⠙⠤⡀⠀⠀⠀⡏⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡼⠟⠀⠀⣢⠀⠀⠀⠀⠀⠶⣿⡄⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⡟⠀⠀⡜⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢳⠀⠀⠙⡏⠑⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⢸⠀⡠⠊⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⡴⠒⠉⠉⠺⣧⡀⠀⠘⢦⡇⠈⠉⢲⠤⣀⡀⠀⠀⠀⠀⠀⣀⣤⠀⠀⠀⠀⠀⠸⣀⡼⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⣿⠀⠰⣤⠀⠀⠈⠻⣦⣀⠀⠈⠓⠤⢎⡀⠀⠀⡝⠉⠉⢙⣋⡠⠛⠁⠀⠀⠀⠀⣸⣋⣠⣤⣤⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⠤⠒⠛⠣⣀⠻⣧⠀⠀⠀⠈⢿⣿⠑⠢⢄⣀⡈⠉⠉⠙⠒⠉⠉⠁⠀⠀⠀⠀⣀⣤⣾⡿⠟⠉⠉⠀⠈⢢⡀⠀⠀⠀⠀⠀
⣀⣼⠃⠀⠀⠀⠀⠈⢹⣿⣧⣄⣀⣀⣴⣿⣆⠀⠠⢉⠛⠱⠷⠲⠒⠀⣲⣶⣶⣶⡶⢿⣫⠥⠋⠀⣠⣴⠞⠀⠀⣸⠿⠀⠀⠀⠀⠀
⠀⠘⠇⠀⠀⣀⣀⣠⣾⠥⠾⣿⡀⠀⣾⣿⠈⠑⠢⠤⣈⣑⣢⣄⣀⣰⣿⡿⠿⢿⣟⣉⣀⣠⠤⠾⠭⠥⠖⠒⠉⠉⠳⡀⠀⠀⠀⠀
⠤⠶⠶⢶⣶⡇⣶⡄⣀⣀⣀⣠⡇⢸⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢦⠀⠀⠀
⠀⠀⠀⠀⣿⡇⢘⣽⡏⠀⠀⠁⢠⣾⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⢯⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣆⠀⠀
⠀⠀⠀⠀⢹⣿⠈⠛⠛⢚⡆⠀⢸⣯⡟⠀⠀⠀⠀⠀⡀⠀⠀⠀⡾⣾⠛⢦⣀⡀⠀⠀⠀⠀⠀⣰⣄⡀⠀⠀⠀⠀⠐⠛⠁⠀⠑⡄
⠀⠀⠀⠀⠼⢿⣤⣀⠀⠀⢀⣤⣿⣿⠀⠀⠤⠒⣨⠟⡇⠀⠀⣸⣿⡏⠉⠉⠙⠛⠛⠛⠛⠩⠉⡹⠻⠭⠍⠙⠳⠲⣄⠀⠀⠀⠀⢘
3 changes: 1 addition & 2 deletions src/base/prompt/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ pub fn keyboard_commands(
"ArrowDown" => {
if index > 1 {
inp.set_value(&hist[index - 2]);
set_history_index.update(|history_index| *history_index -= 1);
} else if index == 1 {
inp.set_value("");
set_history_index.update(|history_index| *history_index -= 1);
}
set_history_index.update(|history_index| *history_index -= 1);
}
//Autocomplete
"Tab" => {
Expand Down
2 changes: 1 addition & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Command {
Self::Repos => fetch::get_repos().await,
Self::Links => fetch::get_contacts().to_string(),
Self::Credits => String::from(texts::CREDITS),
Self::Bash(bash) => Bash::printout(&bash),
Self::Bash(bash) => Bash::printout(bash),
}
}

Expand Down
19 changes: 8 additions & 11 deletions src/commands/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static CONTACTS: OnceLock<String> = OnceLock::new();
// Once Functions

fn read_config() -> Option<Config> {
CONFIG.get_or_init(|| match serde_json::from_str::<Config>(&JSON) {
CONFIG.get_or_init(|| match serde_json::from_str::<Config>(JSON) {
Ok(config) => Some(config),
Err(_) => None,
});
Expand All @@ -40,7 +40,7 @@ pub fn get_about() -> String {
}

pub async fn get_github() -> String {
GITHUB.get_or_init(|| fetch_github()).await;
GITHUB.get_or_init(fetch_github).await;

match GITHUB.get() {
Some(user) => user.to_string(),
Expand All @@ -49,7 +49,7 @@ pub async fn get_github() -> String {
}

pub async fn get_repos() -> String {
REPOS.get_or_init(|| fetch_repos()).await;
REPOS.get_or_init(fetch_repos).await;

match REPOS.get() {
Some(repos) => repos.to_string(),
Expand Down Expand Up @@ -102,21 +102,18 @@ async fn fetch_github() -> String {
async fn fetch_repos() -> String {
match read_config() {
Some(config) => {
let repos_url = format!(
"https://gh-pinned-repos-api.ysnirix.xyz/api/get/?username={}",
config.github
);
let repos_url = format!("https://pinned.thrzl.xyz/{}", config.github);

match reqwest::get(&repos_url).await {
Ok(response) => {
let api_response: ApiResponse = response.json().await.unwrap();
let repos = Repos {
username: config.github,
repos: api_response.response,
repos: response.json().await.unwrap(),
};
repos.formatter()
}
Err(_) => String::from(FETCH_GITHUB_ERROR),
Err(e) => {
format!("Error fetching data: {:#?}", e)
}
}
}
None => String::from(READ_JSON_ERROR),
Expand Down
37 changes: 10 additions & 27 deletions src/commands/fetch/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ use std::collections::HashMap;
const NEOFETCH: &str = include_str!("../../../configs/neofetch.txt");

// Language icons for repos
const RUST: &str = include_str!("../../../configs/lang_icons/ferris.txt");
const PYTHON: &str = include_str!("../../../configs/lang_icons/pythons.txt");
const JAVASCRIPT: &str = include_str!("../../../configs/lang_icons/javascript.txt");
const PLACEHOLDER: &str = include_str!("../../../configs/lang_icons/octocat.txt");
const RUST: &str = include_str!("../../../configs/lang_icons/rust.txt");
const PYTHON: &str = include_str!("../../../configs/lang_icons/python.txt");
const GITHUB: &str = include_str!("../../../configs/lang_icons/github.txt");

pub trait Formatter {
fn formatter(self) -> String;
Expand Down Expand Up @@ -109,7 +108,7 @@ impl Formatter for Account {
let created_on = &self.info.created_at[..10];

let text = format!(
r#"<a href="https://www.github.com/{}" style="text-decoration:none" target="_blank"><span class="grn semibold">{}</span>@<span class="grn semibold">github</span></a>
r#"<a href="https://www.github.com/{}" style="text-decoration:none" target="_blank"><span class="grn semibold">{}</span><span class="grn semibold">@termfolio</span></a>
----------------------
<span class="grn semibold">Name:</span> {}
<span class="grn semibold">Bio:</span> {}
Expand Down Expand Up @@ -164,11 +163,11 @@ impl Formatter for Repos {
<span class="rd semibold">Forks:</span> <span class="ylw">{}</span>
"#,
repo.repo,
repo.link,
repo.name,
repo.description,
repo.language.color,
repo.language.name,
repo.language_color,
repo.language,
repo.stars,
repo.forks
);
Expand All @@ -178,28 +177,13 @@ impl Formatter for Repos {
<div class="rcols">{}</div>
<div class="rcols" style="width: 45%;">{}</div>
</div>"#,
lang_icon(&repo.language.name),
lang_icon(&repo.language),
text
)
})
.collect();

let all_link = format!(
r#"<a href="https://www.github.com/{}?tab=repositories" target="_blank" class="blu semibold">All repos</a>
<span class="rd semibold">Description:</span> All my Github repositories."#,
self.username
);

let all = format!(
r#"<div class="row">
<div class="rcols">{}</div>
<div class="rcols" style="width: 45%;">{}</div>
</div>"#,
PLACEHOLDER, all_link
);

format!("{}\n{}", res.join("\n"), all)
res.join("\n")
}
}

Expand Down Expand Up @@ -278,8 +262,7 @@ fn lang_icon(lang: &str) -> &str {
match lang {
"Rust" => RUST,
"Python" | "Jupyter Notebook" => PYTHON,
"CSS" | "HTML" | "JavaScript" => JAVASCRIPT,
_ => PLACEHOLDER,
_ => GITHUB,
}
}

Expand Down
13 changes: 4 additions & 9 deletions src/commands/fetch/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,17 @@ pub struct ApiResponse {

#[derive(Deserialize, Serialize)]
pub struct Repos {
pub username: String,
pub repos: Vec<Repository>,
}

#[derive(Deserialize, Serialize, Clone)]
pub struct Repository {
pub full_name: String,
pub name: String,
pub repo: String,
pub description: String,
pub language: Language,
pub link: String,
pub stars: u16,
pub forks: u16,
}

#[derive(Deserialize, Serialize, Clone)]
pub struct Language {
pub name: String,
pub color: String,
pub language: String,
pub language_color: String,
}
2 changes: 1 addition & 1 deletion src/commands/texts.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub const HELP: &str = r#"<span class="grn semibold"> ________________ __ _____________ __ ________
pub const HELP: &str = r#"<span class="blu semibold"> ________________ __ _____________ __ ________
/_ __/ ____/ __ \/ |/ / ____/ __ \/ / / _/ __ \
/ / / __/ / /_/ / /|_/ / /_ / / / / / / // / / /
/ / / /___/ _, _/ / / / __/ / /_/ / /____/ // /_/ /
Expand Down
6 changes: 2 additions & 4 deletions styles/styles.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
:root {
--white: #c0caf5;
--black: #17171e;
--green: #4fd6be;
--red: #c53b53;
--green: #2ac3de;
--red: #bb9af7;
--blue: #7aa2f7;
--yellow: #ffc777;
--orange: #ff757f;
Expand Down Expand Up @@ -76,7 +76,6 @@ form {
float: left;
}


/* About */

.acols {
Expand Down Expand Up @@ -115,4 +114,3 @@ form {
.blocks {
font-size: 35px;
}

0 comments on commit 988f193

Please sign in to comment.