aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/components/Chart/index.tsx10
-rw-r--r--src/components/Game/index.tsx2
-rw-r--r--src/components/Result/index.tsx5
3 files changed, 12 insertions, 5 deletions
diff --git a/src/components/Chart/index.tsx b/src/components/Chart/index.tsx
index 6aac91e..16336c8 100644
--- a/src/components/Chart/index.tsx
+++ b/src/components/Chart/index.tsx
@@ -21,6 +21,7 @@ interface Props {
currentTry: number;
didGuess: boolean;
sessionDate: string;
+ mode?: "daily" | "dailyMV";
}
interface HistoricalPlayData {
@@ -32,9 +33,11 @@ interface HistoricalPlayData {
type GuessCount = 1 | 2 | 3 | 4 | 5 | 6;
type Distribution = Record<GuessCount, number> & { NS: number };
-function getHistoricalPlayData(): HistoricalPlayData {
+function getHistoricalPlayData(mode: "daily" | "dailyMV"): HistoricalPlayData {
+ const storageKey =
+ mode === "dailyMV" ? "historicalPlayDataMV" : "historicalPlayData";
try {
- return JSON.parse(localStorage.getItem("historicalPlayData") || "{}");
+ return JSON.parse(localStorage.getItem(storageKey) || "{}");
} catch {
return {};
}
@@ -59,8 +62,9 @@ export default function GuessDistributionChart({
currentTry,
didGuess,
sessionDate,
+ mode = "daily",
}: Props) {
- const historicalPlayData = getHistoricalPlayData();
+ const historicalPlayData = getHistoricalPlayData(mode);
const distribution: Distribution = {
1: 0,
diff --git a/src/components/Game/index.tsx b/src/components/Game/index.tsx
index 8e16d46..85c4e95 100644
--- a/src/components/Game/index.tsx
+++ b/src/components/Game/index.tsx
@@ -107,7 +107,7 @@ export function Game({
currentTry={currentTry}
todaysSolution={todaysSolution}
guesses={guesses}
- mode={mode === "dailyMV" ? "daily" : mode}
+ mode={mode}
sessionDate={sessionDate}
onPlayAgain={onPlayAgain}
/>
diff --git a/src/components/Result/index.tsx b/src/components/Result/index.tsx
index 21d1a1b..94a59cf 100644
--- a/src/components/Result/index.tsx
+++ b/src/components/Result/index.tsx
@@ -91,7 +91,7 @@ interface Props {
currentTry: number;
todaysSolution: Song;
guesses: GuessType[];
- mode?: "daily" | "unlimited";
+ mode?: "daily" | "unlimited" | "dailyMV";
sessionDate: string;
onPlayAgain?: () => void;
}
@@ -131,6 +131,7 @@ export function Result({
}, []);
const isUnlimited = mode === "unlimited";
+ const chartMode = mode === "dailyMV" ? "dailyMV" : "daily";
if (didGuess) {
const textForTry = ["Perfect!", "Wow!", "Super!", "Congrats!", "Nice!"];
@@ -150,6 +151,7 @@ export function Result({
currentTry={currentTry}
didGuess={didGuess}
sessionDate={sessionDate}
+ mode={chartMode}
/>
)}
@@ -183,6 +185,7 @@ export function Result({
currentTry={currentTry}
didGuess={didGuess}
sessionDate={sessionDate}
+ mode={chartMode}
/>
)}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage