diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-27 20:56:20 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-27 20:56:20 +0100 |
| commit | 7930d543a2aa68d4ad2958605827d7eb1baa91f8 (patch) | |
| tree | fe59d1f549e303a96b78d3e925d75abb70b73af0 /ui/src/components/node_card.rs | |
| parent | c05bfcc2775f0e11db6e856bfcf06d0419c35d54 (diff) | |
| download | jellything-7930d543a2aa68d4ad2958605827d7eb1baa91f8.tar jellything-7930d543a2aa68d4ad2958605827d7eb1baa91f8.tar.bz2 jellything-7930d543a2aa68d4ad2958605827d7eb1baa91f8.tar.zst | |
reimplement Object as slice type
Diffstat (limited to 'ui/src/components/node_card.rs')
| -rw-r--r-- | ui/src/components/node_card.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ui/src/components/node_card.rs b/ui/src/components/node_card.rs index e1baec1..2f5bae7 100644 --- a/ui/src/components/node_card.rs +++ b/ui/src/components/node_card.rs @@ -9,16 +9,16 @@ use crate::{ components::{node_page::aspect_class, props::Props}, }; use jellycommon::{ - jellyobject::Object, + jellyobject::{EMPTY, Object}, routes::{u_image, u_image_fallback_person, u_node_slug, u_node_slug_player}, *, }; markup::define! { NodeCard<'a>(ri: &'a RenderInfo<'a>, nku: &'a Nku<'a>) { - @let node = nku.node; + @let node = &nku.node; @let slug = node.get(NO_SLUG).unwrap_or_default(); - div[class=&format!("card {}", aspect_class(node))] { + div[class=&format!("card {}", aspect_class(&node))] { .poster { a[href=u_node_slug(&slug)] { img[src=cover_image(&node, 512), loading="lazy"]; @@ -44,7 +44,7 @@ markup::define! { } NodeCardWide<'a>(ri: &'a RenderInfo<'a>, nku: Nku<'a>) { - @let node = nku.node; + @let node = &nku.node; @let slug = node.get(NO_SLUG).unwrap_or_default(); div[class="card wide"] { div[class=&format!("poster {}", aspect_class(node))] { @@ -66,9 +66,9 @@ markup::define! { } NodeCardHightlight<'a>(ri: &'a RenderInfo<'a>, nku: &'a Nku<'a>) { - @let node = nku.node; + @let node = &nku.node; @let slug = node.get(NO_SLUG).unwrap_or_default(); - @let backdrop = u_image(node.get(NO_PICTURES).unwrap_or_default().get(PICT_BACKDROP).unwrap_or_default(), 2048); + @let backdrop = u_image(node.get(NO_PICTURES).unwrap_or(EMPTY).get(PICT_BACKDROP).unwrap_or_default(), 2048); div[class="card highlight", style=format!("background-image: url(\"{backdrop}\")")] { .inner { div.overview { @@ -92,7 +92,7 @@ markup::define! { } fn cover_image(node: &Object, size: usize) -> String { - if let Some(cover) = node.get(NO_PICTURES).unwrap_or_default().get(PICT_COVER) { + if let Some(cover) = node.get(NO_PICTURES).unwrap_or(EMPTY).get(PICT_COVER) { return u_image(cover, size); } if let Some(title) = node.get(NO_TITLE) |