mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: disable selecting 0 tiers
This commit is contained in:
1 parent
7997f490fc
commit
85cd70b2d5
2 files changed
+6
-24
No files matched your search
@@ -189,6 +189,8 @@ export function Guesser() {
|
|||||||
|
|
||||||
Guess.mutate((draft) => {
|
Guess.mutate((draft) => {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
|
if (draft.tiers.length === 1) return;
|
||||||
|
|
||||||
draft.tiers = draft.tiers.filter((t) => t !== tier);
|
draft.tiers = draft.tiers.filter((t) => t !== tier);
|
||||||
} else {
|
} else {
|
||||||
draft.tiers = [...draft.tiers, tier];
|
draft.tiers = [...draft.tiers, tier];
|
||||||
@@ -290,7 +292,6 @@ export function Guesser() {
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
size="3"
|
size="3"
|
||||||
disabled={tiers.length === 0}
|
|
||||||
color={
|
color={
|
||||||
guessState === GuessState.NotGuessed && selected === null
|
guessState === GuessState.NotGuessed && selected === null
|
||||||
? "red"
|
? "red"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Box, Flex, Heading, Text } 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";
|
||||||
@@ -65,7 +65,9 @@ function Content({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
const tiers = Guess.use((state) => state.tiers);
|
const tiers = Guess.use((state) => state.tiers);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (tiers.length === 0) return;
|
const isTankAlreadyCompliant = tiers.includes(tank.tier);
|
||||||
|
|
||||||
|
if (isTankAlreadyCompliant) return;
|
||||||
|
|
||||||
const filteredIds = ids.filter((id) => {
|
const filteredIds = ids.filter((id) => {
|
||||||
const tank = tankDefinitions.tanks[Number(id)];
|
const tank = tankDefinitions.tanks[Number(id)];
|
||||||
@@ -90,27 +92,6 @@ function Content({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
<Flex flexGrow="1" position="relative" overflow="hidden">
|
<Flex flexGrow="1" position="relative" overflow="hidden">
|
||||||
<GuessBackground />
|
<GuessBackground />
|
||||||
|
|
||||||
{tiers.length === 0 && (
|
|
||||||
<Box
|
|
||||||
position="absolute"
|
|
||||||
top="50%"
|
|
||||||
left="50%"
|
|
||||||
style={{
|
|
||||||
transform: "translate(-50%, -50%)",
|
|
||||||
zIndex: 100,
|
|
||||||
textAlign: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text
|
|
||||||
size="8"
|
|
||||||
weight="bold"
|
|
||||||
style={{ color: "white", textShadow: "0 2px 8px rgba(0,0,0,0.5)" }}
|
|
||||||
>
|
|
||||||
Select tier(s) to start playing
|
|
||||||
</Text>
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Heading
|
<Heading
|
||||||
style={{
|
style={{
|
||||||
transitionDuration,
|
transitionDuration,
|
||||||
|
|||||||
Reference in new issue
Block a user