From 84d5aa39cfe6edfaa2e49e14997e1f1a674d55e5 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 31 Jan 2021 18:01:57 -0600 Subject: [PATCH] Server: Improve notification page styling --- scss/layout.scss | 20 ++++++++++ src/main.rs | 2 +- src/notifications.rs | 19 ++++++---- templates/bar.rs.html | 2 +- templates/notifications/index.rs.html | 54 +++++++++++++++------------ translations/en-US/hyaenidae.ftl | 2 +- 6 files changed, 64 insertions(+), 35 deletions(-) diff --git a/scss/layout.scss b/scss/layout.scss index 3bb3b03..959542a 100644 --- a/scss/layout.scss +++ b/scss/layout.scss @@ -108,6 +108,18 @@ picture { padding: 80px 0 32px; } +.notification { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + flex-wrap: wrap; + + .button-section { + padding: 0; + } +} + .tabs { padding: 0 12px; overflow-x: auto; @@ -336,6 +348,14 @@ picture { padding: 0; } + .notification { + display: block; + + .button-section { + padding: 8px 0; + } + } + .profile-search { padding: 0 8px; } diff --git a/src/main.rs b/src/main.rs index 94c857a..43c0ac2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,7 +50,7 @@ async fn main() -> anyhow::Result<()> { if std::env::var("RUST_LOG").is_err() { if config.debug { - std::env::set_var("RUST_LOG", "hyaenidae_content=debug,hyaenidae_profiles=debug,hyaenidae_accounts=debug,hyaenidae_toolkit=debug,hyaenidae_server=debug,info"); + std::env::set_var("RUST_LOG", "hyaenidae_content=debug,hyaenidae_profiles=debug,hyaenidae_accounts=debug,hyaenidae_toolkit=debug,hyaenidae=debug,info"); } else { std::env::set_var("RUST_LOG", "info"); } diff --git a/src/notifications.rs b/src/notifications.rs index a795801..487ec1b 100644 --- a/src/notifications.rs +++ b/src/notifications.rs @@ -475,18 +475,21 @@ impl NotificationsView { .for_profile(profile_id) { if let Some(follow_req) = store.store.view.follow_requests.by_id(fr_id)? { - if !view.profile_hm.contains_key(&follow_req.right) { + let icon = if let Some(profile) = view.profile_hm.get(&follow_req.right) { + profile.icon() + } else { let profile = store.store.profiles.by_id(follow_req.right)?.req()?; + let icon = profile.icon(); + view.profile_hm.insert(profile.id(), profile); + icon + }; - if let Some(file_id) = profile.icon() { - if !view.file_hm.contains_key(&file_id) { - if let Some(file) = store.store.files.by_id(file_id)? { - view.file_hm.insert(file.id(), file); - } + if let Some(file_id) = icon { + if !view.file_hm.contains_key(&file_id) { + if let Some(file) = store.store.files.by_id(file_id)? { + view.file_hm.insert(file.id(), file); } } - - view.profile_hm.insert(profile.id(), profile); } view.fr_profile_hm.insert(follow_req.id, follow_req.right); diff --git a/templates/bar.rs.html b/templates/bar.rs.html index 4cbed18..a71c13c 100644 --- a/templates/bar.rs.html +++ b/templates/bar.rs.html @@ -23,7 +23,7 @@ @if nav_state.has_notifications() { diff --git a/templates/notifications/index.rs.html b/templates/notifications/index.rs.html index b919d5a..7a2f7cd 100644 --- a/templates/notifications/index.rs.html +++ b/templates/notifications/index.rs.html @@ -32,12 +32,14 @@ @:card_title({ Follow Requests }) @for fr in view.follow_requests() { @:card_body({ - @:profile_box(loader, &fr.view(), None, nav_state.dark(), {}) -
- @:button_group(&[ - fr.accept_button(loader), - fr.reject_button(loader), - ]) +
+ @:profile_box(loader, &fr.view(), None, nav_state.dark(), {}) +
+ @:button_group(&[ + fr.accept_button(loader), + fr.reject_button(loader), + ]) +
}) } @@ -56,24 +58,28 @@ }) @for c in view.comments() { @:card_body({ - @:link(&c.author_link(), { - @Html(c.author_name()) - }) - @if let Some(l) = c.submission_link() { - @fl!(loader, "notification-commented") - @:link(&l, { @Html(c.submission_title()) }) - } - @if let Some(l) = c.reply_to_link() { - @fl!(loader, "notification-replied") - @:link(&l, { - @fl!(loader, "notification-comment-comment") - }) - } -
- @:button_group(&[ - c.view_button(loader), - c.remove_button(loader), - ]) +
+
+ @:link(&c.author_link(), { + @Html(c.author_name()) + }) + @if let Some(l) = c.submission_link() { + @fl!(loader, "notification-commented") + @:link(&l, { @Html(c.submission_title()) }) + } + @if let Some(l) = c.reply_to_link() { + @fl!(loader, "notification-replied") + @:link(&l, { + @fl!(loader, "notification-comment-comment") + }) + } +
+
+ @:button_group(&[ + c.view_button(loader), + c.remove_button(loader), + ]) +
}) } diff --git a/translations/en-US/hyaenidae.ftl b/translations/en-US/hyaenidae.ftl index 6cf8eae..cbc7c90 100644 --- a/translations/en-US/hyaenidae.ftl +++ b/translations/en-US/hyaenidae.ftl @@ -234,7 +234,7 @@ post-date-years-small = {$years}y post-date-now = posted now post-date-seconds = {$seconds -> [one] posted one second ago - *[other] posted ${seconds} seconds ago + *[other] posted {$seconds} seconds ago } post-date-minutes = {$minutes -> [one] posted one minute ago