From 4648f7c4f5d19c29fbfcc706dcca81bc375c1479 Mon Sep 17 00:00:00 2001 From: Liam <67254223+RealFascinated@users.noreply.github.com> Date: Wed, 19 Oct 2022 16:37:20 +0100 Subject: [PATCH] Migrated leaderboard type to radios --- pages/index.js | 62 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/pages/index.js b/pages/index.js index cbb083c..4c91ece 100644 --- a/pages/index.js +++ b/pages/index.js @@ -6,6 +6,7 @@ import { Input, Link, Modal, + Radio, Spacer, Switch, Text, @@ -31,7 +32,7 @@ export default class Home extends Component { values: { socketAddr: undefined, - useBeatLeader: false, + leaderboard: "ScoreSaber", showPlayerStats: true, showScoreInfo: false, showSongInfo: false, @@ -58,7 +59,15 @@ export default class Home extends Component { ); } else { const json = JSON.parse(localStorage.getItem("values")); - this.setState({ steamId: json.steamId, values: json.values }); + let values = {}; + Object.entries(json.values).forEach((value) => { + if (value[0] === undefined) { + return; + } + values[value[0]] = value[1]; + }); + + this.setState({ steamId: json.steamId, values: values }); } this.setState({ loading: false }); } @@ -76,8 +85,8 @@ export default class Home extends Component { if (value[1] === undefined) { return; } - if (value[0] == "useBeatLeader" && value[1] === true) { - values += `&beatLeader=${value[1]}`; + if (value[0] == "leaderboard" && value[1] === "BeatLeader") { + values += `&beatLeader=true`; return; } values += `&${value[0]}=${value[1]}`; @@ -112,7 +121,6 @@ export default class Home extends Component { } render() { - console.log(this.state.steamId); return this.state.loading ? (