mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +01:00
Hide 'side by side' button when there is no diff
This commit is contained in:
@@ -271,8 +271,22 @@ class DiffFile extends React.Component<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const collapseIcon = this.hasContent(file) ? <Icon name={icon} color="inherit" /> : null;
|
const collapseIcon = this.hasContent(file) ? <Icon name={icon} color="inherit" /> : null;
|
||||||
|
|
||||||
const fileControls = fileControlFactory ? fileControlFactory(file, this.setCollapse) : null;
|
const fileControls = fileControlFactory ? fileControlFactory(file, this.setCollapse) : null;
|
||||||
|
const sideBySideToggle =
|
||||||
|
file.hunks && file.hunks.length > 0 ? (
|
||||||
|
<ButtonWrapper className={classNames("level-right", "is-flex")}>
|
||||||
|
<ButtonGroup>
|
||||||
|
<Button
|
||||||
|
action={this.toggleSideBySide}
|
||||||
|
icon={sideBySide ? "align-left" : "columns"}
|
||||||
|
label={t(sideBySide ? "diff.combined" : "diff.sideBySide")}
|
||||||
|
reducedMobile={true}
|
||||||
|
/>
|
||||||
|
{fileControls}
|
||||||
|
</ButtonGroup>
|
||||||
|
</ButtonWrapper>
|
||||||
|
) : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DiffFilePanel className={classNames("panel", "is-size-6")} collapsed={(file && file.isBinary) || collapsed}>
|
<DiffFilePanel className={classNames("panel", "is-size-6")} collapsed={(file && file.isBinary) || collapsed}>
|
||||||
<div className="panel-heading">
|
<div className="panel-heading">
|
||||||
@@ -288,17 +302,7 @@ class DiffFile extends React.Component<Props, State> {
|
|||||||
</TitleWrapper>
|
</TitleWrapper>
|
||||||
{this.renderChangeTag(file)}
|
{this.renderChangeTag(file)}
|
||||||
</FullWidthTitleHeader>
|
</FullWidthTitleHeader>
|
||||||
<ButtonWrapper className={classNames("level-right", "is-flex")}>
|
{sideBySideToggle}
|
||||||
<ButtonGroup>
|
|
||||||
<Button
|
|
||||||
action={this.toggleSideBySide}
|
|
||||||
icon={sideBySide ? "align-left" : "columns"}
|
|
||||||
label={t(sideBySide ? "diff.combined" : "diff.sideBySide")}
|
|
||||||
reducedMobile={true}
|
|
||||||
/>
|
|
||||||
{fileControls}
|
|
||||||
</ButtonGroup>
|
|
||||||
</ButtonWrapper>
|
|
||||||
</FlexWrapLevel>
|
</FlexWrapLevel>
|
||||||
</div>
|
</div>
|
||||||
{body}
|
{body}
|
||||||
|
|||||||
Reference in New Issue
Block a user