Ui/Inventory/InventorySelectUi.razor
@using Clover.Inventory
@using Clover.Player
@using Sandbox;
@using Sandbox.UI;
@inherits PanelComponent
@namespace Clover.Ui

@if ( Inventory == null )
{
	return;
}

<root>
	<div class="modal-background blurry"></div>
	<div class="inventory-window">
		<div class="select-items">
			@foreach ( var slot in Inventory.QuerySlots().OrderBy( x => x.Slot?.GetName() ) )
			{
				@if ( slot.HasSlot )
				{
					<div class="select-item @( _selectedItemIndexes.Contains( slot.Index ) ? "selected" : "" )" @onclick=@( () => ToggleItem( slot.Index ) )>
						<Image class="icon" [email protected]()/>
						<div class="name">@slot.Slot.GetName()</div>
					</div>
				}
			}
		</div>
		<div class="buttons">
			<button class="clover-button @( _selectedItemIndexes.Count == 0 ? "disabled" : "" )" @onclick=@Select>
				Select
			</button>
			<button class="clover-button" @onclick=@Cancel>
				Cancel
			</button>
			<div>
				@( $"{_selectedItemIndexes.Count} / {MaxItems} selected" )
			</div>
		</div>
	</div>
</root>