Skip to content

Commit 062c3ec

Browse files
committed
Revert to old timer style for ranked + pin asset loading impr
1 parent 7b65143 commit 062c3ec

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

components/Map.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,19 @@ const MapComponent = ({ shown, options, ws, session, pinPoint, setPinPoint, answ
154154
// Cache icons to prevent repeated requests
155155
const icons = useMemo(() => ({
156156
dest: L.icon({
157-
iconUrl: './dest.png',
157+
iconUrl: asset('/dest.png'),
158158
iconSize: [25, 41],
159159
iconAnchor: [12, 41],
160160
popupAnchor: [1, -34],
161161
}),
162162
src: L.icon({
163-
iconUrl: './src.png',
163+
iconUrl: asset('/src.png'),
164164
iconSize: [25, 41],
165165
iconAnchor: [12, 41],
166166
popupAnchor: [1, -34],
167167
}),
168168
src2: L.icon({
169-
iconUrl: './src2.png',
169+
iconUrl: asset('/src2.png'),
170170
iconSize: [25, 41],
171171
iconAnchor: [12, 41],
172172
popupAnchor: [1, -34],

components/gameUI.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,18 @@ session={session}/>
839839
}
840840
}} />
841841
)}
842-
<span className={`timer timer--two-line ${multiplayerState?.gameData?.duel && multiplayerState?.gameData?.public ? 'duel' : ''} ${!multiplayerTimerShown ? '' : 'shown'} ${timeToNextMultiplayerEvt <= 5 && timeToNextMultiplayerEvt > 0 && !showAnswer && !pinPoint && multiplayerState?.gameData?.state === 'guess' ? 'critical' : ''}`}>
842+
{/* Duel timer — single line, old style */}
843+
{multiplayerState?.gameData?.duel && multiplayerState?.gameData?.public && (
844+
<span className={`timer duel ${!multiplayerTimerShown ? '' : 'shown'} ${timeToNextMultiplayerEvt <= 5 && timeToNextMultiplayerEvt > 0 && !showAnswer && !pinPoint && multiplayerState?.gameData?.state === 'guess' ? 'critical' : ''}`}>
845+
{multiplayerState?.gameData?.timePerRound === 86400000 && timeToNextMultiplayerEvt > 120
846+
? text("round", {r:multiplayerState?.gameData?.curRound, mr: multiplayerState?.gameData?.rounds})
847+
: text("roundTimer", {r:multiplayerState?.gameData?.curRound, mr: multiplayerState?.gameData?.rounds, t: timeToNextMultiplayerEvt.toFixed(1)})}
848+
</span>
849+
)}
850+
851+
{/* Non-duel multiplayer timer — two line style */}
852+
{!(multiplayerState?.gameData?.duel && multiplayerState?.gameData?.public) && (
853+
<span className={`timer timer--two-line ${!multiplayerTimerShown ? '' : 'shown'} ${timeToNextMultiplayerEvt <= 5 && timeToNextMultiplayerEvt > 0 && !showAnswer && !pinPoint && multiplayerState?.gameData?.state === 'guess' ? 'critical' : ''}`}>
843854
<span className="timer__round-label">{text("round", {r:multiplayerState?.gameData?.curRound, mr: multiplayerState?.gameData?.rounds})}</span>
844855
<span className="timer__main-row">
845856
{!(multiplayerState?.gameData?.timePerRound === 86400000 && timeToNextMultiplayerEvt > 120)
@@ -848,6 +859,7 @@ session={session}/>
848859
}
849860
</span>
850861
</span>
862+
)}
851863

852864
<span className={`timer timer--two-line ${!onboardingTimerShown ? '' : 'shown'} ${timeToNextRound <= 5 && timeToNextRound > 0 && !showAnswer && !pinPoint && onboarding ? 'critical' : ''}`}>
853865
<span className="timer__round-label">{text("round", {r:onboarding?.round, mr: 5})}</span>

components/home.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,16 +1990,11 @@ export default function Home({ }) {
19901990
}
19911991
}
19921992

1993-
// preload/cache src.png and dest.png and src2.png
1994-
const img = new Image();
1995-
img.src = "./src.png";
1996-
const img2 = new Image();
1997-
img2.src = "./dest.png";
1998-
const img3 = new Image();
1999-
img3.src = "./src2.png";
2000-
// easter eggs too
2001-
const polandball = new Image();
2002-
polandball.src = "./polandball.png";
1993+
// preload/cache pin images
1994+
['/src.png', '/dest.png', '/src2.png', '/polandball.png'].forEach((p) => {
1995+
const img = new Image();
1996+
img.src = asset(p);
1997+
});
20031998
} catch (e) { }
20041999

20052000
}, [])

components/roundOverScreen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ const GameSummary = ({
106106
const checkLeaflet = () => {
107107
if (typeof window !== 'undefined' && window.L) {
108108
destIconRef.current = window.L.icon({
109-
iconUrl: './dest.png',
109+
iconUrl: asset('/dest.png'),
110110
iconSize: [30, 49],
111111
iconAnchor: [15, 49],
112112
popupAnchor: [1, -34],
113113
});
114114

115115
srcIconRef.current = window.L.icon({
116-
iconUrl: './src.png',
116+
iconUrl: asset('/src.png'),
117117
iconSize: [30, 49],
118118
iconAnchor: [15, 49],
119119
popupAnchor: [1, -34],
120120
});
121121

122122
src2IconRef.current = window.L.icon({
123-
iconUrl: './src2.png',
123+
iconUrl: asset('/src2.png'),
124124
iconSize: [30, 49],
125125
iconAnchor: [15, 49],
126126
popupAnchor: [1, -34],

0 commit comments

Comments
 (0)