Improve navbar

rust
Elnu 1 year ago
parent 351c173357
commit 0e1995065b

@ -19,16 +19,15 @@ pub fn logout(cookies: &CookieJar<'_>, referer: Referer) -> Redirect {
params.insert("token", token); params.insert("token", token);
params params
}; };
match client if let Err(error) = client
.post("https://discord.com/api/oauth2/token/revoke") .post("https://discord.com/api/oauth2/token/revoke")
.header("Content-Type", "application/x-www-form-urlencoded") .header("Content-Type", "application/x-www-form-urlencoded")
.form(&params) .form(&params)
.send() .send()
.await .await
{ {
Ok(_) => println!("Successfully revoked token"), println!("Failed to revoke token: {:?}", error);
Err(error) => println!("Failed to revoke token: {:?}", error), }
};
}); });
User::purge(cookies); User::purge(cookies);
let redirect_url = referer.0.unwrap_or("/".to_owned()); let redirect_url = referer.0.unwrap_or("/".to_owned());

@ -82,9 +82,10 @@ input[type=number] {
} }
} }
a, .link { .link {
color: var(--fg); color: var(--fg);
font-weight: bold; font-weight: bold;
white-space: nowrap;
} }
& > .right { & > .right {

@ -11,9 +11,9 @@
{% include "modal" %} {% include "modal" %}
<div id="content"> <div id="content">
<nav> <nav>
<a href="/{{ challenge - 1 }}"><svg class="svg-inline" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 278.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"></path></svg></a> <a class="link" href="/{{ challenge - 1 }}"><svg class="svg-inline" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 278.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"></path></svg></a>
<input type="number" min="1" value="{{ challenge }}" autocomplete="false"> <input type="number" min="1" value="{{ challenge }}" autocomplete="false">
<a href="/{{ challenge + 1 }}"><svg class="svg-inline" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M342.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L274.7 256 105.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"></path></svg></a> <a class="link" href="/{{ challenge + 1 }}"><svg class="svg-inline" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M342.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L274.7 256 105.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"></path></svg></a>
{% if content.song %} {% if content.song %}
<div> <div>
<span>{{ content.song.japanese }}</span> <span>{{ content.song.japanese }}</span>
@ -25,13 +25,13 @@
<span>{{ user.username }}</span> <img src="https://cdn.discordapp.com/avatars/{{ user.id }}/{{ user.avatar }}.webp?size=1024"> <span>{{ user.username }}</span> <img src="https://cdn.discordapp.com/avatars/{{ user.id }}/{{ user.avatar }}.webp?size=1024">
</a> </a>
<nav class="dropdown-content"> <nav class="dropdown-content">
<a href="/logout"> <a href="/logout" class="link">
<span>Log out</span> <span>Log out</span>
</a> </a>
</nav> </nav>
</div> </div>
{% else%} {% else%}
<a href="/login" class="right">Log in</a> <a href="/login" class="link right">Log in</a>
{% endif %} {% endif %}
<div class="dropdown"> <div class="dropdown">
<span class="link"> <span class="link">
@ -41,8 +41,9 @@
</span> </span>
<nav class="dropdown-content"> <nav class="dropdown-content">
{% set langs = 0 | langs %} {% set langs = 0 | langs %}
{% for lang in langs %} {% for other_lang in langs %}
<span class="link" onclick="document.cookie = 'lang={{ lang.code }}; expires=Tue, 19 Jan 2038 03:14:07 UTC; SameSite=Strict; path=/'; location.reload()">{{ lang.name }}</span> {% if other_lang.code in lang %}{% continue %}{% endif %}
<span class="link" onclick="document.cookie = 'lang={{ other_lang.code }}; expires=Tue, 19 Jan 2038 03:14:07 UTC; SameSite=Strict; path=/'; location.reload()">{{ other_lang.name }}</span>
{% endfor %} {% endfor %}
</nav> </nav>
</a> </a>

Loading…
Cancel
Save