Skip to content

Commit

Permalink
feat(fe/classroom/codes): Added find-answer / answer-this
Browse files Browse the repository at this point in the history
  • Loading branch information
MendyBerger committed Mar 12, 2024
1 parent 8d09cc8 commit dabfc21
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ impl CodeSessions {
dom
.child(super::modules::drag_drop::render_drag_drop(&module.content.clone().unwrap(), &session))
},
(ModuleBody::FindAnswer(module), JigPlaySessionModule::FindAnswer(session)) => {
dom
.child(super::modules::find_answer::render_find_answer(&module.content.clone().unwrap(), &session))
},
_ => dom
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use dominator::{html, Dom};
use shared::domain::{jig::codes::JigPlaySessionFindAnswer, module::body::find_answer};
pub fn render_find_answer(
module: &find_answer::Content,
session: &JigPlaySessionFindAnswer,
) -> Dom {
html!("div", {
.children(
session.items.iter().enumerate().map(|(index, item)| {
html!("div", {
.class("wrapper")
.child(
html!("div", {
.class("item")
.child(html!("div", {
.apply(|dom| {
match &module.questions.get(index) {
Some(question) => dom.text(&question.question_text),
None => dom.text("?"),
}

})
}))
.child(html!("p", {
.text("Tries ")
.child(html!("strong", {
.text(&(item.failed_tries + 1).to_string())
}))
}))
})
)
})
})
)
})
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod card_quiz;
pub mod drag_drop;
pub mod find_answer;
pub mod matching;

0 comments on commit dabfc21

Please sign in to comment.