From 1d77e66c09f4bc355d61a0b8aecff37562a8db4f Mon Sep 17 00:00:00 2001 From: Marco van Dijk Date: Fri, 22 Apr 2022 18:55:08 +0200 Subject: [PATCH] More radio buttons --- src/components/MonthlyGraphs.js | 62 ++++++++++++++------------------- src/pages/MonthlyStats.js | 2 +- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/components/MonthlyGraphs.js b/src/components/MonthlyGraphs.js index 8dce606..6567d5c 100644 --- a/src/components/MonthlyGraphs.js +++ b/src/components/MonthlyGraphs.js @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { useSelector } from 'react-redux'; import { VictoryPie } from 'victory'; -import { Pagination } from "@mantine/core"; +import { RadioGroup, Radio } from "@mantine/core"; const MonthlyGraphs = (obj) => { const livepeer = useSelector((state) => state.livepeerstate); @@ -372,47 +372,39 @@ const MonthlyGraphs = (obj) => { } } - let renderStake = false; - let renderEarnings = false; - let renderBread = false; - let graphIndex = activeGraph; - if (totalGraphs && stakeObj) { - if (graphIndex == 1) { - renderStake = true; - graphIndex = 0; - } else { - graphIndex--; - } - } - if (graphIndex == 1 && graphIndex && totalGraphs && earningsObj) { - if (graphIndex == 1) { - renderEarnings = true; - graphIndex = 0; - } else { - graphIndex--; - } - } - graphIndex--; - if (graphIndex == 1 && graphIndex && totalGraphs && broadcasterObj) { - if (graphIndex == 1) { - renderBread = true; - graphIndex = 0; - } else { - graphIndex--; - } + let thisColour; + if (activeGraph == 1) { + thisColour = "violet"; + } else if (activeGraph == 2) { + thisColour = "green"; + } else if (activeGraph == 3) { + thisColour = "orange"; } return ( -
+
{totalGraphs > 1 ? - +
+ + {(totalGraphs && stakeObj) ? : null} + {(totalGraphs && earningsObj) ? : null} + {(totalGraphs && broadcasterObj) ? : null} + +
: null}
-
- {renderStake ? stakeObj : null} - {renderEarnings ? earningsObj : null} - {renderBread ? broadcasterObj : null} +
+ {(activeGraph == 1) ? stakeObj : null} + {(activeGraph == 2) ? earningsObj : null} + {(activeGraph == 3) ? broadcasterObj : null}
) diff --git a/src/pages/MonthlyStats.js b/src/pages/MonthlyStats.js index ff91dd8..2f3cb4d 100644 --- a/src/pages/MonthlyStats.js +++ b/src/pages/MonthlyStats.js @@ -42,7 +42,7 @@ const MonthlyStats = (obj) => { activePage == 2 ?

Graphs

: null } { - activePage == 3 ?

orchestrators

: null + activePage == 3 ?

Orchestrators

: null }