use super::super::components::RootMarker; use crate::prelude::GameConfig; use crate::{features::inventory::ui::list_itemstack, prelude::*}; /// Spawns the inventory popup. pub fn open_inventory( commands: &mut Commands, items: Query<&ItemStack>, game_config: &Res, asset_server: &Res, ) { spawn_popup( commands, RootMarker::Inventory, "Inventar", Node::default(), |parent| { parent .spawn(Node { width: percent(100), margin: UiRect::top(px(10.0)), ..Node::vstack(px(10)) }) .with_children(|parent| { items .iter() .map(|item| list_itemstack(item, game_config, asset_server)) .for_each(|itemstack| { parent.spawn(itemstack); }); }); }, ); }