Condition OtomatikSwitch display
This commit is contained in:
@@ -51,7 +51,7 @@ function StyledMenu(props) {
|
|||||||
|
|
||||||
const StyledMenuItem = MenuItem
|
const StyledMenuItem = MenuItem
|
||||||
|
|
||||||
function AjouteTradiksyon({disableSwitch, tradiksyonOtomatik, setTradiksyonOtomatik, canAutoTranslate, chwaLang, setChwaLang}) {
|
function AjouteTradiksyon({hideSwitch, disableSwitch, tradiksyonOtomatik, setTradiksyonOtomatik, canAutoTranslate, chwaLang, setChwaLang}) {
|
||||||
const [anchorElement, setAnchorElement] = useState(null)
|
const [anchorElement, setAnchorElement] = useState(null)
|
||||||
|
|
||||||
const handleClick = event => {
|
const handleClick = event => {
|
||||||
@@ -66,7 +66,7 @@ function AjouteTradiksyon({disableSwitch, tradiksyonOtomatik, setTradiksyonOtoma
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{canAutoTranslate && (
|
{canAutoTranslate && !hideSwitch && (
|
||||||
<OtomatikSwitch tradiksyonOtomatik={tradiksyonOtomatik} setTradiksyonOtomatik={setTradiksyonOtomatik} disabled={!chwaLang.includes('fr') || disableSwitch} />
|
<OtomatikSwitch tradiksyonOtomatik={tradiksyonOtomatik} setTradiksyonOtomatik={setTradiksyonOtomatik} disabled={!chwaLang.includes('fr') || disableSwitch} />
|
||||||
)}
|
)}
|
||||||
<Root style={{textAlign: 'center', marginTop: 20}}>
|
<Root style={{textAlign: 'center', marginTop: 20}}>
|
||||||
@@ -130,6 +130,7 @@ function AjouteTradiksyon({disableSwitch, tradiksyonOtomatik, setTradiksyonOtoma
|
|||||||
}
|
}
|
||||||
|
|
||||||
AjouteTradiksyon.propTypes = {
|
AjouteTradiksyon.propTypes = {
|
||||||
|
hideSwitch: PropTypes.bool.isRequired,
|
||||||
disableSwitch: PropTypes.bool.isRequired,
|
disableSwitch: PropTypes.bool.isRequired,
|
||||||
tradiksyonOtomatik: PropTypes.bool.isRequired,
|
tradiksyonOtomatik: PropTypes.bool.isRequired,
|
||||||
setTradiksyonOtomatik: PropTypes.func.isRequired,
|
setTradiksyonOtomatik: PropTypes.func.isRequired,
|
||||||
|
|||||||
@@ -366,7 +366,15 @@ function EkriTeks({selectedTeks, setSelectedTeks}) {
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
))}
|
))}
|
||||||
</form>
|
</form>
|
||||||
<AjouteTradiksyon disableSwitch={tradiksyon.fr === ''} tradiksyonOtomatik={tradiksyonOtomatik} setTradiksyonOtomatik={setTradiksyonOtomatik} canAutoTranslate={user.canAutoTranslate} chwaLang={kiChawLang} setChwaLang={setKiChwalang} />
|
<AjouteTradiksyon
|
||||||
|
hideSwitch={Boolean(currentTeksId)}
|
||||||
|
disableSwitch={tradiksyon.fr === ''}
|
||||||
|
tradiksyonOtomatik={tradiksyonOtomatik}
|
||||||
|
setTradiksyonOtomatik={setTradiksyonOtomatik}
|
||||||
|
canAutoTranslate={user.canAutoTranslate}
|
||||||
|
chwaLang={kiChawLang}
|
||||||
|
setChwaLang={setKiChwalang}
|
||||||
|
/>
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
Reference in New Issue
Block a user