Skip to content

Commit

Permalink
Adding a small message in case no Shotspotter or violence data is ava…
Browse files Browse the repository at this point in the history
…ilable
  • Loading branch information
JosephLai241 committed Jan 21, 2024
1 parent f00d264 commit f8770da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/src/pages/violence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,13 @@ fn render_map(chicago_map_data: ChicagoMapData) -> Result<(VNode, VNode, VNode),
} else {
error!("FAILED TO GET SHOTSPOTTER AND VHNFS DATA FROM SHOTSPOTTER_DATA STRUCT");

// TODO: RETURN SOME SORT OF ERROR HTML HERE INSTEAD OF JUST LOGGING THE ERROR.
let error_div = gloo_utils::document()
.create_element("div")?
.dyn_into::<HtmlElement>()?;
error_div.set_inner_html("<b>no shotspotter or violence data available!</b>");

let _ = date_container.append_child(&error_div);
let _ = tables_container.append_child(&error_div);
}

let map_node: &Node = &date_container.clone().into();
Expand Down

0 comments on commit f8770da

Please sign in to comment.