diff --git a/scm-ui-components/packages/ui-components/src/repos/DiffFile.js b/scm-ui-components/packages/ui-components/src/repos/DiffFile.js index ccc07f2ea1..64450659f0 100644 --- a/scm-ui-components/packages/ui-components/src/repos/DiffFile.js +++ b/scm-ui-components/packages/ui-components/src/repos/DiffFile.js @@ -11,6 +11,7 @@ import { import injectSheets from "react-jss"; import classNames from "classnames"; import { translate } from "react-i18next"; +import {Button} from "../buttons"; const styles = { panel: { @@ -39,14 +40,16 @@ type Props = DiffObjectProps & { }; type State = { - collapsed: boolean + collapsed: boolean, + sideBySide: boolean }; class DiffFile extends React.Component { constructor(props: Props) { super(props); this.state = { - collapsed: false + collapsed: false, + sideBySide: false }; } @@ -56,6 +59,12 @@ class DiffFile extends React.Component { })); }; + toggleSideBySide = () => { + this.setState(state => ({ + sideBySide: !state.sideBySide + })); + }; + setCollapse = (collapsed: boolean) => { this.setState({ collapsed @@ -149,10 +158,10 @@ class DiffFile extends React.Component { file, fileControlFactory, fileAnnotationFactory, - sideBySide, - classes + classes, + t } = this.props; - const { collapsed } = this.state; + const { collapsed, sideBySide } = this.state; const viewType = sideBySide ? "split" : "unified"; let body = null; @@ -173,14 +182,10 @@ class DiffFile extends React.Component { } const fileControls = fileControlFactory ? fileControlFactory(file, this.setCollapse) : null; - return ( -
+ return
-
+
{this.renderFileTitle(file)} @@ -189,12 +194,21 @@ class DiffFile extends React.Component { {this.renderChangeTag(file)}
-
{fileControls}
+
+ + {fileControls} +
{body} -
- ); +
; } } diff --git a/scm-ui/public/locales/de/repos.json b/scm-ui/public/locales/de/repos.json index 47353fa79b..f4ee071613 100644 --- a/scm-ui/public/locales/de/repos.json +++ b/scm-ui/public/locales/de/repos.json @@ -173,5 +173,9 @@ "submit": "Ja", "cancel": "Nein" } + }, + "diff": { + "sideBySide": "Zweispalitg", + "combined": "Kombiniert" } } diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 0d59b88819..714b7d4c14 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -181,6 +181,8 @@ "modify": "modified", "rename": "renamed", "copy": "copied" - } + }, + "sideBySide": "side-by-side", + "combined": "combined" } }