mirror of
https://github.com/stronk-dev/LivepeerEvents.git
synced 2025-07-05 10:45:10 +02:00
Also display orchestrator ens description and url if it is set
This commit is contained in:
parent
114147cdcd
commit
52692ec4ec
@ -1,9 +1,6 @@
|
||||
import React, { useState } from "react";
|
||||
import { useSelector } from 'react-redux';
|
||||
import { getEnsInfo } from "../actions/livepeer";
|
||||
import {
|
||||
getOrchestratorInfo
|
||||
} from "../actions/livepeer";
|
||||
|
||||
const Address = (obj) => {
|
||||
const livepeer = useSelector((state) => state.livepeerstate);
|
||||
@ -25,6 +22,7 @@ const Address = (obj) => {
|
||||
getEnsInfo(obj.address);
|
||||
setRefresh(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If it was not cached at all
|
||||
@ -47,6 +45,7 @@ const Address = (obj) => {
|
||||
getEnsInfo(obj.address);
|
||||
setRefresh(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If it was not cached at all
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import Stat from "./statViewer";
|
||||
import Address from "./OrchAddressViewer";
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
function updateClipboard(newClip) {
|
||||
navigator.clipboard.writeText(newClip).then(
|
||||
@ -24,6 +25,7 @@ function copyLink(addr) {
|
||||
}
|
||||
|
||||
const OrchInfoViewer = (obj) => {
|
||||
const livepeer = useSelector((state) => state.livepeerstate);
|
||||
let rewardCut = 0;
|
||||
let feeCut = 0;
|
||||
let totalStake = 0;
|
||||
@ -68,6 +70,45 @@ const OrchInfoViewer = (obj) => {
|
||||
shareUrl = thisFullPath + "?orchAddr=" + thisID;
|
||||
}
|
||||
|
||||
let thisDomain = null;
|
||||
let thisInfo = null;
|
||||
// Lookup domain in cache
|
||||
if (livepeer.ensDomainMapping) {
|
||||
for (const thisAddr of livepeer.ensDomainMapping) {
|
||||
if (thisAddr.address === thisID) {
|
||||
thisDomain = thisAddr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Lookup current info in cache only if this addr has a mapped ENS domain
|
||||
if (thisDomain && thisDomain.domain) {
|
||||
for (const thisAddr of livepeer.ensInfoMapping) {
|
||||
if (thisAddr.domain === thisDomain.domain) {
|
||||
thisInfo = thisAddr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let ensDescription;
|
||||
let ensUrl;
|
||||
if (thisInfo) {
|
||||
if (thisInfo.description) {
|
||||
ensDescription =
|
||||
<div className="row">
|
||||
<span>{thisInfo.description}</span>
|
||||
</div>
|
||||
}
|
||||
if (thisInfo.url) {
|
||||
ensUrl =
|
||||
<a className="selectOrchLight" style={{cursor: 'alias'}} target="_blank" rel="noopener noreferrer" href={"https://" + thisInfo.url} >
|
||||
<div className="rowAlignLeft">
|
||||
<span>{thisInfo.url}</span>
|
||||
</div>
|
||||
</a >
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="row">
|
||||
<div className="stroke sideMargin">
|
||||
@ -78,6 +119,8 @@ const OrchInfoViewer = (obj) => {
|
||||
<Address address={thisID} />
|
||||
</a>
|
||||
</div>
|
||||
{ensUrl}
|
||||
{ensDescription}
|
||||
<div className="stretchAndBetween" style={{ borderTop: '2px solid rgba(15,15,15,0.05)', marginTop: '0.2em' }} >
|
||||
<Stat header={"Earned Fees"} content1={totalVolumeETH + " Eth"} content2={"$" + totalVolumeUSD} />
|
||||
</div>
|
||||
|
@ -26,6 +26,7 @@ const EventButtonAddress = (obj) => {
|
||||
getEnsInfo(obj.address);
|
||||
setRefresh(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If it was not cached at all
|
||||
@ -48,6 +49,7 @@ const EventButtonAddress = (obj) => {
|
||||
getEnsInfo(obj.address);
|
||||
setRefresh(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If it was not cached at all
|
||||
|
@ -2,27 +2,6 @@ import React from "react";
|
||||
import OrchDelegatorViewer from "./OrchDelegatorViewer";
|
||||
import OrchInfoViewer from "./OrchInfoViewer";
|
||||
|
||||
function updateClipboard(newClip) {
|
||||
navigator.clipboard.writeText(newClip).then(
|
||||
() => {
|
||||
console.log("Copied!");
|
||||
},
|
||||
() => {
|
||||
console.log("Copy failed!");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function copyLink(addr) {
|
||||
navigator.permissions
|
||||
.query({ name: "clipboard-write" })
|
||||
.then((result) => {
|
||||
if (result.state === "granted" || result.state === "prompt") {
|
||||
updateClipboard(addr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const Orchestrator = (obj) => {
|
||||
if (obj.thisOrchestrator) {
|
||||
if (obj.forceVertical) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user