Merge branch 'main' into fixes

This commit is contained in:
TrèsAbhi authored and GitHub committed 2026-05-14 22:47:53 -05:00
commit a188a01244
5 files changed
+98 -81

No files matched your search

+18 -8
View File
@@ -58,12 +58,14 @@ export function Guesser() {
const [results, setResults] = useState<TankDefinition[] | null>(null);
const [selected, setSelected] = useState<TankDefinition | null>(null);
const tiers = Guess.use((state) => state.tiers);
const status = useRef<HTMLSpanElement>(null);
const requestSearch = useCallback(() => {
setSelected(null);
setSearching(true);
search();
}, []);
const search = useCallback(
debounce(() => {
if (!input.current) return;
@@ -92,6 +94,20 @@ export function Guesser() {
if (guessState !== GuessState.NotGuessed) setSelected(null);
}, [guessState]);
useEffect(() => {
const interval = setInterval(() => {
if (!status.current) return;
status.current.innerText = literals(strings.website.tools.guess.stats, {
correct: correctGuesses,
total: totalGuesses,
streak: streak,
});
}, 1000 / 200);
return () => clearInterval(interval);
}, [correctGuesses, totalGuesses, streak]);
return (
<Flex
direction="column"
@@ -158,13 +174,7 @@ export function Guesser() {
</Box>
<Flex justify="center" style={{ userSelect: "none" }}>
<Text>
{literals(strings.website.tools.guess.stats, {
correct: correctGuesses,
total: totalGuesses,
streak: streak,
})}
</Text>
<Text ref={status} />
</Flex>
<Flex gap={{ initial: "2", sm: "3" }}>
@@ -312,7 +322,7 @@ export function Guesser() {
? GuessState.Correct
: GuessState.Incorrect;
draft.totalGuesses++;
draft.correctGuesses += correct ? 1 : 0;
draft.correctGuesses += correct && draft.tiers.length === 10 ? 1 : 0;
draft.streak = correct ? draft.streak + 1 : 0;
});
} else {
@@ -70,37 +70,6 @@ export function Equalizer() {
<Switch checked={equalize} />
</Flex>
</Box>
<Popover.Root>
<Popover.Trigger>
<Text style={{ cursor: "pointer" }} size="2" color="gray">
<Flex align="center" gap="2">
Brought to you by{" "}
<img
src="/assets/images/third-party/wotb-news.png"
style={{
width: "1rem",
height: "1rem",
objectFit: "cover",
borderRadius: "50%",
}}
/>{" "}
WoTB News <InfoCircledIcon />
</Flex>
</Text>
</Popover.Trigger>
<Popover.Content>
<Text>
This feature was brought to you early, ahead of the release of the
game mode, thanks to{" "}
<Link href="https://discord.gg/WHdER7ZPAD" target="_blank">
WoTB News
</Link>
.
</Text>
</Popover.Content>
</Popover.Root>
</ConfigurationChildWrapper>
);
}