mirror of
https://github.com/stronk-dev/LivepeerEvents.git
synced 2025-07-05 10:45:10 +02:00
Added filter to hide non-earners for monthly stats
This commit is contained in:
parent
db8b2b6830
commit
d513bb9427
@ -27,133 +27,129 @@ const MonthlyFactoids = (obj) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="stroke insetEffect" key={obj.seed + "factoids"} style={{ height: '70vh' }}>
|
||||
<div className="content-wrapper" style={{width: "unset"}}>
|
||||
<ScrollContainer className="overflow-container" hideScrollbars={false} style={{width: "unset"}}>
|
||||
<div className="overflow-content" style={{ cursor: 'grab', maxHeight: '70vh', width: "unset" }}>
|
||||
{obj.data.reactivationCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: activationColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-reactivationCount-"} icon={"🔌"} subtext={obj.data.reactivationCount + " reactivations"} descriptions={[
|
||||
obj.data.reactivationCount + " Orchestrators reactivated"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
|
||||
{obj.data.activationCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: activationColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🔧"} subtext={obj.data.activationCount + " new orchestrators"} descriptions={[
|
||||
obj.data.activationCount + " orchestrators joined with an initial stake of " + obj.data.activationInitialSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{(obj.data.latestCommission && obj.data.latestCommission.length) ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: updateColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🔗"} subtext={obj.data.latestCommission.length + " orchestrators found"} descriptions={[
|
||||
obj.data.latestCommission.length + " orchestrators had a total of " + totalStakeSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT staked to them"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null}
|
||||
{obj.data.bondCount ?
|
||||
<div className="stroke" style={{width: "unset"}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: stakeColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"📈"} subtext={obj.data.bondCount + " new delegators"} descriptions={[
|
||||
obj.data.bondCount + " accounts delegated for the first time for a total of " + obj.data.bondStakeSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.unbondCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: unbondColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"📉"} subtext={obj.data.unbondCount + " leaving delegators"} descriptions={[
|
||||
obj.data.unbondCount + " delegators unbonded " + obj.data.unbondStakeSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.rewardCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: rewardColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"⌛"} subtext={obj.data.rewardCount + " reward calls"} descriptions={[
|
||||
obj.data.rewardCount + " reward calls made by orchestrators were worth " + obj.data.rewardAmountSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.claimCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: claimColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🏦"} subtext={obj.data.claimCount + " reward claims"} descriptions={[
|
||||
obj.data.claimRewardSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT and " + obj.data.claimFeeSum.toLocaleString({ maximumFractionDigits: 2 }) + " ETH worth of rewards were claimed by delegators"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.withdrawStakeCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: withdrawStakeColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"💸"} subtext={obj.data.withdrawStakeCount + " withdraw reward calls"} descriptions={[
|
||||
obj.data.withdrawStakeAmountSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT worth of staking rewards were withdrawn to the account of the delegator"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.withdrawFeesCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: withdrawStakeColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"💸"} subtext={obj.data.withdrawFeesCount + " withdraw fee calls"} descriptions={[
|
||||
obj.data.withdrawFeesAmountSum.toLocaleString({ maximumFractionDigits: 2 }) + " ETH worth of transcoding fees were withdrawn to the account of the delegator"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.moveStakeCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: stakeColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🔄"} subtext={obj.data.moveStakeCount + " stake movements"} descriptions={[
|
||||
obj.data.moveStakeSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT worth of stake was moved between orchestrators"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.winningTicketsReceivedCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: ticketTransferColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🎫"} subtext={obj.data.winningTicketsReceivedCount + " winning tickets"} descriptions={[
|
||||
obj.data.winningTicketsReceivedCount + " winning tickets were sent out by " + obj.data.winningTicketsSent.length + " broadcasters"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.winningTicketsRedeemedCount ?
|
||||
<div className="stroke" style={{width: 'unset'}}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: ticketRedeemColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🎟️"} subtext={obj.data.winningTicketsRedeemedCount + " redeemed tickets"} descriptions={[
|
||||
obj.data.winningTicketsRedeemedCount + " winning tickets were redeemed worth " + obj.data.winningTicketsRedeemedSum.toLocaleString({ maximumFractionDigits: 2 }) + " ETH"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
<div className="stroke insetEffect" key={obj.seed + "factoids"}>
|
||||
<div className="overflow-content" style={{ cursor: 'grab', width: "unset" }}>
|
||||
{obj.data.reactivationCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
</div>
|
||||
</ScrollContainer>
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: activationColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-reactivationCount-"} icon={"🔌"} subtext={obj.data.reactivationCount + " reactivations"} descriptions={[
|
||||
obj.data.reactivationCount + " Orchestrators reactivated"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
|
||||
{obj.data.activationCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: activationColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🔧"} subtext={obj.data.activationCount + " new orchestrators"} descriptions={[
|
||||
obj.data.activationCount + " orchestrators joined with an initial stake of " + obj.data.activationInitialSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{(obj.data.latestCommission && obj.data.latestCommission.length) ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: updateColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🔗"} subtext={obj.data.latestCommission.length + " orchestrators found"} descriptions={[
|
||||
obj.data.latestCommission.length + " orchestrators had a total of " + totalStakeSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT staked to them"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null}
|
||||
{obj.data.bondCount ?
|
||||
<div className="stroke" style={{ width: "unset" }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: stakeColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"📈"} subtext={obj.data.bondCount + " new delegators"} descriptions={[
|
||||
obj.data.bondCount + " accounts delegated for the first time for a total of " + obj.data.bondStakeSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.unbondCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: unbondColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"📉"} subtext={obj.data.unbondCount + " leaving delegators"} descriptions={[
|
||||
obj.data.unbondCount + " delegators unbonded " + obj.data.unbondStakeSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.rewardCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: rewardColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"⌛"} subtext={obj.data.rewardCount + " reward calls"} descriptions={[
|
||||
obj.data.rewardCount + " reward calls made by orchestrators were worth " + obj.data.rewardAmountSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.claimCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: claimColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🏦"} subtext={obj.data.claimCount + " reward claims"} descriptions={[
|
||||
obj.data.claimRewardSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT and " + obj.data.claimFeeSum.toLocaleString({ maximumFractionDigits: 2 }) + " ETH worth of rewards were claimed by delegators"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.withdrawStakeCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: withdrawStakeColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"💸"} subtext={obj.data.withdrawStakeCount + " withdraw reward calls"} descriptions={[
|
||||
obj.data.withdrawStakeAmountSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT worth of staking rewards were withdrawn to the account of the delegator"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.withdrawFeesCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: withdrawStakeColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"💸"} subtext={obj.data.withdrawFeesCount + " withdraw fee calls"} descriptions={[
|
||||
obj.data.withdrawFeesAmountSum.toLocaleString({ maximumFractionDigits: 2 }) + " ETH worth of transcoding fees were withdrawn to the account of the delegator"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.moveStakeCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: stakeColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🔄"} subtext={obj.data.moveStakeCount + " stake movements"} descriptions={[
|
||||
obj.data.moveStakeSum.toLocaleString({ maximumFractionDigits: 2 }) + " LPT worth of stake was moved between orchestrators"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.winningTicketsReceivedCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: ticketTransferColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🎫"} subtext={obj.data.winningTicketsReceivedCount + " winning tickets"} descriptions={[
|
||||
obj.data.winningTicketsReceivedCount + " winning tickets were sent out by " + obj.data.winningTicketsSent.length + " broadcasters"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
{obj.data.winningTicketsRedeemedCount ?
|
||||
<div className="stroke" style={{ width: 'unset' }}>
|
||||
<div className="halfVerticalDivider" />
|
||||
<div className="row" style={{ justifyContent: 'space-between', alignItems: 'stretch', maxWidth: '61.8%', textAlign: 'justify', padding: '0.5em', backgroundColor: ticketRedeemColour, border: '0.1em solid rgba(54, 46, 46, 0.1)' }}>
|
||||
<Ticket seed={obj.seed + "-neworchs-"} icon={"🎟️"} subtext={obj.data.winningTicketsRedeemedCount + " redeemed tickets"} descriptions={[
|
||||
obj.data.winningTicketsRedeemedCount + " winning tickets were redeemed worth " + obj.data.winningTicketsRedeemedSum.toLocaleString({ maximumFractionDigits: 2 }) + " ETH"
|
||||
]} />
|
||||
</div>
|
||||
</div> : null
|
||||
}
|
||||
<div className="halfVerticalDivider" />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
@ -53,27 +53,48 @@ const MonthlyGraphs = (obj) => {
|
||||
|
||||
// Show all orchs (if latestTotalStake exists) or show only those in winningTicketsReceived
|
||||
let orchList;
|
||||
let ticketList = obj.data.winningTicketsReceived || [];
|
||||
let stakeList = obj.data.latestTotalStake || [];
|
||||
if (obj.data.latestTotalStake && obj.data.latestTotalStake.length) {
|
||||
orchList = [...obj.data.latestTotalStake];
|
||||
// Filter out orchestrators who have not earned any fees, to get a more accurate earnings vs stake overview
|
||||
if (obj.showOnlyTranscoders) {
|
||||
if (obj.data.winningTicketsReceived && obj.data.winningTicketsReceived.length) {
|
||||
// For each orchestrator in latestTotalStake, splice it if they are not present in winningTicketsReceived
|
||||
let ticketIdx = obj.data.latestTotalStake.length - 1;
|
||||
while (ticketIdx >= 0) {
|
||||
const thisOrch = obj.data.latestTotalStake[ticketIdx];
|
||||
let found = false;
|
||||
for (const orchWinnings of obj.data.winningTicketsReceived) {
|
||||
if (orchWinnings.address == thisOrch.address) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
orchList.splice(ticketIdx, 1);
|
||||
}
|
||||
ticketIdx--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pies for stake overview, if have stake data for that month saved
|
||||
let stakeObj;
|
||||
let totalStakeSum = 0;
|
||||
if (obj.data.latestTotalStake && obj.data.latestTotalStake.length) {
|
||||
orchList = [...obj.data.latestTotalStake];
|
||||
if (orchList && orchList.length) {
|
||||
let pieList = [];
|
||||
let otherSum = 0;
|
||||
let ticketIdx = obj.data.latestTotalStake.length - 1;
|
||||
let ticketIdx = orchList.length - 1;
|
||||
// Calc total stake at that time
|
||||
while (ticketIdx >= 0) {
|
||||
const thisTicket = obj.data.latestTotalStake[ticketIdx];
|
||||
const thisTicket = orchList[ticketIdx];
|
||||
ticketIdx -= 1;
|
||||
totalStakeSum += thisTicket.totalStake;
|
||||
}
|
||||
ticketIdx = obj.data.latestTotalStake.length - 1;
|
||||
ticketIdx = orchList.length - 1;
|
||||
// Create pie chart
|
||||
while (ticketIdx >= 0) {
|
||||
const thisTicket = obj.data.latestTotalStake[ticketIdx];
|
||||
const thisTicket = orchList[ticketIdx];
|
||||
ticketIdx -= 1;
|
||||
if ((thisTicket.totalStake / totalStakeSum) < 0.015) {
|
||||
otherSum += thisTicket.totalStake;
|
||||
@ -143,8 +164,6 @@ const MonthlyGraphs = (obj) => {
|
||||
labelPlacement="parallel"
|
||||
/>
|
||||
</div>;
|
||||
} else {
|
||||
orchList = [...obj.data.winningTicketsReceived];
|
||||
}
|
||||
|
||||
// Pies for earnings overview
|
||||
@ -307,66 +326,6 @@ const MonthlyGraphs = (obj) => {
|
||||
</div>;
|
||||
}
|
||||
|
||||
let sortedList = [];
|
||||
if (orchList.length) {
|
||||
// Sort this months data
|
||||
while (orchList.length) {
|
||||
let ticketIdx2 = orchList.length - 1;
|
||||
let largestIdx = 0;
|
||||
let largestValue = 0;
|
||||
|
||||
// Find current O with most ticket wins in Eth
|
||||
while (ticketIdx2 >= 0) {
|
||||
const currentOrch = orchList[ticketIdx2];
|
||||
let thisVal;
|
||||
|
||||
for (const obj of ticketList) {
|
||||
if (obj.address == currentOrch.address) {
|
||||
thisVal = obj.sum;
|
||||
}
|
||||
}
|
||||
|
||||
if (!thisVal) {
|
||||
ticketIdx2 -= 1;
|
||||
continue;
|
||||
}
|
||||
if (thisVal > largestValue) {
|
||||
largestIdx = ticketIdx2;
|
||||
largestValue = thisVal;
|
||||
}
|
||||
ticketIdx2 -= 1;
|
||||
}
|
||||
// Else try to sort by stake
|
||||
if (!largestValue) {
|
||||
ticketIdx2 = orchList.length - 1;
|
||||
while (ticketIdx2 >= 0) {
|
||||
const currentOrch = orchList[ticketIdx2];
|
||||
let thisVal;
|
||||
|
||||
for (const obj of stakeList) {
|
||||
if (obj.address == currentOrch.address) {
|
||||
thisVal = obj.totalStake;
|
||||
}
|
||||
}
|
||||
|
||||
if (!thisVal) {
|
||||
ticketIdx2 -= 1;
|
||||
continue;
|
||||
}
|
||||
if (thisVal > largestValue) {
|
||||
largestIdx = ticketIdx2;
|
||||
largestValue = thisVal;
|
||||
}
|
||||
ticketIdx2 -= 1;
|
||||
}
|
||||
}
|
||||
// Push current biggest list
|
||||
sortedList.push(orchList[largestIdx]);
|
||||
// Remove from list
|
||||
orchList.splice(largestIdx, 1);
|
||||
}
|
||||
}
|
||||
|
||||
let thisColour;
|
||||
if (activeGraph == 1) {
|
||||
thisColour = "violet";
|
||||
@ -438,7 +397,7 @@ const MonthlyGraphs = (obj) => {
|
||||
color: 'black',
|
||||
border: 'none'
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
controlActive: {
|
||||
color: 'black',
|
||||
|
@ -29,27 +29,47 @@ const MonthlyOrchestrators = (obj) => {
|
||||
}, [obj.data.testScores]);
|
||||
|
||||
// Show all orchs (if latestTotalStake exists) or show only those in winningTicketsReceived
|
||||
let orchList;
|
||||
let ticketList = obj.data.winningTicketsReceived || [];
|
||||
let commissionList = obj.data.latestCommission || [];
|
||||
let stakeList = obj.data.latestTotalStake || [];
|
||||
|
||||
// Pies for stake overview, if have stake data for that month saved
|
||||
|
||||
// Show all orchs (if latestTotalStake exists) or show only those in winningTicketsReceived
|
||||
let orchList;
|
||||
let totalStakeSum = 0;
|
||||
if (obj.data.latestTotalStake && obj.data.latestTotalStake.length) {
|
||||
orchList = [...obj.data.latestTotalStake];
|
||||
let ticketIdx = obj.data.latestTotalStake.length - 1;
|
||||
// Calc total stake at that time
|
||||
while (ticketIdx >= 0) {
|
||||
const thisTicket = obj.data.latestTotalStake[ticketIdx];
|
||||
ticketIdx -= 1;
|
||||
totalStakeSum += thisTicket.totalStake;
|
||||
// Filter out orchestrators who have not earned any fees, to get a more accurate earnings vs stake overview
|
||||
if (obj.showOnlyTranscoders) {
|
||||
if (obj.data.winningTicketsReceived && obj.data.winningTicketsReceived.length) {
|
||||
// For each orchestrator in latestTotalStake, splice it if they are not present in winningTicketsReceived
|
||||
let ticketIdx = obj.data.latestTotalStake.length - 1;
|
||||
while (ticketIdx >= 0) {
|
||||
const thisOrch = obj.data.latestTotalStake[ticketIdx];
|
||||
let found = false;
|
||||
for (const orchWinnings of obj.data.winningTicketsReceived) {
|
||||
if (orchWinnings.address == thisOrch.address) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
orchList.splice(ticketIdx, 1);
|
||||
} else {
|
||||
totalStakeSum += thisOrch.totalStake;
|
||||
}
|
||||
ticketIdx--;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const thisOrch of obj.data.latestTotalStake) {
|
||||
totalStakeSum += thisOrch.totalStake;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
orchList = [...obj.data.winningTicketsReceived];
|
||||
}
|
||||
|
||||
|
||||
let sortedList = [];
|
||||
if (orchList.length) {
|
||||
// Sort this months data
|
||||
|
@ -111,12 +111,14 @@ const MonthlyStats = (obj) => {
|
||||
{
|
||||
activePage == 2 ? <MonthlyGraphs
|
||||
data={obj.data}
|
||||
showOnlyTranscoders={obj.showOnlyTranscoders}
|
||||
seed={"graphs" + obj.data.year + "-" + obj.data.month + "-" + obj.data.total}
|
||||
/> : null
|
||||
}
|
||||
{
|
||||
activePage == 3 ? <MonthlyOrchestrators
|
||||
data={obj.data}
|
||||
showOnlyTranscoders={obj.showOnlyTranscoders}
|
||||
seed={"orchestrators" + obj.data.year + "-" + obj.data.month + "-" + obj.data.total}
|
||||
/> : null
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import MonthlyStats from './MonthlyStats';
|
||||
const Stats = (obj) => {
|
||||
const livepeer = useSelector((state) => state.livepeerstate);
|
||||
const [redirectToHome, setRedirectToHome] = useState(false);
|
||||
const [showOnlyTranscoders, setShowOnlyTranscoders] = useState(true);
|
||||
|
||||
console.log("Rendering Stats Viewer");
|
||||
|
||||
@ -26,6 +27,14 @@ const Stats = (obj) => {
|
||||
</button>
|
||||
<h4 className="rowAlignLeft withWrap showNeverOnMobile">Statistics</h4>
|
||||
</div>
|
||||
<div className='rowAlignRight'>
|
||||
<p>Hide non-earners</p>
|
||||
<div className="toggle-container" onClick={() => setShowOnlyTranscoders(!showOnlyTranscoders)}>
|
||||
<div className={`dialog-button ${showOnlyTranscoders ? "" : "disabled"}`}>
|
||||
{showOnlyTranscoders ? "Show" : "Hide"}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='bodyContent'>
|
||||
<div className="row">
|
||||
@ -131,6 +140,7 @@ const Stats = (obj) => {
|
||||
key={"accord" + i + data.year + "-" + data.month + "-" + data.total}>
|
||||
<MonthlyStats
|
||||
data={data}
|
||||
showOnlyTranscoders={showOnlyTranscoders}
|
||||
seed={"win" + i + data.year + "-" + data.month + "-" + data.total}
|
||||
/>
|
||||
</Accordion.Item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user