-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathForceDisarmModal.jsx
More file actions
52 lines (48 loc) · 1.53 KB
/
ForceDisarmModal.jsx
File metadata and controls
52 lines (48 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { Button, Modal, Text } from "@mantine/core"
import { useDispatch, useSelector } from "react-redux"
import {
emitArmDisarm,
selectForceDisarmModalOpened,
setForceDisarmModalOpened,
} from "../../redux/slices/droneConnectionSlice"
export default function ForceDisarmModal() {
const dispatch = useDispatch()
const isOpen = useSelector(selectForceDisarmModalOpened)
const handleForceDisarm = () => {
dispatch(emitArmDisarm({ arm: false, force: true }))
dispatch(setForceDisarmModalOpened(false))
}
const handleCancel = () => {
dispatch(setForceDisarmModalOpened(false))
}
return (
<Modal
opened={isOpen}
onClose={handleCancel}
title="Failed to Disarm"
centered
>
<div className="flex flex-col gap-4">
<Text>
The aircraft failed to disarm normally. This could be because the
aircraft is still in the air or has other safety concerns.
</Text>
<Text weight={700} color="red">
Do you want to force disarm the aircraft?
</Text>
<Text size="sm" color="dimmed">
Warning: Force disarming bypasses safety checks and could cause the
aircraft to crash if it's still airborne.
</Text>
<div className="flex gap-2">
<Button onClick={handleCancel} variant="default" className="grow">
Cancel
</Button>
<Button onClick={handleForceDisarm} color="red" className="grow">
Force Disarm
</Button>
</div>
</div>
</Modal>
)
}