mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
update guesser
This commit is contained in:
1 parent
6a05f11001
commit
f09663e1c0
4 files changed
+25
-27
No files matched your search
@@ -1,7 +1,6 @@
|
|||||||
import { Box } from "@radix-ui/themes";
|
import { Box } from "@radix-ui/themes";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { awaitableModelDefinitions } from "../../core/awaitables/modelDefinitions";
|
import { api } from "../../core/blitzkit/api";
|
||||||
import { awaitableProvisionDefinitions } from "../../core/awaitables/provisionDefinitions";
|
|
||||||
import { tankToDuelMember } from "../../core/blitzkit/tankToDuelMember";
|
import { tankToDuelMember } from "../../core/blitzkit/tankToDuelMember";
|
||||||
import { Var } from "../../core/radix/var";
|
import { Var } from "../../core/radix/var";
|
||||||
import { Duel } from "../../stores/duel";
|
import { Duel } from "../../stores/duel";
|
||||||
@@ -10,8 +9,8 @@ import { Tankopedia } from "../../stores/tankopedia";
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
const [modelDefinitions, provisionDefinitions] = await Promise.all([
|
const [modelDefinitions, provisionDefinitions] = await Promise.all([
|
||||||
awaitableModelDefinitions,
|
api.modelDefinitions(),
|
||||||
awaitableProvisionDefinitions,
|
api.provisionDefinitions(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export function GuessBackground() {
|
export function GuessBackground() {
|
||||||
@@ -42,7 +41,7 @@ export function GuessBackground() {
|
|||||||
? "accent-2"
|
? "accent-2"
|
||||||
: guessState === GuessState.Correct
|
: guessState === GuessState.Correct
|
||||||
? "jade-3"
|
? "jade-3"
|
||||||
: "tomato-3"
|
: "tomato-3",
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
asset,
|
|
||||||
SEARCH_KEYS,
|
SEARCH_KEYS,
|
||||||
TankDefinition,
|
TankDefinition,
|
||||||
TIER_ROMAN_NUMERALS,
|
TIER_ROMAN_NUMERALS,
|
||||||
@@ -29,8 +28,8 @@ import {
|
|||||||
import fuzzysort from "fuzzysort";
|
import fuzzysort from "fuzzysort";
|
||||||
import { debounce, times } from "lodash-es";
|
import { debounce, times } from "lodash-es";
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { awaitableTankDefinitions } from "../core/awaitables/tankDefinitions";
|
|
||||||
import { awaitableTankNames } from "../core/awaitables/tankNames";
|
import { awaitableTankNames } from "../core/awaitables/tankNames";
|
||||||
|
import { api } from "../core/blitzkit/api";
|
||||||
import { useLocale } from "../hooks/useLocale";
|
import { useLocale } from "../hooks/useLocale";
|
||||||
import { Guess, GuessState } from "../stores/guess";
|
import { Guess, GuessState } from "../stores/guess";
|
||||||
import { classIcons } from "./ClassIcon";
|
import { classIcons } from "./ClassIcon";
|
||||||
@@ -40,7 +39,7 @@ const { go } = fuzzysort;
|
|||||||
|
|
||||||
const [tankNames, tankDefinitions] = await Promise.all([
|
const [tankNames, tankDefinitions] = await Promise.all([
|
||||||
awaitableTankNames,
|
awaitableTankNames,
|
||||||
awaitableTankDefinitions,
|
api.tankDefinitions(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const ids = Object.keys(tankDefinitions.tanks);
|
const ids = Object.keys(tankDefinitions.tanks);
|
||||||
@@ -150,7 +149,7 @@ export function Guesser() {
|
|||||||
prefix={
|
prefix={
|
||||||
<img
|
<img
|
||||||
style={{ width: "1em", height: "1em" }}
|
style={{ width: "1em", height: "1em" }}
|
||||||
src={asset(`flags/circle/${result.nation}.webp`)}
|
src={`/api/flags/circle/${result.nation}.webp`}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
discriminator={
|
discriminator={
|
||||||
@@ -322,7 +321,8 @@ export function Guesser() {
|
|||||||
? GuessState.Correct
|
? GuessState.Correct
|
||||||
: GuessState.Incorrect;
|
: GuessState.Incorrect;
|
||||||
draft.totalGuesses++;
|
draft.totalGuesses++;
|
||||||
draft.correctGuesses += correct && draft.tiers.length === 10 ? 1 : 0;
|
draft.correctGuesses +=
|
||||||
|
correct && draft.tiers.length === 10 ? 1 : 0;
|
||||||
draft.streak = correct ? draft.streak + 1 : 0;
|
draft.streak = correct ? draft.streak + 1 : 0;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
import { Box, Flex, Heading } from "@radix-ui/themes";
|
import { Box, Flex, Heading } from "@radix-ui/themes";
|
||||||
import { Suspense, useEffect } from "react";
|
import { Suspense, useEffect } from "react";
|
||||||
import { GuessBackground } from "../../../components/GuessBackground";
|
import { GuessBackground } from "../../../../components/GuessBackground";
|
||||||
import { Guesser } from "../../../components/Guesser";
|
import { Guesser } from "../../../../components/Guesser";
|
||||||
import { GuessRenderer } from "../../../components/GuessRenderer";
|
import { GuessRenderer } from "../../../../components/GuessRenderer";
|
||||||
import { GuessRendererLoader } from "../../../components/GuessRendererLoader";
|
import { GuessRendererLoader } from "../../../../components/GuessRendererLoader";
|
||||||
import { PageWrapper } from "../../../components/PageWrapper";
|
import { PageWrapper } from "../../../../components/PageWrapper";
|
||||||
import { awaitableModelDefinitions } from "../../../core/awaitables/modelDefinitions";
|
import { api } from "../../../../core/blitzkit/api";
|
||||||
import { awaitableTankDefinitions } from "../../../core/awaitables/tankDefinitions";
|
|
||||||
import {
|
import {
|
||||||
type LocaleAcceptorProps,
|
type LocaleAcceptorProps,
|
||||||
LocaleProvider,
|
LocaleProvider,
|
||||||
useLocale,
|
useLocale,
|
||||||
} from "../../../hooks/useLocale";
|
} from "../../../../hooks/useLocale";
|
||||||
import { Duel } from "../../../stores/duel";
|
import { Duel } from "../../../../stores/duel";
|
||||||
import { Guess, GuessState } from "../../../stores/guess";
|
import { Guess, GuessState } from "../../../../stores/guess";
|
||||||
import { Tankopedia } from "../../../stores/tankopedia";
|
import { Tankopedia } from "../../../../stores/tankopedia";
|
||||||
import type { MaybeSkeletonComponentProps } from "../../../types/maybeSkeletonComponentProps";
|
import type { MaybeSkeletonComponentProps } from "../../../../types/maybeSkeletonComponentProps";
|
||||||
|
|
||||||
const [tankDefinitions, modelDefinitions] = await Promise.all([
|
const [tankDefinitions, modelDefinitions] = await Promise.all([
|
||||||
awaitableTankDefinitions,
|
api.tankDefinitions(),
|
||||||
awaitableModelDefinitions,
|
api.modelDefinitions(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const ids = Object.keys(tankDefinitions.tanks);
|
const ids = Object.keys(tankDefinitions.tanks);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import ToolOpenGraph from "../../../components/ToolOpenGraph.astro";
|
import ToolOpenGraph from "../../../../components/ToolOpenGraph.astro";
|
||||||
import { tools } from "../../../constants/tools";
|
import { tools } from "../../../../constants/tools";
|
||||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||||
import { Page } from "./_index";
|
import { Page } from "./_index";
|
||||||
|
|
||||||
export { getStaticPaths } from "../index.astro";
|
export { getStaticPaths } from "../index.astro";
|
||||||
|
|||||||
Reference in new issue
Block a user