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