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
};
match client
if let Err(error) = client
.post("https://discord.com/api/oauth2/token/revoke")
.header("Content-Type", "application/x-www-form-urlencoded")
.form(&params)
.send()
.await
{
Ok(_) => println!("Successfully revoked token"),
Err(error) => println!("Failed to revoke token: {:?}", error),
};
println!("Failed to revoke token: {:?}", error);
}
});
User::purge(cookies);
let redirect_url = referer.0.unwrap_or("/".to_owned());

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

@ -11,9 +11,9 @@
{% include "modal" %}
<div id="content">
<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">
<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 %}
<div>
<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">
</a>
<nav class="dropdown-content">
<a href="/logout">
<a href="/logout" class="link">
<span>Log out</span>
</a>
</nav>
</div>
{% else%}
<a href="/login" class="right">Log in</a>
<a href="/login" class="link right">Log in</a>
{% endif %}
<div class="dropdown">
<span class="link">
@ -41,8 +41,9 @@
</span>
<nav class="dropdown-content">
{% set langs = 0 | langs %}
{% for 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>
{% for other_lang in langs %}
{% 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 %}
</nav>
</a>

Loading…
Cancel
Save