aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.tsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/app.tsx b/src/app.tsx
index ac8765f..b906eab 100644
--- a/src/app.tsx
+++ b/src/app.tsx
@@ -25,6 +25,26 @@ function App() {
const [didGuess, setDidGuess] = React.useState<boolean>(false);
const firstRun = localStorage.getItem("firstRun") === null;
+
+ function importStats () {
+ const queryParam = new URLSearchParams(window.location.search).get('statsImport') || "";
+ if (queryParam){
+ const importedStats = JSON.parse(queryParam)
+ if (Array.isArray(importedStats)) {
+ importedStats.forEach(day => {
+ if (Array.isArray(day.guesses)) {
+ if(day.guesses.length == 5){
+ day.guesses.push(initialGuess)
+ }
+ }
+ });
+ }
+ localStorage.setItem("stats", JSON.stringify(importedStats));
+ location.replace(location.pathname);
+ }
+ }
+ importStats()
+
let stats = JSON.parse(localStorage.getItem("stats") || "{}");
React.useEffect(() => {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage