From 7ea4ab654b5acb52f15010e038e1fb32413e3f7d Mon Sep 17 00:00:00 2001 From: Duddino Date: Mon, 2 Dec 2024 10:03:36 +0100 Subject: [PATCH 1/2] Governance vue (#375) * Initial rewrite * Desktop governance page * Finish governance table for mobile * Change useSettings to store * Add use_masternode * Split masternode component and implement CreateMasternode * Move import wallet inside RestoreWallet component * Add import masternode form * Add import wallet box * Fix masternode import page * Add controller * Finish mn controller * Add create proposal modal * Add automatic proposal confirmation * Fix start error * Add Create Proposal row * Add proposal finalisation * Add vote popup * Flipdown reactive * Split BudgetAllocated and MonthlyBudget components Split BudgetAllocated and MonthlyBudget components Fix the render for mobile * Clean up some dom elements * Fix over budget calculation * Add i18n mock * Add governance tests and test-ids. Fixed some inconsistencies found when testing * Remove unused component * Fix stake balance clearing mocks instead of returing function * Improve translation mock * Add masternode component tests * Re-apply #394 to vue (Remove governance dots on mobile) * Fix minor merge errors * Fix local proposal status * Add actual currency * Add finalizeProposalButton v-if to tests * Clean up code * Remove should be fine * Clean up masternode code and update when tab is clicked * Update governance when tab is clicked * Remove legacy exports * Add mastenrode and governance tab to tests * Fix test not passing on machines with different timezones * Fix eslint warnings * Apply #392 to vue * Remove console.logs * Fix eslint * Fix tests * Change createAlert * Fix overbudget bug * Fix undefined alert * Fix post-merge import * Add alert when trying to vote without a masternode * Open explorer when clicking on address * Remove openExplorer event * Update test * Revert createMasternode logic * Teleport confirmVoteModal and style cancel button * Fix teleport test * Fix mn starting not working * Fix button height being different * Fix close bug * Fix vote * Readd getBlockbookUrl * Update possible UTXOs on tab click and when creating mn * Add missing import * Fix buttons * Try remove this idk --------- Co-authored-by: Duddino Gatto Co-authored-by: JSKitty --- assets/icons/icon-arrow.svg | 9 + assets/style/style.css | 3 +- index.template.html | 302 +--- locale/en/translation.toml | 1 + locale/template/translation.toml | 1 + package-lock.json | 20 +- package.json | 1 + scripts/__mocks__/i18n.js | 29 + scripts/composables/use_masternode.js | 50 + scripts/composables/use_settings.js | 5 +- scripts/composables/use_wallet.js | 14 + scripts/dashboard/Dashboard.vue | 20 +- scripts/dashboard/RestoreWallet.vue | 20 +- scripts/dashboard/WalletButtons.vue | 4 +- scripts/global.js | 1245 +---------------- scripts/governance/BudgetAllocated.vue | 67 + scripts/governance/Flipdown.vue | 34 + scripts/governance/Governance.vue | 298 ++++ scripts/governance/LocalProposalStatus.vue | 64 + scripts/governance/MobileProposalPayment.vue | 60 + scripts/governance/MobileProposalRow.vue | 34 + scripts/governance/MobileProposalVote.vue | 28 + scripts/governance/MobileProposalVotes.vue | 39 + scripts/governance/MonthlyBudget.vue | 79 ++ scripts/governance/ProposalCreateModal.vue | 172 +++ scripts/governance/ProposalName.vue | 44 + scripts/governance/ProposalPayment.vue | 54 + scripts/governance/ProposalRow.vue | 124 ++ scripts/governance/ProposalStatus.vue | 93 ++ scripts/governance/ProposalVotes.vue | 34 + scripts/governance/ProposalsTable.vue | 138 ++ scripts/governance/status.js | 48 + scripts/index.js | 7 - scripts/masternode.js | 8 +- scripts/masternode/CreateMasternode.vue | 216 +++ scripts/masternode/Masternode.vue | 177 +++ scripts/masternode/MasternodeController.vue | 161 +++ scripts/masternode/NewMasternodeList.vue | 204 +++ scripts/misc.js | 43 + scripts/network/network.js | 5 +- scripts/settings.js | 2 - scripts/stake/Stake.vue | 17 +- scripts/utils.js | 10 + test_setup.js | 14 +- tests/components/StakeBalance.test.js | 2 +- .../governance/BudgetAllocated.test.js | 24 + tests/components/governance/Flipdown.test.js | 25 + .../governance/LocalProposalStatus.test.js | 61 + .../governance/MonthlyBudget.spec.js | 20 + .../governance/ProposalCreateModal.spec.js | 56 + .../governance/ProposalName.spec.js | 48 + .../governance/ProposalPayment.spec.js | 49 + .../components/governance/ProposalRow.spec.js | 96 ++ .../governance/ProposalStatus.spec.js | 80 ++ .../governance/ProposalVotes.spec.js | 34 + .../masternode/CreateMasternode.spec.js | 117 ++ .../masternode/MasternodeController.spec.js | 66 + .../proposal_validator/dummy_proposals.json | 555 ++++++++ .../proposal_validator.spec.js | 14 + 59 files changed, 3646 insertions(+), 1599 deletions(-) create mode 100644 assets/icons/icon-arrow.svg create mode 100644 scripts/__mocks__/i18n.js create mode 100644 scripts/composables/use_masternode.js create mode 100644 scripts/governance/BudgetAllocated.vue create mode 100644 scripts/governance/Flipdown.vue create mode 100644 scripts/governance/Governance.vue create mode 100644 scripts/governance/LocalProposalStatus.vue create mode 100644 scripts/governance/MobileProposalPayment.vue create mode 100644 scripts/governance/MobileProposalRow.vue create mode 100644 scripts/governance/MobileProposalVote.vue create mode 100644 scripts/governance/MobileProposalVotes.vue create mode 100644 scripts/governance/MonthlyBudget.vue create mode 100644 scripts/governance/ProposalCreateModal.vue create mode 100644 scripts/governance/ProposalName.vue create mode 100644 scripts/governance/ProposalPayment.vue create mode 100644 scripts/governance/ProposalRow.vue create mode 100644 scripts/governance/ProposalStatus.vue create mode 100644 scripts/governance/ProposalVotes.vue create mode 100644 scripts/governance/ProposalsTable.vue create mode 100644 scripts/governance/status.js create mode 100644 scripts/masternode/CreateMasternode.vue create mode 100644 scripts/masternode/Masternode.vue create mode 100644 scripts/masternode/MasternodeController.vue create mode 100644 scripts/masternode/NewMasternodeList.vue create mode 100644 tests/components/governance/BudgetAllocated.test.js create mode 100644 tests/components/governance/Flipdown.test.js create mode 100644 tests/components/governance/LocalProposalStatus.test.js create mode 100644 tests/components/governance/MonthlyBudget.spec.js create mode 100644 tests/components/governance/ProposalCreateModal.spec.js create mode 100644 tests/components/governance/ProposalName.spec.js create mode 100644 tests/components/governance/ProposalPayment.spec.js create mode 100644 tests/components/governance/ProposalRow.spec.js create mode 100644 tests/components/governance/ProposalStatus.spec.js create mode 100644 tests/components/governance/ProposalVotes.spec.js create mode 100644 tests/components/masternode/CreateMasternode.spec.js create mode 100644 tests/components/masternode/MasternodeController.spec.js create mode 100644 tests/unit/proposal_validator/dummy_proposals.json create mode 100644 tests/unit/proposal_validator/proposal_validator.spec.js diff --git a/assets/icons/icon-arrow.svg b/assets/icons/icon-arrow.svg new file mode 100644 index 000000000..2fb54d81f --- /dev/null +++ b/assets/icons/icon-arrow.svg @@ -0,0 +1,9 @@ + + + + diff --git a/assets/style/style.css b/assets/style/style.css index ad0f13031..220809070 100644 --- a/assets/style/style.css +++ b/assets/style/style.css @@ -2227,7 +2227,6 @@ a { } .row { - margin-left: 1px; margin-right: 1px; } @@ -4294,4 +4293,4 @@ textarea::placeholder { .mobileVote .pivx-button-outline { margin-right:7px; } -} \ No newline at end of file +} diff --git a/index.template.html b/index.template.html index 775177f0e..d0ffa2ab9 100644 --- a/index.template.html +++ b/index.template.html @@ -157,44 +157,6 @@