feat: make site prettier

This commit is contained in:
Anna 2021-08-20 20:35:25 -04:00
parent ae36d47738
commit 57d54f3bb5
6 changed files with 72 additions and 12 deletions

View File

@ -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<PlacedRun>,
// }
//
// #[derive(Deserialize)]
// struct PlacedRun {
// place: usize,
// run: Run,
// }
//
// #[derive(Deserialize)]
// struct Run {
// players: Vec<Player>,
// 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<Game> = 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<Category> = 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()?;
//
// }
}

View File

@ -73,6 +73,7 @@
.breadcrumbs {
display: flex;
list-style: none;
margin-bottom: 1em;
}
.breadcrumbs li:not(:first-child)::before {

View File

@ -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 -%}
</span>
</div>
<pre><code>
<details>
<summary>Script</summary>
<pre><code>
{%- match command.executor -%}
{%- when CommandExecutor::Text with (t) -%}
{{ t }}
{%- when CommandExecutor::Rhai with (t) -%}
{{ t }}
{%- endmatch -%}
</code></pre>
</code></pre>
</details>
<a href="/commands/edit/{{ command.id.to_simple() }}">Edit</a>
<form action="/commands/delete" method="post">
<input type="hidden" name="id" value="{{ command.id }}"/>

View File

@ -3,6 +3,12 @@
{% block title %}Test{% endblock %}
{% block body %}
<ul class="breadcrumbs">
<li class="current"><a href="/">Home</a></li>
<li class="future"><a href="/commands">Commands</a></li>
<li class="future"><a href="/redemptions">Redemptions</a></li>
</ul>
<form action="/" method="post">
<label>
Access token
@ -10,10 +16,4 @@
</label>
<button type="submit">Submit</button>
</form>
<ul class="breadcrumbs">
<li class="current"><a href="/">Home</a></li>
<li class="future"><a href="/commands">Commands</a></li>
<li class="future"><a href="/redemptions">Redemptions</a></li>
</ul>
{% endblock %}

View File

@ -14,7 +14,7 @@
display: flex;
flex-direction: column;
align-items: flex-start;
margin-top: 1em;
margin-bottom: 1em;
}
</style>
{% endblock %}

View File

@ -14,7 +14,7 @@
display: flex;
flex-direction: column;
align-items: flex-start;
margin-top: 1em;
margin-bottom: 1em;
}
</style>
{% endblock %}
@ -31,7 +31,10 @@
<div class="redemption">
<strong>{{ redemption.name }}</strong>
<em>{{ redemption.twitch_id }}</em>
<pre><code>{{ redemption.rhai }}</code></pre>
<details>
<summary>Script</summary>
<pre><code>{{ redemption.rhai }}</code></pre>
</details>
<form action="/redemptions/delete" method="post">
<input type="hidden" name="id" value="{{ redemption.id }}"/>
<button type="submit">Delete</button>