removed unnecessary

This commit is contained in:
Robert 2024-03-11 21:03:54 +07:00
parent 99ad455caf
commit b652cf49bf
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22
2 changed files with 4 additions and 34 deletions

View File

@ -11,10 +11,6 @@ import {
DialogContent,
Typography,
TextField,
FormControl,
Select,
MenuItem,
InputLabel,
DialogActions,
Button,
} from "@mui/material";
@ -38,19 +34,15 @@ export default function ChangeWaitForButton({
const getChain = useChainState((state) => state.getChain);
const updateAction = useChainState((state) => state.updateAction);
const [waitType, setWaitType] = useState<"seconds" | "minutes">(
action.waitFor! >= 60 ? "minutes" : "seconds",
);
const [waitFor, setWaitFor] = useState<string | number>(
action.waitFor >= 60 ? action.waitFor / 60 : action.waitFor,
action.waitFor >= 60 ? action.waitFor / 60 : 1,
);
async function handleSave() {
setLoading(true);
let cleanWaitFor: number;
if (waitFor === "") {
if (waitFor === "" || waitFor === "0") {
cleanWaitFor = 1;
} else if (typeof waitFor === "string") {
cleanWaitFor = parseInt(waitFor);
@ -58,7 +50,7 @@ export default function ChangeWaitForButton({
cleanWaitFor = waitFor;
}
action.waitFor = waitType === "seconds" ? cleanWaitFor : cleanWaitFor * 60;
action.waitFor = cleanWaitFor > 10 ? 10 * 60 : cleanWaitFor * 60;
updateAction(chainId, actionIndex, action);
const chain = getChain(chainId)!;
@ -113,27 +105,11 @@ export default function ChangeWaitForButton({
name="waitFor"
fullWidth
variant="outlined"
label="Время"
label="Минуты"
autoComplete="off"
value={waitFor}
onChange={(event) => setWaitFor(event.target.value)}
/>
<FormControl fullWidth>
<InputLabel id="waitType">Тип</InputLabel>
<Select
error={isError}
id="waitType"
label="Тип"
value={waitType}
onChange={(event) =>
setWaitType(event.target.value as "seconds" | "minutes")
}
>
<MenuItem value="seconds">Секунды</MenuItem>
<MenuItem value="minutes">Минуты</MenuItem>
</Select>
</FormControl>
</div>
</div>
</DialogContent>

View File

@ -9,7 +9,6 @@ import { Button, TextField } from "@mui/material";
import TextFieldsIcon from "@mui/icons-material/TextFields";
import ImageIcon from "@mui/icons-material/Image";
import RecordVoiceOverIcon from "@mui/icons-material/RecordVoiceOver";
import VideocamIcon from "@mui/icons-material/Videocam";
interface TabPanelProps {
children?: React.ReactNode;
@ -87,7 +86,6 @@ export default function ActionEditor({
icon={<RecordVoiceOverIcon />}
{...a11yProps(2)}
/>
<Tab label="Видео" icon={<VideocamIcon />} {...a11yProps(3)} />
</Tabs>
</Box>
@ -114,10 +112,6 @@ export default function ActionEditor({
<TabPanel value={value} index={2}>
In progress
</TabPanel>
<TabPanel value={value} index={3}>
In progress
</TabPanel>
</Box>
</div>