diff --git a/ultros-frontend/ultros-app/src/components/live_sale_ticker.rs b/ultros-frontend/ultros-app/src/components/live_sale_ticker.rs index 781bfba1..802e7449 100644 --- a/ultros-frontend/ultros-app/src/components/live_sale_ticker.rs +++ b/ultros-frontend/ultros-app/src/components/live_sale_ticker.rs @@ -46,7 +46,6 @@ pub fn LiveSaleTicker() -> impl IntoView { if let Some(sale) = hw_1.map(|h| ultros_api_types::world_helper::AnySelector::World(h.id)) { - log::info!("live sale"); live_sales(sales, sale).await.unwrap(); } }); diff --git a/ultros-frontend/ultros-app/src/components/price_history_chart.rs b/ultros-frontend/ultros-app/src/components/price_history_chart.rs index 17021d97..85f13b57 100644 --- a/ultros-frontend/ultros-app/src/components/price_history_chart.rs +++ b/ultros-frontend/ultros-app/src/components/price_history_chart.rs @@ -9,6 +9,7 @@ use ultros_api_types::SaleHistory; use ultros_charts::draw_sale_history_scatter_plot; use ultros_charts::ChartOptions; +use crate::components::skeleton::BoxSkeleton; use crate::{components::toggle::Toggle, global_state::LocalWorldData}; #[component] @@ -38,6 +39,9 @@ pub fn PriceHistoryChart(sales: MaybeSignal>) -> impl IntoView } }); view! { +
+ +
impl IntoView { let params = use_params_map(); let world = create_memo(move |_| params.with(|p| p.get("world").cloned()).unwrap_or_default()); - let sales = create_local_resource( + let sales = create_resource( move || params.with(|p| p.get("world").cloned()), move |world| async move { get_recent_sales_for_world(&world.ok_or(AppError::ParamMissing)?).await }, ); - let world_cheapest_listings = create_local_resource( + let world_cheapest_listings = create_resource( move || params.with(|p| p.get("world").cloned()), move |world| async move { let world = world.ok_or(AppError::ParamMissing)?; @@ -423,7 +423,7 @@ pub fn AnalyzerWorldView() -> impl IntoView { .0 .unwrap(); let worlds_value = store_value(worlds); - let global_cheapest_listings = create_local_resource( + let global_cheapest_listings = create_resource( move || params.with(|p| p.get("world").cloned()), move |world| async move { let worlds = worlds_value(); @@ -460,6 +460,8 @@ pub fn AnalyzerWorldView() -> impl IntoView {
+
+ {move || { let world_cheapest = world_cheapest_listings.get(); let sales = sales.get(); @@ -469,10 +471,17 @@ pub fn AnalyzerWorldView() -> impl IntoView { .and_then(|w| w.ok()) .and_then(|r| sales.and_then(|s| s.ok()) .and_then(|s| global_cheapest_listings.and_then(|g| g.ok()).map(|g| (r, s, g)))); - values.map(|(world_cheapest_listings, sales, global_cheapest_listings)| { - view!{ - } } - )}} + match values { + Some((world_cheapest_listings, sales, global_cheapest_listings)) => {view!{}.into_view()}, + None => {view!{ +
+ "Failed to load analyzer - try again in 30 seconds" +
+ }.into_view()} + } + }} +
+
}.into_view() } diff --git a/ultros-frontend/ultros-app/src/routes/item_view.rs b/ultros-frontend/ultros-app/src/routes/item_view.rs index 421b36bf..5eb5eed0 100644 --- a/ultros-frontend/ultros-app/src/routes/item_view.rs +++ b/ultros-frontend/ultros-app/src/routes/item_view.rs @@ -106,13 +106,13 @@ fn ListingsContent(item_id: Memo, world: Memo) -> impl IntoView { view! {
+
}> {move || { let sales = create_memo(move |_| listing_resource.with(|l| l.as_ref().and_then(|l| l.as_ref().map(|l| l.sales.clone()).ok())).unwrap_or_default()); - view!{
+ view!{
} }} @@ -120,7 +120,7 @@ fn ListingsContent(item_id: Memo, world: Memo) -> impl IntoView {
+
}> @@ -135,7 +135,7 @@ fn ListingsContent(item_id: Memo, world: Memo) -> impl IntoView {
+
}> @@ -150,7 +150,7 @@ fn ListingsContent(item_id: Memo, world: Memo) -> impl IntoView {
+
}> diff --git a/ultros-frontend/ultros-app/src/ws/live_data.rs b/ultros-frontend/ultros-app/src/ws/live_data.rs index be518794..347bbc7d 100644 --- a/ultros-frontend/ultros-app/src/ws/live_data.rs +++ b/ultros-frontend/ultros-app/src/ws/live_data.rs @@ -16,9 +16,6 @@ pub(crate) async fn live_sales( signal: RwSignal>, price_zone: AnySelector, ) -> Result<(), AppError> { - use log::info; - - log::info!("CONNECTING TO SALES!"); // TODO - better way to switch to wss #[cfg(debug_assertions)] let url = "ws://localhost:8080/api/v1/realtime/events"; @@ -39,7 +36,6 @@ pub(crate) async fn live_sales( Ok(o) => match o { Message::Text(o) => { if let Ok(val) = serde_json::from_str::(&o) { - info!("{val:?}"); match val { ServerClient::Sales(sig) => match sig { EventType::Added(add) => { @@ -65,13 +61,12 @@ pub(crate) async fn live_sales( }) .is_none() { - info!("Socket closed"); return Ok(()); } } _ => {} }, - ServerClient::Listings(l) => log::info!("Listings {l:?}"), + ServerClient::Listings(l) => {} ServerClient::SubscriptionCreated => { log::info!("Subscription created"); }