import React, { useState } from 'react'
import '../style.css';
import {
Navigate
} from "react-router-dom";
import { useSelector } from 'react-redux'
import Orchestrator from "../components/orchestratorViewer";
// Displays orchestrator info and embedded grafana panels
const Grafana = (obj) => {
const livepeer = useSelector((state) => state.livepeerstate);
const [redirectToHome, setRedirectToHome] = useState(false);
if (redirectToHome) {
return ;
}
// Generate component for displaying LPT and ETH price and price change
let lptPrice = 0;
let ethPrice = 0;
let lptPriceChange24h = 0;
let ethPriceChange24h = 0;
if (livepeer.quotes) {
if (livepeer.quotes.LPT) {
lptPrice = livepeer.quotes.LPT.price.toFixed(2);
lptPriceChange24h = livepeer.quotes.LPT.percent_change_24h.toFixed(2);
}
if (livepeer.quotes.ETH) {
ethPrice = livepeer.quotes.ETH.price.toFixed(2);
ethPriceChange24h = livepeer.quotes.ETH.percent_change_24h.toFixed(2);
}
}
return (
${lptPrice}
({lptPriceChange24h}%)
Livepeer Orchestrator
${ethPrice}
({ethPriceChange24h}%)
);
}
export default Grafana;