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(()), 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 { .breadcrumbs {
display: flex; display: flex;
list-style: none; list-style: none;
margin-bottom: 1em;
} }
.breadcrumbs li:not(:first-child)::before { .breadcrumbs li:not(:first-child)::before {

View File

@ -14,7 +14,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
margin-top: 1em; margin-bottom: 1em;
max-width: 100%; max-width: 100%;
} }
@ -54,14 +54,17 @@
{%- endmatch -%} {%- endmatch -%}
</span> </span>
</div> </div>
<pre><code> <details>
<summary>Script</summary>
<pre><code>
{%- match command.executor -%} {%- match command.executor -%}
{%- when CommandExecutor::Text with (t) -%} {%- when CommandExecutor::Text with (t) -%}
{{ t }} {{ t }}
{%- when CommandExecutor::Rhai with (t) -%} {%- when CommandExecutor::Rhai with (t) -%}
{{ t }} {{ t }}
{%- endmatch -%} {%- endmatch -%}
</code></pre> </code></pre>
</details>
<a href="/commands/edit/{{ command.id.to_simple() }}">Edit</a> <a href="/commands/edit/{{ command.id.to_simple() }}">Edit</a>
<form action="/commands/delete" method="post"> <form action="/commands/delete" method="post">
<input type="hidden" name="id" value="{{ command.id }}"/> <input type="hidden" name="id" value="{{ command.id }}"/>

View File

@ -3,6 +3,12 @@
{% block title %}Test{% endblock %} {% block title %}Test{% endblock %}
{% block body %} {% 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"> <form action="/" method="post">
<label> <label>
Access token Access token
@ -10,10 +16,4 @@
</label> </label>
<button type="submit">Submit</button> <button type="submit">Submit</button>
</form> </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 %} {% endblock %}

View File

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

View File

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