diff --git a/package.json b/package.json index aea0b3f..b95fe8a 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "react-dom": "^16.12.0", "react-indiana-drag-scroll": "^2.1.0", "react-markdown": "^7.1.1", + "react-paginate": "^8.1.2", "react-redux": "^7.2.6", "react-router-dom": "^6.0.2", "react-scripts": "3.2.0", diff --git a/src/eventButton.js b/src/eventButton.js index 200d279..719dbd0 100644 --- a/src/eventButton.js +++ b/src/eventButton.js @@ -11,6 +11,7 @@ const rewardColour = "rgba(20, 99, 29, 0.3)"; const updateColour = "rgba(122, 63, 23, 0.3)"; const withdrawStakeColour = "rgba(102, 3, 10, 0.3)"; const stakeColour = "rgba(71, 23, 122, 0.3)"; +const unbondColour = "rgba(122, 23, 51, 0.3)"; const claimColour = "rgba(77, 91, 42, 0.3)"; const migrateColour = "rgba(56, 23, 122, 0.3)"; @@ -55,10 +56,14 @@ const EventButton = (obj) => { // Unbond: defines transactionWhen. Defines transactionAmount as X / 1000000000000000000 LPT if (eventObj.name === "Unbond") { // Caller and from will get overwritten by TransferBond or Rebond, but might as well set them - if (isOnlyBondRelated) { + if (isOnlyBondRelated || hasEarningsClaimed) { + transactionName = "Unbond"; + hasEarningsClaimed = false; transactionCaller = eventObj.data.delegate.toLowerCase(); transactionFrom = eventObj.data.delegator.toLowerCase(); + transactionWhen = eventObj.data.withdrawRound; transactionAmount = parseFloat(eventObj.data.amount) / 1000000000000000000; + thisColour = unbondColour; } hasUnbondTransaction = true; } @@ -92,7 +97,7 @@ const EventButton = (obj) => { } // TranscoderActivated: defines transactionName as a stake claim. Defines transactionWhen - if (eventObj.name === "EarningsClaimed" && !hasActivation && !hasBondTransaction && !hasRebondTransaction) { + if (eventObj.name === "EarningsClaimed" && !hasUnbondTransaction && !hasActivation && !hasBondTransaction && !hasRebondTransaction) { transactionName = "Claim"; transactionWhen = eventObj.data.endRound; transactionFrom = eventObj.data.delegate; @@ -141,10 +146,7 @@ const EventButton = (obj) => { isOnlyBondRelated = false; } if (eventObj.name === "WithdrawFees") { - console.log("Skipping WithdrawFees"); - } - if (eventObj.name === "Unbond") { - console.log("Skipping WithdrawFees"); + // console.log("Skipping WithdrawFees"); } }) @@ -215,6 +217,12 @@ const EventButton = (obj) => { } count++; } + if (obj.unbondActivated) { + if (transactionName === "Unbond") { + isFiltered = false; + } + count++; + } if (obj.delegatorRewardActivated) { if (transactionName === "Claim") { isFiltered = false; @@ -245,7 +253,7 @@ const EventButton = (obj) => { console.log(thisData); return null; } - let claimString = "claimed "; + let claimString = "delegator claimed "; if (transactionAmount > thresholdStaking) { claimString += transactionAmount.toFixed(2) + " LPT staking rewards"; if (transactionAdditionalAmount > thresholdFees) { @@ -265,6 +273,11 @@ const EventButton = (obj) => {

changed their reward commission to {transactionAmount.toFixed(2)}% and their fee commission to {transactionAdditionalAmount.toFixed(2)}%

+ } else if (transactionName === "Unbond") { + eventSpecificInfo = +
+

unbonded {transactionAmount.toFixed(2)} LPT from {transactionFrom} starting from round {transactionWhen}

+
} else if (transactionName === "Stake") { if (transactionFrom == "0x0000000000000000000000000000000000000000") { eventSpecificInfo = diff --git a/src/eventViewer.js b/src/eventViewer.js index f507e70..d9d43c5 100644 --- a/src/eventViewer.js +++ b/src/eventViewer.js @@ -1,7 +1,7 @@ import React, { useState } from "react"; import EventButton from "./eventButton"; import ScrollContainer from 'react-indiana-drag-scroll'; - +import ReactPaginate from 'react-paginate'; /// A scrollable and filterable list of EventButtons const activationColour = "rgba(23, 60, 122, 0.3)"; @@ -10,6 +10,7 @@ const updateColour = "rgba(122, 63, 23, 0.3)"; const withdrawStakeColour = "rgba(102, 3, 10, 0.3)"; const stakeColour = "rgba(71, 23, 122, 0.3)"; const claimColour = "rgba(77, 91, 42, 0.3)"; +const unbondColour = "rgba(122, 23, 51, 0.3)"; const EventViewer = (obj) => { const [searchTerm, setSearchTerm] = useState(obj.prefill || ""); @@ -19,6 +20,7 @@ const EventViewer = (obj) => { const [withdrawActivated, setWithdrawActivated] = useState(false); const [stakeActivated, setStakeActivated] = useState(false); const [delegatorRewardActivated, setDelegatorRewardActivated] = useState(false); + const [unbondActivated, setUnbondActivated] = useState(false); console.log("Rendering EventViewer"); let txCounter = 0; @@ -33,7 +35,7 @@ const EventViewer = (obj) => { let finalIdx = 0; return (
-
+
setSearchTerm(evt.target.value)} @@ -78,42 +80,48 @@ const EventViewer = (obj) => { withdrawActivated={withdrawActivated} stakeActivated={stakeActivated} delegatorRewardActivated={delegatorRewardActivated} + unbondActivated={unbondActivated} /> } })}
- - - - - - +
diff --git a/src/loadingScreen.js b/src/loadingScreen.js index 12116f2..2220f33 100644 --- a/src/loadingScreen.js +++ b/src/loadingScreen.js @@ -10,8 +10,8 @@ import { login } from "./actions/session"; // Shows a loading screen on first load and gets fresh data every refreshInterval milliseconds -// Refresh every 30 seconds -const refreshInterval = 30000; +// Refresh every 60 seconds +const refreshInterval = 60000; const Startup = (obj) => { const [isLoaded, setIsLoaded] = useState(false); diff --git a/src/orchestratorViewer.js b/src/orchestratorViewer.js index 12516e4..e4f1a72 100644 --- a/src/orchestratorViewer.js +++ b/src/orchestratorViewer.js @@ -92,7 +92,7 @@ const Orchestrator = (obj) => {
-

Current Delegators

+

{delegators.length} Current Delegators

diff --git a/src/style.css b/src/style.css index 6010fb1..3665eb6 100644 --- a/src/style.css +++ b/src/style.css @@ -360,12 +360,17 @@ svg { display: flex; justify-content: space-evenly; z-index: 10; + margin-bottom: 0.7em; } .nonHomeButton:hover { + box-shadow: 4px 5px 3px 2px rgba(8, 7, 56, 0.692); backdrop-filter: blur(6px); } +.nonHomeButton:active { + box-shadow: inset -4px -5px 6px 4px rgba(8, 7, 56, 0.692); +} .active { - box-shadow: 4px 5px 3px 2px rgba(8, 7, 56, 0.692); + box-shadow: inset -4px -5px 6px 4px rgba(8, 7, 56, 0.692); } .searchField { margin: auto;