diff --git a/src/actions/livepeer.js b/src/actions/livepeer.js index d0866b1..a96e5dc 100644 --- a/src/actions/livepeer.js +++ b/src/actions/livepeer.js @@ -1,6 +1,7 @@ import * as apiUtil from "../util/livepeer"; import { receiveErrors } from "./error"; import React from "react"; +import Ticket from "../components/TicketViewer"; const claimColour = "rgba(25, 158, 29, 0.3)"; const stakeColour = "rgba(25, 158, 147, 0.3)"; @@ -118,76 +119,31 @@ export const getEvents = () => async dispatch => { eventFrom = ""; eventTo = ""; if (eventContainsBond) { - eventDescription = -
-
-
-

🚀

-
-
-

- activated their orchestrator -

-
-
-
-
-

- {tmpAmount.toFixed(2)} LPT stake -

-

- round {tmpWhen} -

-
-
+ const subtext = "activated their orchestrator"; + const descriptions = [ + tmpAmount.toFixed(2) + " LPT stake", + "round " + tmpWhen + ] + eventDescription = } else { - eventDescription = -
-
-
-

🚀

-
-
-

- reactivated their orchestrator -

-
-
-
-
-

- round {tmpWhen} -

-
-
+ const subtext = "reactivated their orchestrator"; + const descriptions = [ + "round " + tmpWhen + ] + eventDescription = } } // Lone Unbond => Unbond Event else if (eventContainsUnbond) { eventType = "Unbond"; eventColour = unbondColour; + const subtext = "unbonded"; + const descriptions = [ + tmpAmount.toFixed(2) + " LPT", + "round " + tmpWhen + ] eventDescription = -
-
-
-

-
-
-

- unbonded -

-
-
-
-
-

- {tmpAmount.toFixed(2)} LPT -

-

- round {tmpWhen} -

-
-
+ } // Lone Bond => Stake Event else if (eventContainsBond) { @@ -198,90 +154,38 @@ export const getEvents = () => async dispatch => { else if (eventContainsRebond) { eventType = "Stake"; eventColour = stakeColour; + const subtext = "changed stake amount"; + const descriptions = [ + tmpAmount.toFixed(2) + " LPT" + ] eventDescription = -
-
-
-

-
-
-

- changed stake amount -

-
-
-
-
-

- {tmpAmount.toFixed(2)} LPT -

-
-
+ } // Fill description of Stake Event if it wasn't set yet if (eventType === "Stake" && eventDescription === "") { if (eventFrom === "0x0000000000000000000000000000000000000000") { + const subtext = "is now staking"; + const descriptions = [ + tmpAmount.toFixed(2) + " LPT" + ] eventDescription = -
-
-
-

-
-
-

- is now staking -

-
-
-
-
-

- {tmpAmount.toFixed(2)} LPT -

-
-
+ } else if (eventFrom === eventTo) { eventFrom = ""; + const subtext = "changed stake amount"; + const descriptions = [ + tmpAmount.toFixed(2) + " LPT" + ] eventDescription = -
-
-
-

-
-
-

- changed stake amount -

-
-
-
-
-

- {tmpAmount.toFixed(2)} LPT -

-
-
+ } else { + const subtext = "moved stake to a new orchestrator"; + const descriptions = [ + tmpAmount.toFixed(2) + " LPT" + ] eventDescription = -
-
-
-

-
-
-

- moved stake to a new orchestrator -

-
-
-
-
-

- {tmpAmount.toFixed(2)} LPT -

-
-
+ } } @@ -332,28 +236,13 @@ export const getEvents = () => async dispatch => { if (amount < thresholdFees) { continue; } + const subtext = "withdrew stake"; + const descriptions = [ + amount.toFixed(2) + " LPT", + "round " + eventObj.data.withdrawRound + ] const txt = -
-
-
-

🏦

-
-
-

- withdrew stake -

-
-
-
-
-

- {amount.toFixed(2)} LPT -

-

- round {eventObj.data.withdrawRound} -

-
-
+ finalEventList.push({ eventType: "Withdraw", eventDescription: txt, @@ -372,25 +261,12 @@ export const getEvents = () => async dispatch => { if (amount < thresholdFees) { continue; } + const subtext = "withdrew fee rewards"; + const descriptions = [ + amount.toFixed(4) + " Eth" + ] const txt = -
-
-
-

🏦

-
-
-

- withdrew fee rewards -

-
-
-
-
-

- {amount.toFixed(4)} Eth -

-
-
+ finalEventList.push({ eventType: "Withdraw", eventDescription: txt, @@ -410,28 +286,13 @@ export const getEvents = () => async dispatch => { eventContainsTranscoderUpdate = true; const amount1 = parseFloat(eventObj.data.rewardCut) / 10000; const amount2 = 100 - (eventObj.data.feeShare / 10000); + const subtext = "changed commission rates"; + const descriptions = [ + amount1.toFixed(2) + "% on staking rewards", + amount2.toFixed(2) + "% on transcoding fees" + ] const txt = -
-
-
-

🔄

-
-
-

- changed commission rates -

-
-
-
-
-

- {amount1.toFixed(2)}% on staking rewards -

-

- {amount2.toFixed(2)}% on transcoding fees -

-
-
+ finalEventList.push({ eventType: "Update", eventDescription: txt, @@ -454,28 +315,13 @@ export const getEvents = () => async dispatch => { if (amount1 < thresholdStaking && amount2 < thresholdFees) { continue; } + const subtext = "delegator claimed " + (eventObj.data.endRound - eventObj.data.startRound + 1) + " rounds of rewards"; + const descriptions = [ + "+" + amount1.toFixed(2) + " LPT rewards", + "+" + amount2.toFixed(4) + " Eth fees" + ] let txt = -
-
-
-

💰

-
-
-

- delegator claimed {eventObj.data.endRound - eventObj.data.startRound + 1} rounds of rewards -

-
-
-
-
-

- +{amount1.toFixed(2)} LPT rewards -

-

- +{amount2.toFixed(4)} Eth fees -

-
-
+ finalEventList.push({ eventType: "Claim", eventDescription: txt, @@ -494,25 +340,12 @@ export const getEvents = () => async dispatch => { else if (eventObj.name === "Reward") { eventContainsReward = true; const amount1 = parseFloat(eventObj.data.amount) / 1000000000000000000; - let txt = -
-
-
-

💸

-
-
-

- called reward -

-
-
-
-
-

- +{amount1.toFixed(2)} LPT -

-
-
+ const subtext = "called reward"; + const descriptions = [ + "+" + amount1.toFixed(2) + " LPT" + ] + const txt = + if (Math.floor(amount1) == 69) { txt += "... Nice!"; } @@ -611,25 +444,12 @@ export const getTickets = () => async dispatch => { // Always split off WithdrawStake as a separate Withdraw Event if (eventObj.name === "WinningTicketRedeemed") { const amount = parseFloat(eventObj.data.faceValue) / 1000000000000000000; + const subtext = "winning ticket"; + const descriptions = [ + "+" + amount.toFixed(4) + " Eth" + ] const txt = -
-
-
-

🎟️

-
-
-

- winning ticket -

-
-
-
-
-

- +{amount.toFixed(4)} Eth -

-
-
+ finalTicketList.push({ eventType: "RedeemTicket", eventDescription: txt, diff --git a/src/components/TicketViewer.js b/src/components/TicketViewer.js new file mode 100644 index 0000000..020879e --- /dev/null +++ b/src/components/TicketViewer.js @@ -0,0 +1,30 @@ +import React from "react"; + +const Ticket = (obj) => { + return ( +
+
+
+

{obj.icon}

+
+
+

+ {obj.subtext} +

+
+
+
+
+ {obj.descriptions.map(function (thisTextItem, i) { + return ( +

+ {thisTextItem} +

+ ) + })} +
+
+ ) +} + +export default Ticket; \ No newline at end of file diff --git a/src/components/eventViewer.js b/src/components/eventViewer.js index 5450d22..6ce3275 100644 --- a/src/components/eventViewer.js +++ b/src/components/eventViewer.js @@ -232,7 +232,7 @@ const EventViewer = (obj) => {
{filterBit}
-
+
diff --git a/src/pages/grafana.js b/src/pages/grafana.js index caa921b..157736b 100644 --- a/src/pages/grafana.js +++ b/src/pages/grafana.js @@ -42,7 +42,7 @@ const Grafana = (obj) => {
-
+
diff --git a/src/style.css b/src/style.css index c086b5a..fb2979d 100644 --- a/src/style.css +++ b/src/style.css @@ -151,15 +151,16 @@ svg { height: calc( 100vh - 50px); max-height: calc( 100vh - 50px); display: flex; - flex-wrap: nowrap; + flex-wrap: wrap; overflow: hidden; + overflow-y: auto; } #sideContent { background-color: rgba(214, 214, 214, 0.8); backdrop-filter: blur(6px); box-shadow: 9px 13px 8px 8px rgba(27, 23, 19, 0.692); border-bottom-right-radius: 1em; - width: 400px; + max-width: 400px; overflow-y: auto; overflow-x: hidden; }