aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/home.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes/ui/home.rs')
-rw-r--r--server/src/routes/ui/home.rs23
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" }
},