-
Notifications
You must be signed in to change notification settings - Fork 51
/
TMMergeImportedTM.js
73 lines (70 loc) · 2.41 KB
/
TMMergeImportedTM.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {Panel, Radio, OverlayTrigger,
Tooltip, Col} from 'react-bootstrap'
import {IGNORE_CHECK, FUZZY, REJECT} from '../../utils/EnumValueUtils'
import {CopyLabel} from './TMMergeOptionsCommon'
import Icon from '../../components/Icon'
import Toggle from 'react-toggle'
const tooltip = (
<Tooltip id='copy-as-translated-TM' title='Copy as translated - TM'>
Less than 100% match still copies as fuzzy.
</Tooltip>)
class TMMergeImportedTM extends Component {
static propTypes = {
fromImportedTM: PropTypes.oneOf([IGNORE_CHECK, FUZZY, REJECT]).isRequired,
onImportedTMChange: PropTypes.func.isRequired
}
defaultState = {
enabled: true
}
constructor (props) {
super(props)
this.state = this.defaultState
}
toggleChange = (e) => {
const checked = e.target.checked
this.setState(() => ({
enabled: checked
}))
}
render () {
const {fromImportedTM, onImportedTMChange} = this.props
const disabled = !this.state.enabled
return (
<Col xs={12}>
<Panel>
<Col xs={12}>
<div className="VersionMergeTitle versionMergeTitle-flex">
<span>
<Toggle icons={false} defaultChecked
onChange={this.toggleChange} />
</span>
<span>From </span>
<span className="panel-name">TM Source</span>
</div>
</Col>
<Col xs={12} md={8}>
No project, document or context for TMX
<Radio checked={fromImportedTM === IGNORE_CHECK} disabled={disabled}
onChange={onImportedTMChange(IGNORE_CHECK)}>
<span>I don't mind at all</span><br />
<CopyLabel type={IGNORE_CHECK} value={fromImportedTM} />
<OverlayTrigger placement='right' overlay={tooltip}>
<a className="btn-link tooltip-btn" role="button">
<Icon name="info" className="s0 iconInfoVersionMerge" />
</a>
</OverlayTrigger>
</Radio>
<Radio checked={fromImportedTM === FUZZY} disabled={disabled}
onChange={onImportedTMChange(FUZZY)}>
<span>I will need to review it</span><br />
<CopyLabel type={FUZZY} value={fromImportedTM} />
</Radio>
</Col>
</Panel>
</Col>
)
}
}
export default TMMergeImportedTM