game/info/
debug.rs

1use map_model::AreaID;
2use widgetry::{EventCtx, Line, Widget};
3
4use crate::app::App;
5use crate::info::{header_btns, make_table, Details};
6
7pub fn area(ctx: &EventCtx, app: &App, _: &mut Details, id: AreaID) -> Widget {
8    let header = Widget::row(vec![
9        Line(id.to_string()).small_heading().into_widget(ctx),
10        header_btns(ctx),
11    ]);
12
13    Widget::custom_col(vec![header, area_body(ctx, app, id).tab_body(ctx)])
14}
15
16fn area_body(ctx: &EventCtx, app: &App, id: AreaID) -> Widget {
17    let mut rows = vec![];
18    let area = app.primary.map.get_a(id);
19
20    if let Some(osm_id) = area.osm_id {
21        rows.push(
22            ctx.style()
23                .btn_outline
24                .text("Open in OSM")
25                .build_widget(ctx, format!("open {}", osm_id)),
26        );
27    }
28
29    rows.extend(make_table(
30        ctx,
31        area.osm_tags
32            .inner()
33            .iter()
34            .map(|(k, v)| (k.to_string(), v.to_string()))
35            .collect(),
36    ));
37
38    Widget::col(rows)
39}