Finally fix stat reduction modal
This commit is contained in:
parent
9d3b210bff
commit
5cf80639ab
@ -7,6 +7,7 @@ import {
|
|||||||
CardHeader,
|
CardHeader,
|
||||||
Heading,
|
Heading,
|
||||||
Input,
|
Input,
|
||||||
|
ListItem,
|
||||||
Modal,
|
Modal,
|
||||||
ModalBody,
|
ModalBody,
|
||||||
ModalContent,
|
ModalContent,
|
||||||
@ -16,8 +17,10 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
StackDivider,
|
StackDivider,
|
||||||
Text,
|
Text,
|
||||||
|
UnorderedList,
|
||||||
useDisclosure,
|
useDisclosure,
|
||||||
useToast,
|
useToast,
|
||||||
|
VStack,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
@ -104,21 +107,35 @@ export default function (props: GameAppealProps & { port?: MessagePort }) {
|
|||||||
<ModalOverlay />
|
<ModalOverlay />
|
||||||
<ModalContent>
|
<ModalContent>
|
||||||
<ModalHeader>
|
<ModalHeader>
|
||||||
<Heading>
|
<Heading size="sm">
|
||||||
How much should this player's stats be reduced by?
|
How much should this player's stats be reduced by?
|
||||||
</Heading>
|
</Heading>
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<Input
|
<VStack spacing={4}>
|
||||||
onBeforeInput={(e) => {
|
<Input
|
||||||
const value = (e.target as EventTarget & { value: string })
|
onBeforeInput={(e) => {
|
||||||
.value;
|
const value = (e.target as EventTarget & { value: string })
|
||||||
|
.value;
|
||||||
|
|
||||||
return !value.match(/\D/);
|
return (
|
||||||
}}
|
Boolean(value.match(/^-?\d{0,3}$/)) ||
|
||||||
onChange={(e) => setPercentage(parseInt(e.target.value))}
|
value === "-" ||
|
||||||
placeholder="Number between 0 and 100"
|
!value
|
||||||
/>
|
);
|
||||||
|
}}
|
||||||
|
onChange={(e) => setPercentage(parseInt(e.target.value))}
|
||||||
|
placeholder="Reduction factor"
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
|
<Text>Stat multiplication factors:</Text>
|
||||||
|
<br />
|
||||||
|
<UnorderedList>
|
||||||
|
<ListItem>Money: {Math.min(0.1 * percentage, 1)}</ListItem>
|
||||||
|
<ListItem>Parts: {Math.min(0.6 * percentage, 1)}</ListItem>
|
||||||
|
<ListItem>Derby Wins: {Math.min(0.6 * percentage, 1)}</ListItem>
|
||||||
|
</UnorderedList>
|
||||||
|
</VStack>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button colorScheme="red" onClick={onClose}>
|
<Button colorScheme="red" onClick={onClose}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user