diff --git a/src/CraftSharp/Components/Crafting.razor b/src/CraftSharp/Components/Crafting.razor
index cd85a4b..6be0637 100644
--- a/src/CraftSharp/Components/Crafting.razor
+++ b/src/CraftSharp/Components/Crafting.razor
@@ -20,8 +20,15 @@
@Localizer["Result"]
-
diff --git a/src/CraftSharp/Components/Crafting.razor.cs b/src/CraftSharp/Components/Crafting.razor.cs
index 270c400..91b383b 100644
--- a/src/CraftSharp/Components/Crafting.razor.cs
+++ b/src/CraftSharp/Components/Crafting.razor.cs
@@ -18,6 +18,10 @@ namespace CraftSharp.Components
Actions.CollectionChanged += OnActionsCollectionChanged;
this.RecipeItems = new List
- { null, null, null, null, null, null, null, null, null };
}
+ public void Suppression()
+ {
+ StateHasChanged();
+ }
public ObservableCollection Actions { get; set; }
public Item CurrentDragItem { get; set; }
diff --git a/src/CraftSharp/Components/DeleteItem.razor b/src/CraftSharp/Components/DeleteItem.razor
new file mode 100644
index 0000000..8e5c16a
--- /dev/null
+++ b/src/CraftSharp/Components/DeleteItem.razor
@@ -0,0 +1,12 @@
+@using CraftSharp.Models
+
+
+
+
+

+
Delete
+
+
\ No newline at end of file
diff --git a/src/CraftSharp/Components/DeleteItem.razor.cs b/src/CraftSharp/Components/DeleteItem.razor.cs
new file mode 100644
index 0000000..eef1a83
--- /dev/null
+++ b/src/CraftSharp/Components/DeleteItem.razor.cs
@@ -0,0 +1,45 @@
+using CraftSharp.Components;
+using CraftSharp.Models;
+using CraftSharp.Services;
+using Microsoft.AspNetCore.Components;
+
+namespace CraftSharp.Components
+{
+ public partial class DeleteItem
+ {
+ [Parameter]
+ public int Index { get; set; }
+
+ [Parameter]
+ public Item Item { get; set; }
+
+ [Parameter]
+ public bool NoDrop { get; set; }
+
+ [CascadingParameter]
+ public Crafting Parent { get; set; }
+
+ [Inject]
+ public CustomStateProvider AuthStateProvider { get; set; }
+
+ internal void OnDrop()
+ {
+ if (NoDrop)
+ {
+ return;
+ }
+
+ this.Item = Parent.CurrentDragItem;
+
+ if (AuthStateProvider.GetCurrentUser().Inventory.Any(n => n.Id == this.Item.Id))
+ {
+ AuthStateProvider.GetCurrentUser().DeleteItem(this.Item);
+ this.Item = null;
+ Parent.Suppression();
+ }
+
+ }
+
+
+ }
+}
diff --git a/src/CraftSharp/Components/DeleteItem.razor.css b/src/CraftSharp/Components/DeleteItem.razor.css
new file mode 100644
index 0000000..4f13b5f
--- /dev/null
+++ b/src/CraftSharp/Components/DeleteItem.razor.css
@@ -0,0 +1,19 @@
+.item {
+ width: 64px;
+ height: 64px;
+ border: 1px solid;
+ overflow: hidden;
+ position: relative;
+}
+
+
+
+p {
+ position: absolute;
+ top: 0;
+ color: red;
+ text-align: center;
+ background-color: rgba(0, 0, 0, .4);
+ width: 64px;
+ font-size: .75em;
+}
diff --git a/src/CraftSharp/Models/CurrentUser.cs b/src/CraftSharp/Models/CurrentUser.cs
index 360c27a..ede2f04 100644
--- a/src/CraftSharp/Models/CurrentUser.cs
+++ b/src/CraftSharp/Models/CurrentUser.cs
@@ -14,7 +14,10 @@
{
Inventory.Add(item);
}
-
+ public void DeleteItem(Item item)
+ {
+ Inventory.Remove(item);
+ }
public int getSizeInventory()
{
return Inventory.Count;
diff --git a/src/CraftSharp/wwwroot/Images/Trash.png b/src/CraftSharp/wwwroot/Images/Trash.png
new file mode 100644
index 0000000..7bcb616
Binary files /dev/null and b/src/CraftSharp/wwwroot/Images/Trash.png differ