From 2c00caf2094c7deea66e4f0de732b26a5584c8b5 Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Fri, 22 Apr 2022 19:11:09 +0200 Subject: [PATCH] better radio buttons --- src/components/MonthlyGraphs.js | 52 ++++++++++++++++++++++----------- src/pages/MonthlyStats.js | 34 ++++++++++++++------- 2 files changed, 58 insertions(+), 28 deletions(-) diff --git a/src/components/MonthlyGraphs.js b/src/components/MonthlyGraphs.js index 6567d5c..64797f9 100644 --- a/src/components/MonthlyGraphs.js +++ b/src/components/MonthlyGraphs.js @@ -1,11 +1,11 @@ import React, { useState } from 'react'; import { useSelector } from 'react-redux'; import { VictoryPie } from 'victory'; -import { RadioGroup, Radio } from "@mantine/core"; +import { SegmentedControl } from "@mantine/core"; const MonthlyGraphs = (obj) => { const livepeer = useSelector((state) => state.livepeerstate); - const [activeGraph, setGraph] = useState(1); + const [activeGraph, setGraph] = useState(2); let totalGraphs = 0; @@ -381,24 +381,42 @@ const MonthlyGraphs = (obj) => { thisColour = "orange"; } + let dataRow = []; + if (totalGraphs && stakeObj) { + dataRow.push({ label: 'Stake', value: '1' }); + } + if (totalGraphs && earningsObj) { + dataRow.push({ label: 'Earnings', value: '2' }); + } + if (totalGraphs && broadcasterObj) { + dataRow.push({ label: 'Broadcasters', value: '3' }); + } + return (
-
+
{totalGraphs > 1 ? -
- - {(totalGraphs && stakeObj) ? : null} - {(totalGraphs && earningsObj) ? : null} - {(totalGraphs && broadcasterObj) ? : null} - -
+ : null}
diff --git a/src/pages/MonthlyStats.js b/src/pages/MonthlyStats.js index 2f3cb4d..1648de4 100644 --- a/src/pages/MonthlyStats.js +++ b/src/pages/MonthlyStats.js @@ -2,10 +2,10 @@ import React, { useState } from 'react'; import MonthlyFactoids from '../components/MonthlyFactoids'; import MonthlyGraphs from '../components/MonthlyGraphs'; import MonthlyOrchestrators from '../components/MonthlyOrchestrators'; -import { RadioGroup, Radio } from "@mantine/core"; +import { SegmentedControl } from "@mantine/core"; const MonthlyStats = (obj) => { - const [activePage, setPage] = useState(0); + const [activePage, setPage] = useState(1); let thisColour; if (activePage == 1) { @@ -18,20 +18,32 @@ const MonthlyStats = (obj) => { return (
-
-
- + - - - - + data={[ + { label: 'Summary', value: '1' }, + { label: 'Graphs', value: '2' }, + { label: 'Orchestrators', value: '3' } + ]} + />