import NodeLayout from '../components/NodeLayout'; import React, { FC, useMemo, useState } from 'react'; import NodeIcon from '../components/icons/NodeIcon'; import KeyIcon from '../components/icons/KeyIcon'; import { NODE_LIMIT } from '../configs'; import useNodeLicense from '../hooks/useNodeLicense'; import clsx from 'clsx'; import NodesModal from '../components/NodesModal'; import SemiCircleBar from '../components/SemiCircleBar'; import useNodeLicenseOperation from '../hooks/useNodeLicenseOperation'; import { formatTimeSecond } from '../utils'; import { Loading } from '../components/Loading'; import { useNavigate } from 'react-router'; const InfoTooltip: FC<{ description: string }> = ({ description }) => { return null; // return ( // // // // // // //

{description}

//
//
// ); }; const Dashboard = () => { const { data } = useNodeLicense(); const [showFullNode, setShowNode] = useState(false); const { data: license, toggleMutation } = useNodeLicenseOperation(); const push = useNavigate(); const nodeOnlineCount = useMemo(() => { return ( license.nodes?.filter( (i) => i.current_cycle_operation.status === 'running' )?.length || 0 ); }, [license.nodes]); return ( setShowNode(false)} />

Dashboard

{/*

Total Emissions

198,149.102 $MYRIA

*/}

Node(s) Online

{nodeOnlineCount}

setShowNode(true)} >

Purchased Licenses

{data?.length}

Node progress (Current cycle)

{license.all_nodes_running ? (

Myria is currently operating your Node Licenses on your behalf. Below is the progress of your Nodes in the current cycle. Each Node license that reaches 6 hours of operation will receive a point, and therefore is entitled to have Myria token rewards distributed to your Myria wallet.

) : (

Your Node licenses are currently not operational, please click{' '} Turn On All Nodes {' '} to begin operating your Nodes. Myria will operate the Node Licenses on your behalf.

)}
{toggleMutation.isLoading ? (
) : (
{license.all_nodes_running ? (
toggleMutation.mutate(false)} >

TURN OFF ALL NODES

) : (
toggleMutation.mutate(true)} >

TURN ON ALL NODES

)}
)}
{license?.nodes?.map((node, i) => { const active = node.current_cycle_operation.status === 'running'; const percentLoaded = (node.current_cycle_operation.uptime * 100) / 21600; const elapsed = node.current_cycle_operation.uptime; const remaining = node.current_cycle_operation.countdown; const description = active ? `${formatTimeSecond( elapsed, 'HH:mm:ss' )} elapsed ${formatTimeSecond( remaining, 'HH:mm:ss' )} remaining` : '--:--:--'; return (
{node?.id.split('-')[0]}
{active && (
)}

{description}

); })}

Progress Toward Goal

Current
Time
Distribution

Active

Cycle

{formatTimeSecond(license?.cycle?.current_distribution)}
{formatTimeSecond(license?.cycle?.time_active)}
{data?.length < NODE_LIMIT && (

<>Maximise your network

)}
); }; export default Dashboard;