diff --git a/src/eventViewer.js b/src/eventViewer.js index 7f9f8df..d0b757c 100644 --- a/src/eventViewer.js +++ b/src/eventViewer.js @@ -12,11 +12,14 @@ 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 greyColour = "rgba(122, 128, 127, 0.3)"; -const maxShown = 500; + +const defaultMaxShown = 200; +const defaultIncrementMaxShown = 200; const EventViewer = (obj) => { const [searchTerm, setSearchTerm] = useState(obj.prefill || ""); const [amountFilter, setAmountFilter] = useState("0"); + const [maxAmount, setMaxAmount] = useState(defaultMaxShown); const [filterActivated, setFilterActivated] = useState(true); const [rewardActivated, setRewardActivated] = useState(false); const [updateActivated, setUpdateActivated] = useState(true); @@ -26,6 +29,7 @@ const EventViewer = (obj) => { const [unbondActivated, setUnbondActivated] = useState(true); console.log("Rendering EventViewer"); let unfiltered = 0; + let limitShown = obj.events.length; let filterActivatedColour; filterActivatedColour = filterActivated ? activationColour : greyColour; @@ -43,16 +47,42 @@ const EventViewer = (obj) => { unbondActivatedColour = unbondActivated ? unbondColour : greyColour; let prevBlock = 0; + let showMoreBlock; + if (maxAmount < limitShown) { + showMoreBlock =
+

+ +
+ } + let showLessBlock; + if (defaultMaxShown < maxAmount) { + showLessBlock =
+

+ +
+ } return (
-

Shows the latest {maxShown} entries of your search query

+ {showLessBlock} +
+

Showing {maxAmount} results

+
+ {showMoreBlock}
-

Filter by Orchestrator address

+

{searchTerm !== "" ? ("Only showing addresses containing " + searchTerm) : "Filter by Orchestrator address"}

setSearchTerm(evt.target.value)} @@ -90,7 +120,7 @@ const EventViewer = (obj) => {
-

Filter by minimum value

+

{parseFloat(amountFilter) > 0 ? ("Only showing higher than " + amountFilter) : "Filter by minimum value"}

setAmountFilter(evt.target.value)} @@ -201,7 +231,7 @@ const EventViewer = (obj) => { return null; } - if (unfiltered < maxShown) { + if (unfiltered < maxAmount) { unfiltered++; if (prevBlock === eventObj.transactionBlock) { return