Skip to content

Commit

Permalink
Check demo mode before changing setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariful Alam committed May 17, 2021
1 parent 69e8218 commit 9e6b634
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions resources/js/client/admin/components/portfolioConfig/Basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
import ColorPickerPopup from '../ColorPickerPopup';
import { CloseOutlined, CheckOutlined } from '@ant-design/icons';
import SeoPopup from '../SeoPopup';
import { useSelector } from 'react-redux';

const { Meta } = Card;
const { Item } = List;
Expand Down Expand Up @@ -44,6 +45,7 @@ const Basic = (props) => {
const [colorPickerVisible, setColorPickerVisible] = useState(false);
const [seoPopupVisible, setSeoPopupVisible] = useState(false);
const [seo, setSeo] = useState(null);
const { demoMode } = useSelector(state => state.globalState);

useEffect(() => {
props.mountedCallBack();
Expand Down Expand Up @@ -148,12 +150,15 @@ const Basic = (props) => {
}

const maintenanceModeOnChange = (checked) => {
if (demoMode) {
Utils.showNotification('This feature is disabled in demo', 'warning');
} else {
const callback = () => {
setMaintenanceMode(checked);
}

const callback = () => {
setMaintenanceMode(checked);
submitData(CoreConstants.portfolioConfig.MAINTENANCE_MODE, checked, callback);
}

submitData(CoreConstants.portfolioConfig.MAINTENANCE_MODE, checked, callback);
}

const changeTemplate = (
Expand Down
2 changes: 1 addition & 1 deletion resources/js/client/admin/components/settings/General.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const General = (props) => {
<a key="login-credentials-change" onClick={(e) => {
e.preventDefault();
if (props.globalState.demoMode) {
Utils.showNotification('This feature is not available in Demo', 'warning');
Utils.showNotification('This feature is disabled in demo', 'warning');
} else {
setLoginCredentialVisible(true);
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/client/admin/components/visitor/Visitors.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const Visitors = () => {

const showResetConfirm = () => {
if (demoMode) {
Utils.showNotification('This feature is not available in Demo', 'warning');
Utils.showNotification('This feature is disabled in demo', 'warning');
} else {
confirm({
confirmLoading: loading,
Expand Down

0 comments on commit 9e6b634

Please sign in to comment.