aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/settings/CommandGroupPage.js13
-rw-r--r--modern/src/settings/components/BaseCommandView.js13
2 files changed, 18 insertions, 8 deletions
diff --git a/modern/src/settings/CommandGroupPage.js b/modern/src/settings/CommandGroupPage.js
index b4852c26..e2ba3946 100644
--- a/modern/src/settings/CommandGroupPage.js
+++ b/modern/src/settings/CommandGroupPage.js
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
+import { useSelector } from 'react-redux';
import { useNavigate, useParams } from 'react-router-dom';
import {
Accordion,
@@ -50,6 +51,8 @@ const CommandDevicePage = () => {
const { id } = useParams();
+ const textEnabled = useSelector((state) => state.session.server.textEnabled);
+
const [item, setItem] = useState({ type: 'custom', attributes: {} });
const handleSend = useCatch(async () => {
@@ -88,10 +91,12 @@ const CommandDevicePage = () => {
onChange={(e) => setItem({ ...item, attributes: { ...item.attributes, data: e.target.value } })}
label={t('commandData')}
/>
- <FormControlLabel
- control={<Checkbox checked={item.textChannel} onChange={(event) => setItem({ ...item, textChannel: event.target.checked })} />}
- label={t('commandSendSms')}
- />
+ {textEnabled && (
+ <FormControlLabel
+ control={<Checkbox checked={item.textChannel} onChange={(event) => setItem({ ...item, textChannel: event.target.checked })} />}
+ label={t('commandSendSms')}
+ />
+ )}
</AccordionDetails>
</Accordion>
<div className={classes.buttons}>
diff --git a/modern/src/settings/components/BaseCommandView.js b/modern/src/settings/components/BaseCommandView.js
index 1ba6a37c..acf39090 100644
--- a/modern/src/settings/components/BaseCommandView.js
+++ b/modern/src/settings/components/BaseCommandView.js
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react';
+import { useSelector } from 'react-redux';
import {
TextField, FormControlLabel, Checkbox,
} from '@mui/material';
@@ -10,6 +11,8 @@ import useCommandAttributes from '../../common/attributes/useCommandAttributes';
const BaseCommandView = ({ deviceId, item, setItem }) => {
const t = useTranslation();
+ const textEnabled = useSelector((state) => state.session.server.textEnabled);
+
const availableAttributes = useCommandAttributes(t);
const [attributes, setAttributes] = useState([]);
@@ -63,10 +66,12 @@ const BaseCommandView = ({ deviceId, item, setItem }) => {
/>
);
})}
- <FormControlLabel
- control={<Checkbox checked={item.textChannel} onChange={(event) => setItem({ ...item, textChannel: event.target.checked })} />}
- label={t('commandSendSms')}
- />
+ {textEnabled && (
+ <FormControlLabel
+ control={<Checkbox checked={item.textChannel} onChange={(event) => setItem({ ...item, textChannel: event.target.checked })} />}
+ label={t('commandSendSms')}
+ />
+ )}
</>
);
};