snooze: add UI elements and DB for snooze functionality

This commit is contained in:
2025-07-13 08:53:50 -07:00
parent 52b19365d7
commit 90ac9a1e43
11 changed files with 210 additions and 67 deletions

View File

@@ -260,8 +260,28 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
Msg::GoToSearchResults
});
}
Msg::Snooze(message_id, snooze_time) => {
info!("TODO: Snoozing {message_id} until {snooze_time}");
Msg::Snooze(query, wake_time) => {
let is_catchup = model.catchup.is_some();
orders.skip().perform_cmd(async move {
let res: Result<
graphql_client::Response<graphql::snooze_mutation::ResponseData>,
gloo_net::Error,
> = send_graphql(graphql::SnoozeMutation::build_query(
graphql::snooze_mutation::Variables {
query: query.clone(),
wake_time,
},
))
.await;
if let Err(e) = res {
error!("Failed to snooze {query} until {wake_time}: {e}");
}
if is_catchup {
Msg::CatchupMarkAsRead
} else {
Msg::GoToSearchResults
}
});
}
Msg::FrontPageRequest {