Compare commits
4 Commits
server-sid
...
c3f897c61a
| Author | SHA1 | Date | |
|---|---|---|---|
| c3f897c61a | |||
| c62bac037f | |||
| 79a57f3082 | |||
| c33de9d754 |
1405
Cargo.lock
generated
1405
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
|
resolver = "2"
|
||||||
members = [
|
members = [
|
||||||
"web",
|
"web",
|
||||||
"server",
|
"server",
|
||||||
|
|||||||
@@ -22,9 +22,10 @@ const SEARCH_RESULTS_PER_PAGE: usize = 20;
|
|||||||
|
|
||||||
// `init` describes what should happen when your app started.
|
// `init` describes what should happen when your app started.
|
||||||
fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
|
fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
|
||||||
orders
|
if url.hash().is_none() {
|
||||||
.subscribe(on_url_changed)
|
orders.request_url(urls::search("is:unread", 0));
|
||||||
.notify(subs::UrlChanged(url.clone()));
|
};
|
||||||
|
orders.subscribe(on_url_changed);
|
||||||
|
|
||||||
Model {
|
Model {
|
||||||
context: Context::None,
|
context: Context::None,
|
||||||
@@ -119,6 +120,9 @@ enum RefreshingState {
|
|||||||
// `Msg` describes the different events you can modify state with.
|
// `Msg` describes the different events you can modify state with.
|
||||||
enum Msg {
|
enum Msg {
|
||||||
Noop,
|
Noop,
|
||||||
|
// Tell the client to refresh its state
|
||||||
|
Reload,
|
||||||
|
// Tell the server to update state
|
||||||
RefreshStart,
|
RefreshStart,
|
||||||
RefreshDone(Option<FetchError>),
|
RefreshDone(Option<FetchError>),
|
||||||
SearchRequest {
|
SearchRequest {
|
||||||
@@ -149,6 +153,10 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
} else {
|
} else {
|
||||||
RefreshingState::None
|
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 {
|
Msg::SearchRequest {
|
||||||
@@ -576,12 +584,8 @@ fn view_search_pager(start: usize, count: usize, total: usize) -> Node<Msg> {
|
|||||||
nav![
|
nav![
|
||||||
C!["pagination"],
|
C!["pagination"],
|
||||||
a![
|
a![
|
||||||
C![
|
C!["pagination-previous", "button",],
|
||||||
"pagination-previous",
|
IF!(is_first => attrs!{ At::Disabled=>true }),
|
||||||
"button",
|
|
||||||
IF!(is_first => "is-static"),
|
|
||||||
IF!(is_first => "is-info"),
|
|
||||||
],
|
|
||||||
"<",
|
"<",
|
||||||
ev(Ev::Click, |_| Msg::PreviousPage)
|
ev(Ev::Click, |_| Msg::PreviousPage)
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user