From 787bbc9133218fd5bb7e582718b2196dc989593a Mon Sep 17 00:00:00 2001 From: liamcottle Date: Wed, 25 Sep 2024 23:07:24 +1200 Subject: [PATCH] show info dialog when clicking stamp cost --- .../messages/ConversationViewer.vue | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/frontend/components/messages/ConversationViewer.vue b/src/frontend/components/messages/ConversationViewer.vue index 70d543b..9882f60 100644 --- a/src/frontend/components/messages/ConversationViewer.vue +++ b/src/frontend/components/messages/ConversationViewer.vue @@ -20,7 +20,7 @@
<{{ selectedPeer.destination_hash }}> {{ selectedPeerPath.hops }} {{ selectedPeerPath.hops === 1 ? 'hop' : 'hops' }} away - • Stamp Cost {{ selectedPeerLxmfStampCost }} + Stamp Cost {{ selectedPeerLxmfStampCost }}
@@ -664,6 +664,31 @@ export default { onDestinationPathClick(path) { DialogUtils.alert(`${path.hops} ${ path.hops === 1 ? 'hop' : 'hops' } away via ${path.next_hop_interface}`); }, + onStampCostClick(stampCost) { + + // determine estimated time to generate a stamp + var estimatedTimeForStamp = ""; + if(stampCost >= 20){ + estimatedTimeForStamp = "more than an hour"; + } else if(stampCost >= 18) { + estimatedTimeForStamp = "~5 minutes"; + } else if(stampCost >= 17) { + estimatedTimeForStamp = "a few minutes"; + } else if(stampCost >= 16) { + estimatedTimeForStamp = "~1 minute"; + } else if(stampCost >= 13) { + estimatedTimeForStamp = "~30 seconds"; + } else if(stampCost >= 9) { + estimatedTimeForStamp = "~10 seconds"; + } else if(stampCost >= 1) { + estimatedTimeForStamp = "a few seconds"; + } else { + estimatedTimeForStamp = "0 seconds"; + } + + DialogUtils.alert(`This peer has enabled stamp security.\n\nYour device must solve an automated proof of work task each time you send them a message.\n\nTime per message: ${estimatedTimeForStamp}`); + + }, scrollMessagesToBottom: function() { // next tick waits for the ui to have the new elements added this.$nextTick(() => {