diff options
author | metamuffin <metamuffin@disroot.org> | 2023-12-15 23:47:26 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-12-15 23:47:26 +0100 |
commit | 21b58037c69798e922c5512ea5380943781558ff (patch) | |
tree | 884b82ff80f37183c9775b7c468e6f6fb6da7614 /server/src/routes/ui/home.rs | |
parent | 69041b4a9de26719254ea4eff5555a079d5e7d55 (diff) | |
download | jellything-21b58037c69798e922c5512ea5380943781558ff.tar jellything-21b58037c69798e922c5512ea5380943781558ff.tar.bz2 jellything-21b58037c69798e922c5512ea5380943781558ff.tar.zst |
continue watching draft
Diffstat (limited to 'server/src/routes/ui/home.rs')
-rw-r--r-- | server/src/routes/ui/home.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/server/src/routes/ui/home.rs b/server/src/routes/ui/home.rs index 4ba3fc3..3f1f0d0 100644 --- a/server/src/routes/ui/home.rs +++ b/server/src/routes/ui/home.rs @@ -59,6 +59,22 @@ pub fn r_home(sess: Session, db: &State<Database>) -> MyResult<DynLayoutPage> { .map(|k| k.to_owned()) .collect::<Vec<_>>(); + let continue_watching = db + .user_progess + .get(&sess.user.name)? + .unwrap_or_default() + .into_iter() + .map(|(n, p)| { + Ok(( + n.clone(), + db.node.get(&n)?.context("child does not exist")?.public, + p, + )) + }) + .collect::<anyhow::Result<Vec<_>>>()? + .into_iter() + .collect::<Vec<_>>(); + Ok(LayoutPage { title: "Home".to_string(), content: markup::new! { @@ -67,6 +83,12 @@ pub fn r_home(sess: Session, db: &State<Database>) -> MyResult<DynLayoutPage> { .homelist { ul {@for (id, node) in &toplevel { li { @NodeCard { id, node } } }}} + @if !continue_watching.is_empty() { + h2 { "Continue Watching" } + .homelist { ul {@for (id, node, _p) in &continue_watching { + li { @NodeCard { id, node } } + }}} + } h2 { "Latest Releases" } .homelist { ul {@for (id, node) in &latest { li { @NodeCard { id, node } } @@ -75,7 +97,6 @@ pub fn r_home(sess: Session, db: &State<Database>) -> MyResult<DynLayoutPage> { .homelist { ul {@for (id, node) in &random { li { @NodeCard { id, node } } }}} - p.error { "TODO: continue watching" } p.error { "TODO: recently added" } p.error { "TODO: best rating" } }, |