Skip to content

Commit

Permalink
Remove control mode for light settings
Browse files Browse the repository at this point in the history
  • Loading branch information
maca88 committed Jun 13, 2022
1 parent d8072e4 commit f0a84a3
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions Source/light-configurator/src/components/LightSettings.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import React, { useEffect, useCallback } from 'react';
import React, { useCallback } from 'react';
import Grid from '@mui/material/Grid';
import { action } from 'mobx';
import { observer } from 'mobx-react-lite';
import LightButton from '../models/LightButton';
import ButtonGroup from './ButtonGroup';
import AddButton from './AddButton';
import { controlMode } from '../constants';
import AppTextInput from '../inputs/AppTextInput';

const getModes = (lightModes) => {
return [controlMode].concat(lightModes);
};

export default observer(({ lightSettings, lightModes, }) => {
const [modes, setModes] = React.useState(lightModes);
const moveButton = action(useCallback((dragIndex, hoverIndex) => {
const dragButton = lightSettings.buttons[dragIndex]
lightSettings.buttons.splice(dragIndex, 1);
Expand All @@ -28,10 +22,6 @@ export default observer(({ lightSettings, lightModes, }) => {
lightSettings.buttons.remove(button);
});

useEffect(() => {
setModes(getModes(lightModes));
}, [lightModes]);

return (
<div>
<Grid container spacing={3}>
Expand All @@ -44,7 +34,7 @@ export default observer(({ lightSettings, lightModes, }) => {
<ButtonGroup
key={button.id}
buttonGroup={button}
lightModes={modes}
lightModes={lightModes}
index={index}
moveGroup={moveButton}
addButton={addButton}
Expand Down

0 comments on commit f0a84a3

Please sign in to comment.