diff options
Diffstat (limited to 'templates/src/templates.rs')
-rw-r--r-- | templates/src/templates.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/templates/src/templates.rs b/templates/src/templates.rs index 4f7970c..3d22eac 100644 --- a/templates/src/templates.rs +++ b/templates/src/templates.rs @@ -1,10 +1,9 @@ use http::StatusCode; use kittybox_util::MicropubChannel; - use crate::{Feed, VCard}; markup::define! { - Template<'a>(title: &'a str, blog_name: &'a str, feeds: Vec<MicropubChannel>, user: Option<String>, content: String) { + Template<'a>(title: &'a str, blog_name: &'a str, feeds: Vec<MicropubChannel>, user: Option<&'a kittybox_indieauth::ProfileUrl>, content: String) { @markup::doctype() html { head { @@ -41,12 +40,18 @@ markup::define! { li { a[href=&feed.uid] { @feed.name } } } li.shiftright { - @if user.is_none() { - a #login[href="/login/start"] { "Sign in" } - } else { + @if let Some(user) = &user { span { - @user.as_ref().unwrap() " - " a #logout[href="/logout"] { "Sign out" } + @if let Some(kittybox_indieauth::Profile { name: Some(name), photo, .. }) = &user.profile { + a[href=user.me.as_str()] { @name } + } else { + @user.me.as_str() + } + " - " + a #logout[href="/.kittybox/login/logout"] { "Sign out" } } + } else { + a #login[href="/.kittybox/login/start"] { "Sign in" } } } } |