From 52201d343de3109d9cd0643300dbe39ed8cb07fc Mon Sep 17 00:00:00 2001 From: Duddino Date: Wed, 19 Jul 2023 11:15:05 +0200 Subject: [PATCH 01/26] Rewrite activity --- index.template.html | 16 +- package-lock.json | 209 +++++++++++++++++++++++++- package.json | 5 +- scripts/Activity.vue | 341 +++++++++++++++++++++++++++++++++++++++++++ scripts/global.js | 68 ++------- webpack.common.js | 6 + 6 files changed, 569 insertions(+), 76 deletions(-) create mode 100644 scripts/Activity.vue diff --git a/index.template.html b/index.template.html index 76147ff96..0c4848100 100644 --- a/index.template.html +++ b/index.template.html @@ -490,19 +490,7 @@

-
-
Activity
-
-
-
-
- -
-
-
+
@@ -1199,6 +1187,6 @@

- +
diff --git a/package-lock.json b/package-lock.json index 97b7f8cab..7f32e0a48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,9 @@ "lodash-es": "^4.17.21", "pivx-promos": "^0.2.0", "qr-scanner": "^1.4.2", - "qrcode-generator": "^1.4.4" + "qrcode-generator": "^1.4.4", + "vue": "^3.3.4", + "vue-router": "^4.2.4" }, "devDependencies": { "@types/lodash-es": "^4.17.6", @@ -52,6 +54,7 @@ "node-polyfill-webpack-plugin": "^2.0.1", "prettier": "^2.8.1", "resource-loader": "^4.0.0-rc4", + "vue-loader": "^17.2.2", "webpack": "^5.75.0", "webpack-cli": "^5.0.1", "webpack-dev-server": "^4.11.1", @@ -67,6 +70,17 @@ "node": ">=0.10.0" } }, + "node_modules/@babel/parser": { + "version": "7.22.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz", + "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -833,6 +847,113 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@vue/compiler-core": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.3.4.tgz", + "integrity": "sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==", + "dependencies": { + "@babel/parser": "^7.21.3", + "@vue/shared": "3.3.4", + "estree-walker": "^2.0.2", + "source-map-js": "^1.0.2" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.3.4.tgz", + "integrity": "sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==", + "dependencies": { + "@vue/compiler-core": "3.3.4", + "@vue/shared": "3.3.4" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.3.4.tgz", + "integrity": "sha512-6y/d8uw+5TkCuzBkgLS0v3lSM3hJDntFEiUORM11pQ/hKvkhSKZrXW6i69UyXlJQisJxuUEJKAWEqWbWsLeNKQ==", + "dependencies": { + "@babel/parser": "^7.20.15", + "@vue/compiler-core": "3.3.4", + "@vue/compiler-dom": "3.3.4", + "@vue/compiler-ssr": "3.3.4", + "@vue/reactivity-transform": "3.3.4", + "@vue/shared": "3.3.4", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.0", + "postcss": "^8.1.10", + "source-map-js": "^1.0.2" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.3.4.tgz", + "integrity": "sha512-m0v6oKpup2nMSehwA6Uuu+j+wEwcy7QmwMkVNVfrV9P2qE5KshC6RwOCq8fjGS/Eak/uNb8AaWekfiXxbBB6gQ==", + "dependencies": { + "@vue/compiler-dom": "3.3.4", + "@vue/shared": "3.3.4" + } + }, + "node_modules/@vue/devtools-api": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz", + "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==" + }, + "node_modules/@vue/reactivity": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.3.4.tgz", + "integrity": "sha512-kLTDLwd0B1jG08NBF3R5rqULtv/f8x3rOFByTDz4J53ttIQEDmALqKqXY0J+XQeN0aV2FBxY8nJDf88yvOPAqQ==", + "dependencies": { + "@vue/shared": "3.3.4" + } + }, + "node_modules/@vue/reactivity-transform": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.3.4.tgz", + "integrity": "sha512-MXgwjako4nu5WFLAjpBnCj/ieqcjE2aJBINUNQzkZQfzIZA4xn+0fV1tIYBJvvva3N3OvKGofRLvQIwEQPpaXw==", + "dependencies": { + "@babel/parser": "^7.20.15", + "@vue/compiler-core": "3.3.4", + "@vue/shared": "3.3.4", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.0" + } + }, + "node_modules/@vue/runtime-core": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.3.4.tgz", + "integrity": "sha512-R+bqxMN6pWO7zGI4OMlmvePOdP2c93GsHFM/siJI7O2nxFRzj55pLwkpCedEY+bTMgp5miZ8CxfIZo3S+gFqvA==", + "dependencies": { + "@vue/reactivity": "3.3.4", + "@vue/shared": "3.3.4" + } + }, + "node_modules/@vue/runtime-dom": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.3.4.tgz", + "integrity": "sha512-Aj5bTJ3u5sFsUckRghsNjVTtxZQ1OyMWCr5dZRAPijF/0Vy4xEoRCwLyHXcj4D0UFbJ4lbx3gPTgg06K/GnPnQ==", + "dependencies": { + "@vue/runtime-core": "3.3.4", + "@vue/shared": "3.3.4", + "csstype": "^3.1.1" + } + }, + "node_modules/@vue/server-renderer": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.3.4.tgz", + "integrity": "sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==", + "dependencies": { + "@vue/compiler-ssr": "3.3.4", + "@vue/shared": "3.3.4" + }, + "peerDependencies": { + "vue": "3.3.4" + } + }, + "node_modules/@vue/shared": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.4.tgz", + "integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==" + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", @@ -2626,6 +2747,11 @@ "node": ">=8.0.0" } }, + "node_modules/csstype": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -3201,6 +3327,11 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -3914,6 +4045,12 @@ "node": ">=4" } }, + "node_modules/hash-sum": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-2.0.0.tgz", + "integrity": "sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==", + "dev": true + }, "node_modules/hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", @@ -4868,6 +5005,22 @@ "node": ">=10" } }, + "node_modules/magic-string": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.1.tgz", + "integrity": "sha512-mbVKXPmS0z0G4XqFDCTllmDQ6coZzn94aMlb0o/A4HEHJCKcanlDZwYJgwnkmgD3jyWhUgj9VsPrfd972yPffA==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/magic-string/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -5168,7 +5321,6 @@ "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", - "dev": true, "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -5701,8 +5853,7 @@ "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -5830,7 +5981,6 @@ "version": "8.4.21", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", - "dev": true, "funding": [ { "type": "opencollective", @@ -7130,7 +7280,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -7727,6 +7876,54 @@ "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", "dev": true }, + "node_modules/vue": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.3.4.tgz", + "integrity": "sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw==", + "dependencies": { + "@vue/compiler-dom": "3.3.4", + "@vue/compiler-sfc": "3.3.4", + "@vue/runtime-dom": "3.3.4", + "@vue/server-renderer": "3.3.4", + "@vue/shared": "3.3.4" + } + }, + "node_modules/vue-loader": { + "version": "17.2.2", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-17.2.2.tgz", + "integrity": "sha512-aqNvKJvnz2A/6VWeJZodAo8XLoAlVwBv+2Z6dama+LHsAF+P/xijQ+OfWrxIs0wcGSJduvdzvTuATzXbNKkpiw==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "watchpack": "^2.4.0" + }, + "peerDependencies": { + "webpack": "^4.1.0 || ^5.0.0-0" + }, + "peerDependenciesMeta": { + "@vue/compiler-sfc": { + "optional": true + }, + "vue": { + "optional": true + } + } + }, + "node_modules/vue-router": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.4.tgz", + "integrity": "sha512-9PISkmaCO02OzPVOMq2w82ilty6+xJmQrarYZDkjZBfl4RvYAlt4PKnEX21oW4KTtWfa9OuO/b3qk1Od3AEdCQ==", + "dependencies": { + "@vue/devtools-api": "^6.5.0" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "vue": "^3.2.0" + } + }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", diff --git a/package.json b/package.json index c1f1d643e..090917eb5 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "node-polyfill-webpack-plugin": "^2.0.1", "prettier": "^2.8.1", "resource-loader": "^4.0.0-rc4", + "vue-loader": "^17.2.2", "webpack": "^5.75.0", "webpack-cli": "^5.0.1", "webpack-dev-server": "^4.11.1", @@ -75,7 +76,9 @@ "lodash-es": "^4.17.21", "pivx-promos": "^0.2.0", "qr-scanner": "^1.4.2", - "qrcode-generator": "^1.4.4" + "qrcode-generator": "^1.4.4", + "vue": "^3.3.4", + "vue-router": "^4.2.4" }, "alias": { "@ledgerhq/devices": "@ledgerhq/devices/lib-es" diff --git a/scripts/Activity.vue b/scripts/Activity.vue new file mode 100644 index 000000000..a0c8aae37 --- /dev/null +++ b/scripts/Activity.vue @@ -0,0 +1,341 @@ + + + diff --git a/scripts/global.js b/scripts/global.js index 73a35d9e2..46ea75473 100644 --- a/scripts/global.js +++ b/scripts/global.js @@ -45,6 +45,8 @@ import { Database } from './database.js'; import bitjs from './bitTrx.js'; import { checkForUpgrades } from './changelog.js'; import { FlipDown } from './flipdown.js'; +import { createApp } from 'vue'; +import Activity from './Activity.vue'; /** A flag showing if base MPW is fully loaded or not */ export let fIsLoaded = false; @@ -56,6 +58,14 @@ export function isLoaded() { export let doms = {}; +// For now we'll import the component as a vue app by itself. Later, when the +// dashboard is rewritten in vue, we can simply add to the dashboard component template. +const activityDashboard = createApp(Activity, { + title: 'Activity', + rewards: false, +}).mount('#activityDashboard'); +//const stakeActivity = createApp(Activity, {title: "Activity", rewards: true}).mount('#activityStake'); + export async function start() { doms = { domNavbarToggler: document.getElementById('navbarToggler'), @@ -252,11 +262,6 @@ export async function start() { 'redeemCodeCreatePendingList' ), domPromoTable: document.getElementById('promo-table'), - domActivityList: document.getElementById('activity-list-content'), - domActivityLoadMore: document.getElementById('activityLoadMore'), - domActivityLoadMoreIcon: document.getElementById( - 'activityLoadMoreIcon' - ), domConfirmModalHeader: document.getElementById('confirmModalHeader'), domConfirmModalTitle: document.getElementById('confirmModalTitle'), domConfirmModalContent: document.getElementById('confirmModalContent'), @@ -688,7 +693,7 @@ export async function openSendQRScanner() { * @returns {Promise} HTML - The Activity List in HTML string form */ export async function createActivityListHTML(arrTXs, fRewards = false) { - const cNet = getNetwork(); + /*const cNet = getNetwork(); // Prepare the table HTML let strList = ` @@ -919,60 +924,13 @@ export async function createActivityListHTML(arrTXs, fRewards = false) { // Return the HTML string return strList; + */ } /** * Refreshes the specified activity table, charts and related information */ -export async function updateActivityGUI(fStaking = false, fNewOnly = false) { - const cNet = getNetwork(); - - // Prevent the user from spamming refreshes - if (cNet.historySyncing) return; - - // Remember how much history we had previously - const nPrevHistory = cNet.arrTxHistory.length; - - // Choose the Dashboard or Staking UI accordingly - let domLoadMore = doms.domActivityLoadMore; - let domLoadMoreIcon = doms.domActivityLoadMoreIcon; - if (fStaking) { - domLoadMore = doms.domGuiStakingLoadMore; - domLoadMoreIcon = doms.domGuiStakingLoadMoreIcon; - } - - // Load rewards from the network, displaying the sync spin icon until finished - domLoadMoreIcon.classList.add('fa-spin'); - const arrTXs = await cNet.syncTxHistoryChunk(fNewOnly); - domLoadMoreIcon.classList.remove('fa-spin'); - - // If there's no change in history size post-sync, then we can cancel here, there's nothing new to render - if (nPrevHistory === cNet.arrTxHistory.length) return; - - // Check if all transactions are loaded - if (cNet.isHistorySynced) { - // Hide the load more button - domLoadMore.style.display = 'none'; - } - - // For Staking: Filter the list for only Stakes, display total rewards from known history - const arrStakes = arrTXs.filter((a) => a.type === HistoricalTxType.STAKE); - const nRewards = arrStakes.reduce((a, b) => a + b.amount, 0); - doms.domStakingRewardsTitle.innerHTML = `${ - cNet.isHistorySynced ? '' : '≥' - }${sanitizeHTML(nRewards)} ${cChainParams.current.TICKER}`; - - // Create and render the Dashboard Activity - doms.domActivityList.innerHTML = await createActivityListHTML( - arrTXs, - false - ); - // Create and render the Staking History - doms.domStakingRewardsList.innerHTML = await createActivityListHTML( - arrStakes, - true - ); -} +export async function updateActivityGUI(fStaking = false, fNewOnly = false) {} /** * Open the Explorer in a new tab for the loaded master public key diff --git a/webpack.common.js b/webpack.common.js index f71cc7830..8f007df20 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -7,6 +7,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const CopyPlugin = require('copy-webpack-plugin'); +const { VueLoaderPlugin } = require('vue-loader'); const { readFileSync } = require('fs'); // Inject the Changelog and Version to the app @@ -35,6 +36,10 @@ module.exports = { test: /\.(jpe?g|png|gif|svg|mp3|svg)$/i, type: 'asset/resource', }, + { + test: /\.vue/i, + use: 'vue-loader', + }, ], }, resolve: { @@ -55,6 +60,7 @@ module.exports = { 'width=device-width, initial-scale=1, shrink-to-fit=no', }, }), + new VueLoaderPlugin(), // Polyfill for non web libraries new NodePolyfillPlugin(), // Prevents non styled flashing on load From d3779cd0b0f7f780c19b3672148dd8b574c25be1 Mon Sep 17 00:00:00 2001 From: Duddino Date: Wed, 19 Jul 2023 15:17:15 +0200 Subject: [PATCH 02/26] Add stake page --- index.template.html | 13 +------------ scripts/Activity.vue | 10 ++++------ scripts/global.js | 9 ++++++++- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/index.template.html b/index.template.html index 0c4848100..79698a9ee 100644 --- a/index.template.html +++ b/index.template.html @@ -820,18 +820,7 @@

-
Reward History (-)
-
-
-
-
- -
-
-
+
diff --git a/scripts/Activity.vue b/scripts/Activity.vue index a0c8aae37..334e6ee71 100644 --- a/scripts/Activity.vue +++ b/scripts/Activity.vue @@ -19,7 +19,6 @@ function addTx(tx) { } async function update(fNewOnly = false) { - console.log('Updating'); const cNet = getNetwork(); // Prevent the user from spamming refreshes @@ -39,16 +38,17 @@ async function update(fNewOnly = false) { isHistorySynced.value = cNet.isHistorySynced; // For Staking: Filter the list for only Stakes, display total rewards from known history - if (false && rewards) { + if (props.rewards) { const arrStakes = arrTXs.filter( (a) => a.type === HistoricalTxType.STAKE ); const nRewards = arrStakes.reduce((a, b) => a + b.amount, 0); + return await parseTXs(arrStakes); - doms.domStakingRewardsTitle.innerHTML = `${ + /*doms.domStakingRewardsTitle.innerHTML = `${ cNet.isHistorySynced ? '' : '≥' - }${sanitizeHTML(nRewards)} ${cChainParams.current.TICKER}`; + }${sanitizeHTML(nRewards)} ${cChainParams.current.TICKER}`;*/ } await parseTXs(arrTXs); @@ -58,7 +58,6 @@ async function update(fNewOnly = false) { * Parse tx to list syntax */ async function parseTXs(arrTXs) { - console.log('Parsing'); const cNet = getNetwork(); // Prepare time formatting @@ -233,7 +232,6 @@ async function parseTXs(arrTXs) { txContent = 'Unknown Tx'; } } - console.log(icon); txs.push({ date: strDate, content: txContent, diff --git a/scripts/global.js b/scripts/global.js index 46ea75473..f6d7b9452 100644 --- a/scripts/global.js +++ b/scripts/global.js @@ -64,6 +64,11 @@ const activityDashboard = createApp(Activity, { title: 'Activity', rewards: false, }).mount('#activityDashboard'); + +const stakingDashboard = createApp(Activity, { + title: 'Reward History', + rewards: true, +}).mount('#stakeActivity'); //const stakeActivity = createApp(Activity, {title: "Activity", rewards: true}).mount('#activityStake'); export async function start() { @@ -930,7 +935,9 @@ export async function createActivityListHTML(arrTXs, fRewards = false) { /** * Refreshes the specified activity table, charts and related information */ -export async function updateActivityGUI(fStaking = false, fNewOnly = false) {} +export async function updateActivityGUI(fStaking = false, fNewOnly = false) { + activityDashboard.update(); +} /** * Open the Explorer in a new tab for the loaded master public key From 1940c9f7a4f5aac0893a916282ef48dfbff155db Mon Sep 17 00:00:00 2001 From: Duddino Date: Wed, 19 Jul 2023 15:21:37 +0200 Subject: [PATCH 03/26] Remove undefined doms --- scripts/Activity.vue | 2 +- scripts/global.js | 22 +--------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/scripts/Activity.vue b/scripts/Activity.vue index 334e6ee71..67ed6b536 100644 --- a/scripts/Activity.vue +++ b/scripts/Activity.vue @@ -44,7 +44,7 @@ async function update(fNewOnly = false) { ); const nRewards = arrStakes.reduce((a, b) => a + b.amount, 0); - return await parseTXs(arrStakes); + return await parseTXs(arrStakes); /*doms.domStakingRewardsTitle.innerHTML = `${ cNet.isHistorySynced ? '' : '≥' diff --git a/scripts/global.js b/scripts/global.js index f6d7b9452..02cffa3c8 100644 --- a/scripts/global.js +++ b/scripts/global.js @@ -75,7 +75,6 @@ export async function start() { doms = { domNavbarToggler: document.getElementById('navbarToggler'), domDashboard: document.getElementById('dashboard'), - domGuiStaking: document.getElementById('guiStaking'), domGuiWallet: document.getElementById('guiWallet'), domGuiBalance: document.getElementById('guiBalance'), domGuiBalanceTicker: document.getElementById('guiBalanceTicker'), @@ -87,7 +86,6 @@ export async function start() { domGuiStakingValueCurrency: document.getElementById( 'guiStakingValueCurrency' ), - domGuiBalanceBox: document.getElementById('guiBalanceBox'), domBalanceReload: document.getElementById('balanceReload'), domBalanceReloadStaking: document.getElementById( 'balanceReloadStaking' @@ -96,13 +94,6 @@ export async function start() { domGuiBalanceStakingTicker: document.getElementById( 'guiBalanceStakingTicker' ), - domGuiStakingLoadMore: document.getElementById('stakingLoadMore'), - domGuiStakingLoadMoreIcon: document.getElementById( - 'stakingLoadMoreIcon' - ), - domGuiBalanceBoxStaking: document.getElementById( - 'guiBalanceBoxStaking' - ), domStakeAmount: document.getElementById('delegateAmount'), domUnstakeAmount: document.getElementById('undelegateAmount'), domStakeTab: document.getElementById('stakeTab'), @@ -130,7 +121,6 @@ export async function start() { ), domUnstakeAmountValue: document.getElementById('unstakeAmountValue'), - domGuiViewKey: document.getElementById('guiViewKey'), domModalQR: document.getElementById('ModalQR'), domModalQrLabel: document.getElementById('ModalQRLabel'), domModalQRReader: document.getElementById('qrReaderModal'), @@ -201,14 +191,9 @@ export async function start() { domAccessWalletBtn: document.getElementById('accessWalletBtn'), domVanityUiButtonTxt: document.getElementById('vanButtonText'), domGenKeyWarning: document.getElementById('genKeyWarning'), - domEncryptWarningTxt: document.getElementById('encryptWarningText'), - domEncryptBtnTxt: document.getElementById('encryptButton'), - domEncryptPasswordBox: document.getElementById('encryptPassword'), domEncryptPasswordFirst: document.getElementById('newPassword'), domEncryptPasswordSecond: document.getElementById('newPasswordRetype'), - domGuiAddress: document.getElementById('guiAddress'), domGenIt: document.getElementById('genIt'), - domHumanReadable: document.getElementById('HumanReadable'), domReqDesc: document.getElementById('reqDesc'), domReqDisplay: document.getElementById('reqDescDisplay'), domIdenticon: document.getElementById('identicon'), @@ -217,12 +202,6 @@ export async function start() { domAvailToDelegate: document.getElementById('availToDelegate'), domAvailToUndelegate: document.getElementById('availToUndelegate'), domAnalyticsDescriptor: document.getElementById('analyticsDescriptor'), - domStakingRewardsList: document.getElementById( - 'staking-rewards-content' - ), - domStakingRewardsTitle: document.getElementById( - 'staking-rewards-title' - ), domMnemonicModalContent: document.getElementById( 'ModalMnemonicContent' ), @@ -304,6 +283,7 @@ export async function start() { domFlipdown: document.getElementById('flipdown'), domTestnetToggler: document.getElementById('testnetToggler'), }; + await i18nStart(); await loadImages(); From 970357ecb1ced429105f0f7c10108e259a8be97e Mon Sep 17 00:00:00 2001 From: Duddino Date: Wed, 19 Jul 2023 15:37:26 +0200 Subject: [PATCH 04/26] Fix click not working --- scripts/Activity.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/Activity.vue b/scripts/Activity.vue index 67ed6b536..944bb6a1c 100644 --- a/scripts/Activity.vue +++ b/scripts/Activity.vue @@ -12,7 +12,9 @@ const props = defineProps({ const txs = reactive([]); const updating = ref(false); const isHistorySynced = ref(false); +const rewardsText = ref('-'); const ticker = computed(() => cChainParams.current.TICKER); +const explorerUrl = computed(() => getNetwork().strUrl); function addTx(tx) { txs.push(tx); @@ -32,6 +34,7 @@ async function update(fNewOnly = false) { updating.value = false; // If there's no change in history size post-sync, then we can cancel here, there's nothing new to render + // Disabled will renable later maybe //if (nPrevHistory === cNet.arrTxHistory.length) return; // Check if all transactions are loaded @@ -44,11 +47,8 @@ async function update(fNewOnly = false) { ); const nRewards = arrStakes.reduce((a, b) => a + b.amount, 0); + rewardsText.value = `${cNet.isHistorySynced ? '' : '≥'}${nRewards}`; return await parseTXs(arrStakes); - - /*doms.domStakingRewardsTitle.innerHTML = `${ - cNet.isHistorySynced ? '' : '≥' - }${sanitizeHTML(nRewards)} ${cChainParams.current.TICKER}`;*/ } await parseTXs(arrTXs); @@ -234,6 +234,7 @@ async function parseTXs(arrTXs) { } txs.push({ date: strDate, + id: cTx.id, content: txContent, formattedAmt, confirmed: fConfirmed, @@ -247,7 +248,10 @@ defineExpose({ txs, addTx, update });