From af99c406af8ee47bee38708cf23e86af826e41ba Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 16 Dec 2023 01:08:15 +0100 Subject: watch progress and some draft ui --- server/src/routes/ui/browser.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'server/src/routes/ui/browser.rs') diff --git a/server/src/routes/ui/browser.rs b/server/src/routes/ui/browser.rs index d2c24bc..509f242 100644 --- a/server/src/routes/ui/browser.rs +++ b/server/src/routes/ui/browser.rs @@ -12,7 +12,7 @@ use super::{ }; use crate::{database::Database, uri}; use anyhow::Context; -use jellycommon::NodePublic; +use jellycommon::{user::NodeUserData, NodePublic}; use rocket::{get, State}; /// This function is a stub and only useful for use in the uri! macro. @@ -21,7 +21,7 @@ pub fn r_all_items() {} #[get("/items?&")] pub fn r_all_items_filter( - _sess: Session, + sess: Session, db: &State, page: Option, filter: NodeFilterSort, @@ -29,11 +29,18 @@ pub fn r_all_items_filter( let mut items = db .node .iter() - .map(|e| e.context("listing")) + .map(|e| { + let (i, n) = e.context("listing")?; + let u = db + .user_node + .get(&(sess.user.name.clone(), i.clone()))? + .unwrap_or_default(); + Ok((i, n, u)) + }) .collect::>>()? .into_iter() - .map(|(k, n)| (k, n.public)) - .collect::>(); + .map(|(k, n, u)| (k, n.public, u)) + .collect::>(); filter_and_sort_nodes(&filter, &mut items); @@ -50,8 +57,8 @@ pub fn r_all_items_filter( .page.dir { h1 { "All Items" } @NodeFilterSortForm { f: &filter } - ul.children { @for (id, node) in &items[from..to] { - li {@NodeCard { id, node: &node }} + ul.children { @for (id, node, udata) in &items[from..to] { + li {@NodeCard { id, node, udata }} }} p.pagecontrols { span.current { "Page " @{page + 1} " of " @max_page " " } -- cgit v1.2.3-70-g09d2