From 9a3db763e27bd06d78cfbd597551b8242b799bae Mon Sep 17 00:00:00 2001 From: liamcottle Date: Wed, 18 Dec 2024 01:19:45 +1300 Subject: [PATCH] show if user has incoming file transfers from node when viewing conversation --- src/components/pages/NodeMessagesPage.vue | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/components/pages/NodeMessagesPage.vue b/src/components/pages/NodeMessagesPage.vue index 9f6c69b..eeeaf46 100644 --- a/src/components/pages/NodeMessagesPage.vue +++ b/src/components/pages/NodeMessagesPage.vue @@ -37,6 +37,18 @@ + +
+
You have {{ offeredFilesCount }} incoming file {{ offeredFilesCount === 1 ? 'transfer' : 'transfers' }}
+
+ + + +
+
+
@@ -53,10 +65,13 @@ import NodeIcon from "../nodes/NodeIcon.vue"; import Page from "./Page.vue"; import NodeUtils from "../../js/NodeUtils.js"; import NodeDropDownMenu from "../nodes/NodeDropDownMenu.vue"; +import TextButton from "../TextButton.vue"; +import FileTransferrer from "../../js/FileTransferrer.js"; export default { name: 'NodeMessagesPage', components: { + TextButton, NodeDropDownMenu, Page, NodeIcon, @@ -102,6 +117,14 @@ export default { subtitle() { return this.node ? this.getNodeLongName(this.node.num) : "Unknown Node"; }, + offeredFilesCount() { + return this.node ? GlobalState.fileTransfers.filter((fileTransfer) => { + const isFromThisNode = fileTransfer.from === this.node.num; + const isIncoming = fileTransfer.direction === FileTransferrer.DIRECTION_INCOMING; + const isOffering = fileTransfer.status === FileTransferrer.STATUS_OFFERING; + return isFromThisNode && isIncoming && isOffering; + }).length : 0; + }, }, }