Skip to content

Commit 82544af

Browse files
committed
get map ids from dashboard instead of hardcode
1 parent 9778247 commit 82544af

File tree

3 files changed

+17
-59
lines changed

3 files changed

+17
-59
lines changed

src/break.jsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
useCurrentRound,
1414
useCurrentScores,
1515
useCurrentTeams,
16+
useLoadedData,
1617
} from "./replicants"
17-
import { AnimatePresence, LayoutGroup, motion } from "framer-motion"
18-
import { maps } from "./utils"
18+
import { AnimatePresence, motion } from "framer-motion"
1919
import { forwardRef, useEffect, useState } from "react"
2020

2121
const animateContainer = {
@@ -72,6 +72,7 @@ const Main = () => {
7272
const scores = useCurrentScores()
7373
const mapWinners = useCurrentMapWinners()
7474
const data = useLeaderboard()
75+
const { maps } = useLoadedData()
7576

7677
return (
7778
<div className="absolute inset-0 text-white flex flex-col items-center justify-evenly z-10">
@@ -126,12 +127,12 @@ const Main = () => {
126127
}}
127128
className="absolute inset-0 rounded-lg bg-cover bg-center"
128129
style={{
129-
backgroundImage: `url('https://sendou.ink/static-assets/img/stages/${maps.indexOf(
130-
game.map
131-
)}.png')`,
130+
backgroundImage: `url('https://sendou.ink/static-assets/img/stages/${
131+
maps.indexOf(game.map) - 1
132+
}.png')`,
132133
}}
133134
/>
134-
{maps.indexOf(game.map) === -1 && (
135+
{maps.indexOf(game.map) - 1 < 0 && (
135136
<span className="text-9xl font-bold">?</span>
136137
)}
137138
{mapWinners?.[i] && (

src/replicants.ts

+10
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ export const useCurrentTeams = () =>
6767
},
6868
])
6969

70+
export const useLoadedData = () =>
71+
useReplicant("cq-dashboard.loadedData", {
72+
rounds: {},
73+
teams: {},
74+
blocks: {},
75+
colors: [],
76+
maps: [],
77+
modes: [],
78+
})
79+
7080
export const useLastFmData = () =>
7181
useReplicant("cq-dashboard.lastFmData", {
7282
enabled: false,

src/utils.js

-53
This file was deleted.

0 commit comments

Comments
 (0)