31 lines
991 B
Rust
31 lines
991 B
Rust
use seed::{prelude::*, *};
|
|
|
|
use crate::{
|
|
state::{Context, Model, Msg},
|
|
view::{self, view_header, view_search_results},
|
|
};
|
|
|
|
pub(super) fn view(model: &Model) -> Node<Msg> {
|
|
// Do two queries, one without `unread` so it loads fast, then a second with unread.
|
|
let content = match &model.context {
|
|
Context::None => div![h1!["Loading"]],
|
|
Context::Thread(_) => unimplemented!("tablet legacy thread view"),
|
|
Context::ThreadResult(thread) => view::thread(thread),
|
|
Context::Search(_) => unimplemented!("tablet legacy search results view"),
|
|
Context::SearchResult {
|
|
query,
|
|
results,
|
|
count,
|
|
pager,
|
|
} => view_search_results(&query, results.as_slice(), *count, pager),
|
|
};
|
|
div![
|
|
C!["main-content"],
|
|
div![
|
|
view_header(&model.query, &model.refreshing_state),
|
|
content,
|
|
view_header(&model.query, &model.refreshing_state),
|
|
]
|
|
]
|
|
}
|