Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NodeWatch Frontend (UI)
# Nodewatch Frontend (UI)

A web-based user interface will be developed to display the data collected by a [devp2p crawler](https://github.com/ChainSafe/eth2-crawler) targeted at Eth2 nodes. It will contain the following:
A web-based user interface will be developed to display the data collected by a [devp2p crawler](https://github.com/ChainSafe/eth2-crawler) targeted at Ethereum Consensus nodes. It will contain the following:

- Client breakdown by agent type
- Toggle connectable vs all seen in last month
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "eth2-crawler-ui",
"name": "nodewatch-ui",
"version": "0.1.0",
"private": true,
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="icon" href="%PUBLIC_URL%/icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Nodewatch - Eth2 Node Analytics" />
<meta name="description" content="Nodewatch - Ethereum Consensus Node Analytics" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!-- leaflet css -->
<link
Expand All @@ -18,7 +18,7 @@
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""
/>
<title>Nodewatch - Eth2 Node Analytics</title>
<title>Nodewatch - Ethereum Consensus Node Analytics</title>
</head>

<body>
Expand Down
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "Eth 2 Crawler",
"name": "Eth 2 Crawler",
"short_name": "Nodewatch",
"name": "Nodewatch",
"icons": [
{
"src": "favicon.ico",
Expand Down
8 changes: 4 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from "react"
import HomePage from "./Components/Pages/HomePage"
import { ThemeSwitcher, createStyles, makeStyles } from "@chainsafe/common-theme"
import { theme } from "./Components/Themes/theme"
import { Eth2CrawlerProvider } from "./Contexts/Eth2CrawlerContext"
import { NodewatchCrawlerProvider } from "./Contexts/NodewatchCrawlerContext"
import BodyLayout from "./Components/Layouts/BodyLayout"
import NavBar from "./Components/Modules/Navbar"
import Footer from "./Components/Modules/Footer"
Expand All @@ -22,16 +22,16 @@ const useStyles = makeStyles(() => {
function App() {
const classes = useStyles()
return (
<ThemeSwitcher storageKey="eth2.themeKey" themes={{ light: theme }}>
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if changing this is okay, but I couldn't find any reference/use of eth2.themeKey

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, its ok, The themeswitcher uses this string to save current theme in localstorage.

<Eth2CrawlerProvider>
<ThemeSwitcher storageKey="Nodewatch.themeKey" themes={{ light: theme }}>
<NodewatchCrawlerProvider>
<div className={classes.root}>
<NavBar />
<BodyLayout>
<HomePage />
</BodyLayout>
<Footer />
</div>
</Eth2CrawlerProvider>
</NodewatchCrawlerProvider>
</ThemeSwitcher>
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/CountryStats/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: LGPL-3.0-only
import React, { useCallback, useEffect, useMemo, useState } from "react"
import { createStyles, makeStyles, useTheme } from "@chainsafe/common-theme"
import { ECTheme } from "../../Themes/types"
import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../../Contexts/NodewatchCrawlerContext"
import CountryBox from "./CountryBox"
import StatsChartBox from "./StatsChartBox"
import { Typography } from "@chainsafe/common-components"
Expand Down Expand Up @@ -71,7 +71,7 @@ const HALF_PAGE_SIZE = PAGE_SIZE / 2

const CountryStats: React.FC = () => {
const classes = useStyles()
const { nodeCountByCountries } = useEth2CrawlerApi()
const { nodeCountByCountries } = useNodewatchCrawlerApi()
const [pageNo, setPageNo] = useState(0)

const { width } = useWindowDimensions()
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/DemographicsStats/ClientTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: LGPL-3.0-only
import React, { useMemo } from "react"
import { createStyles, makeStyles, useTheme } from "@chainsafe/common-theme"
import { Typography } from "@chainsafe/common-components"
import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../../Contexts/NodewatchCrawlerContext"
import { ECTheme } from "../../Themes/types"
import { BarChart, Bar, Tooltip, XAxis, YAxis, ResponsiveContainer } from "recharts"

Expand Down Expand Up @@ -34,7 +34,7 @@ const ClientTypes = () => {
const classes = useStyles()
const theme: ECTheme = useTheme()

const { clients } = useEth2CrawlerApi()
const { clients } = useNodewatchCrawlerApi()

const chartData = useMemo(
() =>
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Modules/DemographicsStats/NodeCount12.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ const NodeCount12 = () => {
labels: ["1", "2", "3", "4", "5", "6", "7"],
datasets: [
{
label: "Node count: eth1",
label: "Node count: Ethereum Execution",
data: [65, 59, 80, 81, 56, 55, 40],
fill: true,
borderColor: theme.palette.primary.main,
backgroundColor: theme.palette.primary.background,
tension: 0.1,
},
{
label: "Node count: eth2",
label: "Node count: Ethereum Consensus",
data: [99, 56, 55, 40, 65, 59, 100],
fill: true,
borderColor: theme.palette.primary.main,
Expand Down Expand Up @@ -69,7 +69,7 @@ const NodeCount12 = () => {
return (
<div className={classes.root}>
<Typography component="p" variant="body1" className={classes.title}>
node count eth1 and eth2
node count ethereum execution and ethereum consensus
</Typography>
<div>
<Line data={data} options={options} />
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/HeatMap/MapLeaflet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, { useEffect } from "react"
// import { CircleMarker, MapContainer, TileLayer, Tooltip } from "react-leaflet"
import L, { LatLngTuple } from "leaflet"
// import { createStyles, makeStyles } from "@chainsafe/common-theme"
import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../../Contexts/NodewatchCrawlerContext"
// import useWindowDimensions from "../../../utilHooks/useWindowDimensions"
import "leaflet/dist/leaflet.css"
import "leaflet.heat"
Expand Down Expand Up @@ -46,7 +46,7 @@ const minZoom = 1.4

const NodeMap = ({ rootClassName }: { rootClassName: string }) => {
// const classes = useStyles()
const { heatmap } = useEth2CrawlerApi()
const { heatmap } = useNodewatchCrawlerApi()
// const { width } = useWindowDimensions()

// const circleRadius = width < 480 ? 1 : width < 720 ? 2 : width < 1280 ? 4 : 4
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Modules/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const NavBar: React.FC = () => {
<div className={classes.box}>
<Typography variant="h5">
<a href="/" className={classes.navLink}>
Eth2 Nodewatch
Ethereum Consensus Nodewatch
</a>
</Typography>
<Typography variant="h5">
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/NodeStats/NodeStatsOverTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: LGPL-3.0-only
import React, { useMemo } from "react"
import { createStyles, makeStyles, useTheme } from "@chainsafe/common-theme"
import { Typography } from "@chainsafe/common-components"
import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../../Contexts/NodewatchCrawlerContext"
import { ECTheme } from "../../Themes/types"
import {
XAxis,
Expand Down Expand Up @@ -61,7 +61,7 @@ const NodeStatusOverTime = () => {
const classes = useStyles()
const theme: ECTheme = useTheme()

const { nodeStatsOverTime } = useEth2CrawlerApi()
const { nodeStatsOverTime } = useNodewatchCrawlerApi()

const chartData = useMemo(
() =>
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/SoftwareStats/AltAirPercentage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, { useMemo, useState } from "react"
import { createStyles, makeStyles, useTheme } from "@chainsafe/common-theme"
import { ECTheme } from "../../Themes/types"
import { PieChart, Pie, Sector, ResponsiveContainer } from "recharts"
import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../../Contexts/NodewatchCrawlerContext"
import { Typography } from "@chainsafe/common-components"

const useStyles = makeStyles(({ constants, palette }: ECTheme) => {
Expand Down Expand Up @@ -67,7 +67,7 @@ const AltAirPercentage: React.FC = () => {
setActiveIndex(index)
}

const { altAirPercentage } = useEth2CrawlerApi()
const { altAirPercentage } = useNodewatchCrawlerApi()

const data = useMemo(() => {
return altAirPercentage !== undefined
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/SoftwareStats/NetworkTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: LGPL-3.0-only
import React, { useMemo } from "react"
import { createStyles, makeStyles, useTheme } from "@chainsafe/common-theme"
import { Typography } from "@chainsafe/common-components"
import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../../Contexts/NodewatchCrawlerContext"
import { ECTheme } from "../../Themes/types"
import { BarChart, Bar, Tooltip, XAxis, YAxis, ResponsiveContainer } from "recharts"

Expand Down Expand Up @@ -34,7 +34,7 @@ const NetworkTypes = () => {
const classes = useStyles()
const theme: ECTheme = useTheme()

const { networks } = useEth2CrawlerApi()
const { networks } = useNodewatchCrawlerApi()

const chartData = useMemo(
() =>
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/SoftwareStats/OperatingSystems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: LGPL-3.0-only
import React, { useMemo } from "react"
import { createStyles, makeStyles, useTheme } from "@chainsafe/common-theme"
import { Typography } from "@chainsafe/common-components"
import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../../Contexts/NodewatchCrawlerContext"
import { ECTheme } from "../../Themes/types"
import { BarChart, Bar, Tooltip, XAxis, YAxis, ResponsiveContainer } from "recharts"

Expand Down Expand Up @@ -34,7 +34,7 @@ const OperatingSystems = () => {
const classes = useStyles()
const theme: ECTheme = useTheme()

const { operatingSystems } = useEth2CrawlerApi()
const { operatingSystems } = useNodewatchCrawlerApi()

const chartData = useMemo(
() =>
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/SoftwareStats/VersionVariance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, { useMemo } from "react"
import { createStyles, makeStyles, useTheme } from "@chainsafe/common-theme"
import { ECTheme } from "../../Themes/types"
import { Typography } from "@chainsafe/common-components"
import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../../Contexts/NodewatchCrawlerContext"
import { BarChart, Bar, Tooltip, XAxis, YAxis, ResponsiveContainer } from "recharts"
import { useCallback } from "react"
import ToolTipIcon from "../../Elements/Icons/ToolTipIcon"
Expand Down Expand Up @@ -53,7 +53,7 @@ const VersionVariance = () => {
const theme: ECTheme = useTheme()
const backgroundColors = Object.values(theme.constants.chartColors)

const { clientVersions } = useEth2CrawlerApi()
const { clientVersions } = useNodewatchCrawlerApi()

const sortedClientVersions = useMemo(
() =>
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ClientTypes from "../Modules/DemographicsStats/ClientTypes"
import HeatMap from "../Modules/HeatMap/MapLeaflet"
import NetworkTypes from "../Modules/SoftwareStats/NetworkTypes"
import OperatingSystems from "../Modules/SoftwareStats/OperatingSystems"
import { useEth2CrawlerApi } from "../../Contexts/Eth2CrawlerContext"
import { useNodewatchCrawlerApi } from "../../Contexts/NodewatchCrawlerContext"
import VersionVariance from "../Modules/SoftwareStats/VersionVariance"
import SectionTile from "../Layouts/SectionTile/SectionTile"
import CardStat from "../Layouts/SectionTile/CardStat"
Expand Down Expand Up @@ -68,7 +68,7 @@ const useStyles = makeStyles(({ constants, breakpoints, palette }: ECTheme) => {

function HomePage() {
const classes = useStyles()
const { nodeStats, nodeRegionalStats } = useEth2CrawlerApi()
const { nodeStats, nodeRegionalStats } = useNodewatchCrawlerApi()

return (
<div className={classes.root}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ import {
} from "../GraphQL/types/GetNodesByCountries"
import { GetAltAirUpgradePercentage } from "../GraphQL/types/GetAltAirUpgradePercentage"

type Eth2CrawlerContextProps = {
type NodewatchCrawlerContextProps = {
children: React.ReactNode | React.ReactNode[]
}

interface IEth2CrawlerContext {
interface INodewatchCrawlerContext {
clients: GetClientCounts_aggregateByAgentName[]
operatingSystems: GetOperatingSystems_aggregateByOperatingSystem[]
networks: GetNetworks_aggregateByNetwork[]
Expand All @@ -73,12 +73,12 @@ interface IEth2CrawlerContext {
isLoadingAltAirPercentage: boolean
}

const Eth2CrawlerContext = React.createContext<IEth2CrawlerContext | undefined>(undefined)
const NodewatchCrawlerContext = React.createContext<INodewatchCrawlerContext | undefined>(undefined)

const subgraphUrl = process.env.REACT_APP_GRAPHQL_URL || ""
const graphClient = new GraphQLClient(subgraphUrl)

const Eth2CrawlerProvider = ({ children }: Eth2CrawlerContextProps) => {
const NodewatchCrawlerProvider = ({ children }: NodewatchCrawlerContextProps) => {
const [nodeStats, setNodeStats] = useState<GetNodeStats_getNodeStats | undefined>(undefined)
const [nodeRegionalStats, setNodeRegionalStats] = useState<
GetRegionalStats_getRegionalStats | undefined
Expand Down Expand Up @@ -194,7 +194,7 @@ const Eth2CrawlerProvider = ({ children }: Eth2CrawlerContextProps) => {
}, [])

return (
<Eth2CrawlerContext.Provider
<NodewatchCrawlerContext.Provider
value={{
nodeStats,
nodeStatsOverTime,
Expand All @@ -219,16 +219,16 @@ const Eth2CrawlerProvider = ({ children }: Eth2CrawlerContextProps) => {
}}
>
{children}
</Eth2CrawlerContext.Provider>
</NodewatchCrawlerContext.Provider>
)
}

const useEth2CrawlerApi = () => {
const context = React.useContext(Eth2CrawlerContext)
const useNodewatchCrawlerApi = () => {
const context = React.useContext(NodewatchCrawlerContext)
if (context === undefined) {
throw new Error("useEth2CrawlerApi must be used within a Eth2CrawlerProvider")
throw new Error("useNodewatchCrawlerApi must be used within a NodewatchCrawlerProvider")
}
return context
}

export { Eth2CrawlerProvider, useEth2CrawlerApi }
export { useNodewatchCrawlerApi, NodewatchCrawlerProvider }