-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable macro send button when port is closed.
- Loading branch information
Showing
3 changed files
with
57 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,66 @@ | ||
import { | ||
Box, | ||
Button, | ||
ButtonPropsColorOverrides, | ||
FormControl, | ||
FormControlLabel, | ||
IconButton, | ||
InputAdornment, | ||
InputLabel, | ||
MenuItem, | ||
Select, | ||
Switch, | ||
TextField, | ||
Tooltip, | ||
Typography, | ||
useMediaQuery, | ||
} from "@mui/material"; | ||
import CancelIcon from "@mui/icons-material/Cancel"; | ||
import DeleteIcon from "@mui/icons-material/Delete"; | ||
import { OverridableStringUnion } from "@mui/types"; | ||
import KofiButton from "kofi-button"; | ||
import { IconButton, TextField, Tooltip } from "@mui/material"; | ||
import { observer } from "mobx-react-lite"; | ||
import { ResizableBox } from "react-resizable"; | ||
import "react-resizable/css/styles.css"; | ||
import SendIcon from "@mui/icons-material/Send"; | ||
import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; | ||
import MoreHorizIcon from '@mui/icons-material/MoreHoriz'; | ||
import MoreHorizIcon from "@mui/icons-material/MoreHoriz"; | ||
|
||
import { App, PortType } from "src/model/App"; | ||
import { PortState } from "src/model/Settings/PortConfigurationSettings/PortConfigurationSettings"; | ||
import SingleTerminalView from "../SingleTerminal/SingleTerminalView"; | ||
import { DataViewConfiguration, dataViewConfigEnumToDisplayName } from "src/model/Settings/DisplaySettings/DisplaySettings"; | ||
import ApplyableTextFieldView from "src/view/Components/ApplyableTextFieldView"; | ||
import { portStateToButtonProps } from "src/view/Components/PortStateToButtonProps"; | ||
import { Macro } from "src/model/Terminals/RightDrawer/Macros/Macros"; | ||
import { App } from "src/model/App"; | ||
import { PortState } from "src/model/Settings/PortConfigurationSettings/PortConfigurationSettings"; | ||
|
||
interface Props { | ||
app: App; | ||
macro: Macro; | ||
} | ||
|
||
export default observer((props: Props) => { | ||
const { macro } = props; | ||
const { app, macro } = props; | ||
|
||
return ( | ||
<div style={{ display: "flex", alignItems: "center" }}> | ||
<span>{macro.name}</span> | ||
{/* ================================================ */} | ||
{/* MACRO DATA */} | ||
{/* ================================================ */} | ||
<Tooltip | ||
title='The data to send for this macro.' | ||
enterDelay={500} | ||
arrow | ||
<div style={{ display: "flex", alignItems: "center" }}> | ||
<span>{macro.name}</span> | ||
{/* ================================================ */} | ||
{/* MACRO DATA */} | ||
{/* ================================================ */} | ||
<Tooltip title="The data to send for this macro." enterDelay={500} arrow> | ||
<TextField | ||
size="small" | ||
variant="outlined" | ||
inputProps={{ | ||
style: { | ||
padding: 5, | ||
}, | ||
}} | ||
value={macro.data} | ||
onChange={(e) => macro.setData(e.target.value)} | ||
onKeyDown={(e) => { | ||
e.stopPropagation(); | ||
}} // Don't want the global keydown event to trigger | ||
/> | ||
</Tooltip> | ||
{/* ================================================ */} | ||
{/* MACRO SEND BUTTON */} | ||
{/* ================================================ */} | ||
<Tooltip title="Send the data to the serial port." enterDelay={500} arrow> | ||
<IconButton | ||
aria-label="send-macro-data" | ||
size="small" | ||
style={{ padding: "1px" }} | ||
disabled={app.portState !== PortState.OPENED} | ||
onClick={() => { | ||
macro.send(); | ||
}} | ||
> | ||
<TextField | ||
size="small" | ||
variant="outlined" | ||
inputProps={{ | ||
style: { | ||
padding: 5, | ||
}, | ||
}} | ||
></TextField> | ||
</Tooltip> | ||
{/* ================================================ */} | ||
{/* MACRO SEND BUTTON */} | ||
{/* ================================================ */} | ||
<Tooltip | ||
title='Send the data to the serial port.' | ||
enterDelay={500} | ||
arrow | ||
> | ||
<IconButton aria-label="delete" size="small" style={{ padding: '1px' }}> | ||
<ArrowForwardIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
{/* MACRO MORE SETTINGS BUTTON */} | ||
{/* ================================================ */} | ||
<Tooltip | ||
title='More settings for this macro.' | ||
enterDelay={500} | ||
arrow | ||
> | ||
<IconButton aria-label="delete" size="small" style={{ padding: '1px' }}> | ||
</Tooltip> | ||
{/* MACRO MORE SETTINGS BUTTON */} | ||
{/* ================================================ */} | ||
<Tooltip title="More settings for this macro." enterDelay={500} arrow> | ||
<IconButton aria-label="more-settings-for-macro" size="small" style={{ padding: "1px" }}> | ||
<MoreHorizIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
</div> | ||
</Tooltip> | ||
</div> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters