removed unnecessary
This commit is contained in:
parent
99ad455caf
commit
b652cf49bf
|
|
@ -11,10 +11,6 @@ import {
|
||||||
DialogContent,
|
DialogContent,
|
||||||
Typography,
|
Typography,
|
||||||
TextField,
|
TextField,
|
||||||
FormControl,
|
|
||||||
Select,
|
|
||||||
MenuItem,
|
|
||||||
InputLabel,
|
|
||||||
DialogActions,
|
DialogActions,
|
||||||
Button,
|
Button,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
|
|
@ -38,19 +34,15 @@ export default function ChangeWaitForButton({
|
||||||
const getChain = useChainState((state) => state.getChain);
|
const getChain = useChainState((state) => state.getChain);
|
||||||
const updateAction = useChainState((state) => state.updateAction);
|
const updateAction = useChainState((state) => state.updateAction);
|
||||||
|
|
||||||
const [waitType, setWaitType] = useState<"seconds" | "minutes">(
|
|
||||||
action.waitFor! >= 60 ? "minutes" : "seconds",
|
|
||||||
);
|
|
||||||
|
|
||||||
const [waitFor, setWaitFor] = useState<string | number>(
|
const [waitFor, setWaitFor] = useState<string | number>(
|
||||||
action.waitFor >= 60 ? action.waitFor / 60 : action.waitFor,
|
action.waitFor >= 60 ? action.waitFor / 60 : 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
async function handleSave() {
|
async function handleSave() {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
let cleanWaitFor: number;
|
let cleanWaitFor: number;
|
||||||
|
|
||||||
if (waitFor === "") {
|
if (waitFor === "" || waitFor === "0") {
|
||||||
cleanWaitFor = 1;
|
cleanWaitFor = 1;
|
||||||
} else if (typeof waitFor === "string") {
|
} else if (typeof waitFor === "string") {
|
||||||
cleanWaitFor = parseInt(waitFor);
|
cleanWaitFor = parseInt(waitFor);
|
||||||
|
|
@ -58,7 +50,7 @@ export default function ChangeWaitForButton({
|
||||||
cleanWaitFor = waitFor;
|
cleanWaitFor = waitFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
action.waitFor = waitType === "seconds" ? cleanWaitFor : cleanWaitFor * 60;
|
action.waitFor = cleanWaitFor > 10 ? 10 * 60 : cleanWaitFor * 60;
|
||||||
updateAction(chainId, actionIndex, action);
|
updateAction(chainId, actionIndex, action);
|
||||||
|
|
||||||
const chain = getChain(chainId)!;
|
const chain = getChain(chainId)!;
|
||||||
|
|
@ -113,27 +105,11 @@ export default function ChangeWaitForButton({
|
||||||
name="waitFor"
|
name="waitFor"
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="Время"
|
label="Минуты"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
value={waitFor}
|
value={waitFor}
|
||||||
onChange={(event) => setWaitFor(event.target.value)}
|
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>
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import { Button, TextField } from "@mui/material";
|
||||||
import TextFieldsIcon from "@mui/icons-material/TextFields";
|
import TextFieldsIcon from "@mui/icons-material/TextFields";
|
||||||
import ImageIcon from "@mui/icons-material/Image";
|
import ImageIcon from "@mui/icons-material/Image";
|
||||||
import RecordVoiceOverIcon from "@mui/icons-material/RecordVoiceOver";
|
import RecordVoiceOverIcon from "@mui/icons-material/RecordVoiceOver";
|
||||||
import VideocamIcon from "@mui/icons-material/Videocam";
|
|
||||||
|
|
||||||
interface TabPanelProps {
|
interface TabPanelProps {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
|
|
@ -87,7 +86,6 @@ export default function ActionEditor({
|
||||||
icon={<RecordVoiceOverIcon />}
|
icon={<RecordVoiceOverIcon />}
|
||||||
{...a11yProps(2)}
|
{...a11yProps(2)}
|
||||||
/>
|
/>
|
||||||
<Tab label="Видео" icon={<VideocamIcon />} {...a11yProps(3)} />
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
@ -114,10 +112,6 @@ export default function ActionEditor({
|
||||||
<TabPanel value={value} index={2}>
|
<TabPanel value={value} index={2}>
|
||||||
In progress
|
In progress
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
|
||||||
<TabPanel value={value} index={3}>
|
|
||||||
In progress
|
|
||||||
</TabPanel>
|
|
||||||
</Box>
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user