From d6793f79bae14ecd97667fdae9bf358cfc689d8c Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Sat, 4 Apr 2020 01:55:45 -0400 Subject: [PATCH] Share functionality enabled. --- scripts/system/inventory/inventory.html | 106 +++++++++++++++++++++--- 1 file changed, 95 insertions(+), 11 deletions(-) diff --git a/scripts/system/inventory/inventory.html b/scripts/system/inventory/inventory.html index 60e2be579f..01a77eff9e 100644 --- a/scripts/system/inventory/inventory.html +++ b/scripts/system/inventory/inventory.html @@ -122,7 +122,7 @@ Share @@ -308,7 +308,7 @@ @@ -349,6 +349,62 @@ + + + + Share Item + + + Select a user to send this item to. + + + + + + + + + + + + + + + + + + Cancel + + + + + + Send + + + + + @@ -455,6 +511,27 @@ new Vue({ "url": null, }, }, + shareDialog: { + show: false, + data: { + "url": null, // The item you want to share. + "recipient": null, + } + }, + nearbyUsers: [ + { + name: "Who", + uuid: "{4131531653652562}", + }, + { + name: "Is", + uuid: "{4131531653756756576543652562}", + }, + { + name: "This?", + uuid: "{4131531676575653652562}", + }, + ], sortBy: "alphabetical", darkTheme: true, drawer: false, @@ -513,6 +590,9 @@ new Vue({ }; this.items.push(itemToPush); + + this.addDialog.data.name = null; + this.addDialog.data.url = null; }, removeItem: function(url) { for (i = 0; i < this.items.length; i++) { @@ -541,8 +621,11 @@ new Vue({ } }, - shareItem: function(url) { - + shareItem: function() { + this.sendAppMessage("share-item", { + "url": this.shareDialog.data.url, + "recipient": this.nearbyUsers[this.shareDialog.data.recipient].uuid, + }); }, acceptItem: function() { var itemToPush = @@ -563,6 +646,12 @@ new Vue({ }, receiveInventory: function() { + }, + displayIcon: function(itemType) { + return this.iconType[itemType].icon; + }, + getIconColor: function(itemType) { + return this.iconType[itemType].color; }, sendAppMessage: function(command, data) { var JSONtoSend = { @@ -571,14 +660,9 @@ new Vue({ "data": data }; - EventBridge.emitWebEvent(JSON.stringify(JSONtoSend)); + alert(JSON.stringify(JSONtoSend)); + // EventBridge.emitWebEvent(JSON.stringify(JSONtoSend)); }, - displayIcon: function(itemType) { - return this.iconType[itemType].icon; - }, - getIconColor: function(itemType) { - return this.iconType[itemType].color; - } }, computed: {