Minor cleanups and debugging.

This commit is contained in:
Bill Thiede 2022-11-17 18:45:26 -08:00
parent 1a2b7dfc89
commit ce3c027e9a

View File

@ -12,7 +12,9 @@ use seed::{prelude::*, *};
// ------ ------
// `init` describes what should happen when your app started.
fn init(_: Url, orders: &mut impl Orders<Msg>) -> Model {
fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
log!(url);
orders.subscribe(|_: subs::UrlChanged| info!("url changed!"));
orders
.skip()
.perform_cmd(async { Msg::SearchResult(search_request("*").await) });
@ -164,7 +166,7 @@ fn view_body(body: &[Part]) -> Node<Msg> {
fn view_text_plain(content: &Option<Content>) -> Node<Msg> {
match &content {
Some(Content::String(content)) => p![C!["text_plain"], content],
Some(Content::String(content)) => p![C!["view-part-text-plain"], content],
_ => div![
C!["error"],
format!("Unhandled content enum for text/plain"),
@ -177,7 +179,11 @@ fn view_part(part: &Part) -> Node<Msg> {
"text/plain" => view_text_plain(&part.content),
"text/html" => {
if let Some(Content::String(html)) = &part.content {
return div![Node::from_html(None, &html)];
return div![
C!["view-part-text-html"],
div!["TEST"],
iframe![Node::from_html(None, &html)]
];
} else {
div![
C!["error"],
@ -285,23 +291,6 @@ fn view(model: &Model) -> Node<Msg> {
"Original"
],
view_message(&thread_node),
/*
show_results
.0
.iter()
.enumerate()
.map(|(thread_idx, thread)| div![
h2![format!("thread {}", thread_idx)],
thread
.0
.iter()
.enumerate()
.map(|(thread_node_idx, thread_node)| div![
h3![format!("thread node {}", thread_node_idx)],
view_message(thread_node)
])
]),
*/
pre!["Add zippy for debug dump"] /* pre![format!("Thread: {:#?}", show_results).replace(" ", " ")] */
]
} else if let Some(search_results) = &model.search_results {