Compare commits

...

4 Commits

Author SHA1 Message Date
c3f897c61a Fix pagination and default homepage to unread search. 2023-08-11 16:51:41 -07:00
c62bac037f Reload page on refresh 2023-08-11 14:06:47 -07:00
79a57f3082 Address workspace lint 2023-08-11 13:55:39 -07:00
c33de9d754 cargo update 2023-07-15 16:58:40 -07:00
3 changed files with 639 additions and 789 deletions

1405
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"web",
"server",

View File

@@ -22,9 +22,10 @@ const SEARCH_RESULTS_PER_PAGE: usize = 20;
// `init` describes what should happen when your app started.
fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
orders
.subscribe(on_url_changed)
.notify(subs::UrlChanged(url.clone()));
if url.hash().is_none() {
orders.request_url(urls::search("is:unread", 0));
};
orders.subscribe(on_url_changed);
Model {
context: Context::None,
@@ -119,6 +120,9 @@ enum RefreshingState {
// `Msg` describes the different events you can modify state with.
enum Msg {
Noop,
// Tell the client to refresh its state
Reload,
// Tell the server to update state
RefreshStart,
RefreshDone(Option<FetchError>),
SearchRequest {
@@ -149,6 +153,10 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
} else {
RefreshingState::None
};
orders.perform_cmd(async move { Msg::Reload });
}
Msg::Reload => {
orders.perform_cmd(async move { on_url_changed(subs::UrlChanged(Url::current())) });
}
Msg::SearchRequest {
@@ -576,12 +584,8 @@ fn view_search_pager(start: usize, count: usize, total: usize) -> Node<Msg> {
nav![
C!["pagination"],
a![
C![
"pagination-previous",
"button",
IF!(is_first => "is-static"),
IF!(is_first => "is-info"),
],
C!["pagination-previous", "button",],
IF!(is_first => attrs!{ At::Disabled=>true }),
"<",
ev(Ev::Click, |_| Msg::PreviousPage)
],