mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Fix wired check boxes
This commit is contained in:
parent
93a63e05ed
commit
0b8746fe9f
@ -7,9 +7,9 @@ import { WiredActionBaseView } from './WiredActionBaseView';
|
||||
|
||||
export const WiredActionSetFurniStateToView: FC<{}> = props =>
|
||||
{
|
||||
const [ stateFlag, setStateFlag ] = useState(-1);
|
||||
const [ directionFlag, setDirectionFlag ] = useState(-1);
|
||||
const [ positionFlag, setPositionFlag ] = useState(-1);
|
||||
const [ stateFlag, setStateFlag ] = useState(0);
|
||||
const [ directionFlag, setDirectionFlag ] = useState(0);
|
||||
const [ positionFlag, setPositionFlag ] = useState(0);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = () => setIntParams([ stateFlag, directionFlag, positionFlag ]);
|
||||
@ -29,15 +29,15 @@ export const WiredActionSetFurniStateToView: FC<{}> = props =>
|
||||
<Column gap={ 1 }>
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.conditions') }</Text>
|
||||
<Flex alignItems="center" gap={ 1 }>
|
||||
<input className="form-check-input" type="checkbox" id="stateFlag" onChange={ event => setStateFlag(event.target.checked ? 1 : 0) } />
|
||||
<input className="form-check-input" type="checkbox" id="stateFlag" checked={ !!stateFlag } onChange={ event => setStateFlag(event.target.checked ? 1 : 0) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.condition.state') }</Text>
|
||||
</Flex>
|
||||
<Flex alignItems="center" gap={ 1 }>
|
||||
<input className="form-check-input" type="checkbox" id="directionFlag" onChange={ event => setDirectionFlag(event.target.checked ? 1 : 0) } />
|
||||
<input className="form-check-input" type="checkbox" id="directionFlag" checked={ !!directionFlag } onChange={ event => setDirectionFlag(event.target.checked ? 1 : 0) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.condition.direction') }</Text>
|
||||
</Flex>
|
||||
<Flex alignItems="center" gap={ 1 }>
|
||||
<input className="form-check-input" type="checkbox" id="positionFlag" onChange={ event => setPositionFlag(event.target.checked ? 1 : 0) } />
|
||||
<input className="form-check-input" type="checkbox" id="positionFlag" checked={ !!positionFlag } onChange={ event => setPositionFlag(event.target.checked ? 1 : 0) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.condition.position') }</Text>
|
||||
</Flex>
|
||||
</Column>
|
||||
|
@ -7,9 +7,9 @@ import { WiredConditionBaseView } from './WiredConditionBaseView';
|
||||
|
||||
export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props =>
|
||||
{
|
||||
const [ stateFlag, setStateFlag ] = useState(-1);
|
||||
const [ directionFlag, setDirectionFlag ] = useState(-1);
|
||||
const [ positionFlag, setPositionFlag ] = useState(-1);
|
||||
const [ stateFlag, setStateFlag ] = useState(0);
|
||||
const [ directionFlag, setDirectionFlag ] = useState(0);
|
||||
const [ positionFlag, setPositionFlag ] = useState(0);
|
||||
const { trigger = null, setIntParams = null } = useWiredContext();
|
||||
|
||||
const save = () => setIntParams([ stateFlag, directionFlag, positionFlag ]);
|
||||
@ -24,20 +24,22 @@ export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props =>
|
||||
});
|
||||
}, [ trigger ]);
|
||||
|
||||
console.log(stateFlag, directionFlag, positionFlag);
|
||||
|
||||
return (
|
||||
<WiredConditionBaseView requiresFurni={ WiredFurniType.STUFF_SELECTION_OPTION_BY_ID } hasSpecialInput={ true } save={ save }>
|
||||
<Column gap={ 1 }>
|
||||
<Text bold>{ LocalizeText('wiredfurni.params.conditions') }</Text>
|
||||
<Flex alignItems="center" gap={ 1 }>
|
||||
<input className="form-check-input" type="checkbox" id="stateFlag" onChange={ event => setStateFlag(event.target.checked ? 1 : 0) } />
|
||||
<input className="form-check-input" type="checkbox" id="stateFlag" checked={ !!stateFlag } onChange={ event => setStateFlag(event.target.checked ? 1 : 0) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.condition.state') }</Text>
|
||||
</Flex>
|
||||
<Flex alignItems="center" gap={ 1 }>
|
||||
<input className="form-check-input" type="checkbox" id="directionFlag" onChange={ event => setDirectionFlag(event.target.checked ? 1 : 0) } />
|
||||
<input className="form-check-input" type="checkbox" id="directionFlag" checked={ !!directionFlag } onChange={ event => setDirectionFlag(event.target.checked ? 1 : 0) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.condition.direction') }</Text>
|
||||
</Flex>
|
||||
<Flex alignItems="center" gap={ 1 }>
|
||||
<input className="form-check-input" type="checkbox" id="positionFlag" onChange={ event => setPositionFlag(event.target.checked ? 1 : 0) } />
|
||||
<input className="form-check-input" type="checkbox" id="positionFlag" checked={ !!positionFlag } onChange={ event => setPositionFlag(event.target.checked ? 1 : 0) } />
|
||||
<Text>{ LocalizeText('wiredfurni.params.condition.position') }</Text>
|
||||
</Flex>
|
||||
</Column>
|
||||
|
Loading…
Reference in New Issue
Block a user