diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-06-26 22:31:55 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-06-26 22:31:55 -0700 |
| commit | 900fca9e5dbf7a714acf9de061962895295aa8be (patch) | |
| tree | a9336573378be4b6cc2372ca14f43462a1f6de99 | |
| parent | 1a47e30a98bd9d4742197ec8df1b5633ca110c42 (diff) | |
seperate audio and MV stat charts
| -rw-r--r-- | src/components/Chart/index.tsx | 10 | ||||
| -rw-r--r-- | src/components/Game/index.tsx | 2 | ||||
| -rw-r--r-- | src/components/Result/index.tsx | 5 |
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} /> )} |
