From 57d54f3bb56159e34b1b2c4f90010c39d75fb8a8 Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 20 Aug 2021 20:35:25 -0400 Subject: [PATCH] feat: make site prettier --- src/app/rhai_tools.rs | 53 +++++++++++++++++++++++++++++++++ templates/_base.html | 1 + templates/commands.html | 9 ++++-- templates/index.html | 12 ++++---- templates/list_redemptions.html | 2 +- templates/redemptions.html | 7 +++-- 6 files changed, 72 insertions(+), 12 deletions(-) diff --git a/src/app/rhai_tools.rs b/src/app/rhai_tools.rs index 9de12ff..d558661 100644 --- a/src/app/rhai_tools.rs +++ b/src/app/rhai_tools.rs @@ -120,4 +120,57 @@ impl ExecutorState { None => rhai::Dynamic::from(()), } } + + // async fn get_record(&self, name: &str, category: &str) -> Option<(String, String)> { + // use serde::Deserialize; + // + // #[derive(Deserialize)] + // struct Game { + // id: String, + // } + // + // #[derive(Deserialize)] + // struct Category { + // id: String, + // name: String, + // } + // + // #[derive(Deserialize)] + // struct Record { + // runs: Vec, + // } + // + // #[derive(Deserialize)] + // struct PlacedRun { + // place: usize, + // run: Run, + // } + // + // #[derive(Deserialize)] + // struct Run { + // players: Vec, + // times: Times, + // } + // + // // look up game + // // look up category + // // look up records + // // look up users + // let mut games_url = Url::parse("https://www.speedrun.com/api/v1/games").unwrap(); + // games_url.query_pairs_mut() + // .append_pair("name", name); + // let games: Vec = self.state.http.get(games_url).send().await.ok()?.json().await.ok()?; + // let game = games.get(0)?; + // + // let mut categories_url = Url::parse("https://www.speedrun.com/api/v1/games/").unwrap() + // .join(&format!("{}/", game.id)).ok()? + // .join("categories").ok()?; + // let categories: Vec = self.state.http.get(categories_url).send().await.ok()?.json().await.ok()?; + // let category = categories.iter().find(|cat| cat.name == category)?; + // + // let mut records_url = Url::parse("https://www.speedrun.com/api/v1/categories/").unwrap() + // .join(&format!("{}", category.id)).ok()? + // .join("records").ok()?; + // + // } } diff --git a/templates/_base.html b/templates/_base.html index 837e606..ab158b1 100644 --- a/templates/_base.html +++ b/templates/_base.html @@ -73,6 +73,7 @@ .breadcrumbs { display: flex; list-style: none; + margin-bottom: 1em; } .breadcrumbs li:not(:first-child)::before { diff --git a/templates/commands.html b/templates/commands.html index 37d802e..e7c3005 100644 --- a/templates/commands.html +++ b/templates/commands.html @@ -14,7 +14,7 @@ display: flex; flex-direction: column; align-items: flex-start; - margin-top: 1em; + margin-bottom: 1em; max-width: 100%; } @@ -54,14 +54,17 @@ {%- endmatch -%} -

+    
+ Script +

             {%- match command.executor -%}
                 {%- when CommandExecutor::Text with (t) -%}
                     {{ t }}
                 {%- when CommandExecutor::Rhai with (t) -%}
                     {{ t }}
             {%- endmatch -%}
-    
+
+ Edit
diff --git a/templates/index.html b/templates/index.html index 65e4c04..e254b8d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,6 +3,12 @@ {% block title %}Test{% endblock %} {% block body %} + +
- - {% endblock %} diff --git a/templates/list_redemptions.html b/templates/list_redemptions.html index 0a1f543..6d499ad 100644 --- a/templates/list_redemptions.html +++ b/templates/list_redemptions.html @@ -14,7 +14,7 @@ display: flex; flex-direction: column; align-items: flex-start; - margin-top: 1em; + margin-bottom: 1em; } {% endblock %} diff --git a/templates/redemptions.html b/templates/redemptions.html index f23d044..30ffbce 100644 --- a/templates/redemptions.html +++ b/templates/redemptions.html @@ -14,7 +14,7 @@ display: flex; flex-direction: column; align-items: flex-start; - margin-top: 1em; + margin-bottom: 1em; } {% endblock %} @@ -31,7 +31,10 @@
{{ redemption.name }} {{ redemption.twitch_id }} -
{{ redemption.rhai }}
+
+ Script +
{{ redemption.rhai }}
+