Condition OtomatikSwitch display
This commit is contained in:
@@ -51,7 +51,7 @@ function StyledMenu(props) {
|
||||
|
||||
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 handleClick = event => {
|
||||
@@ -66,7 +66,7 @@ function AjouteTradiksyon({disableSwitch, tradiksyonOtomatik, setTradiksyonOtoma
|
||||
|
||||
return (
|
||||
<>
|
||||
{canAutoTranslate && (
|
||||
{canAutoTranslate && !hideSwitch && (
|
||||
<OtomatikSwitch tradiksyonOtomatik={tradiksyonOtomatik} setTradiksyonOtomatik={setTradiksyonOtomatik} disabled={!chwaLang.includes('fr') || disableSwitch} />
|
||||
)}
|
||||
<Root style={{textAlign: 'center', marginTop: 20}}>
|
||||
@@ -130,6 +130,7 @@ function AjouteTradiksyon({disableSwitch, tradiksyonOtomatik, setTradiksyonOtoma
|
||||
}
|
||||
|
||||
AjouteTradiksyon.propTypes = {
|
||||
hideSwitch: PropTypes.bool.isRequired,
|
||||
disableSwitch: PropTypes.bool.isRequired,
|
||||
tradiksyonOtomatik: PropTypes.bool.isRequired,
|
||||
setTradiksyonOtomatik: PropTypes.func.isRequired,
|
||||
|
||||
@@ -366,7 +366,15 @@ function EkriTeks({selectedTeks, setSelectedTeks}) {
|
||||
</FormControl>
|
||||
))}
|
||||
</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>
|
||||
<Button
|
||||
fullWidth
|
||||
|
||||
Reference in New Issue
Block a user