only show history if link is present

This commit is contained in:
Maren Süwer
2018-11-28 09:28:45 +01:00
parent 71636e3e07
commit 1b41fe8d93
2 changed files with 22 additions and 19 deletions

View File

@@ -68,6 +68,16 @@ class Content extends React.Component<Props, State> {
const { showHistory, collapsed } = this.state;
const icon = collapsed ? "fa-angle-right" : "fa-angle-down";
const selector = file._links.history ? (
<ButtonGroup
file={file}
historyIsSelected={showHistory}
showHistory={(changeShowHistory: boolean) =>
this.setShowHistoryState(changeShowHistory)
}
/>
) : null;
return (
<span className={classes.pointer}>
<article className="media">
@@ -81,14 +91,7 @@ class Content extends React.Component<Props, State> {
/>
<span>{file.name}</span>
</div>
<div className="media-right">
<ButtonGroup
historyIsSelected={showHistory}
showHistory={(changeShowHistory: boolean) =>
this.setShowHistoryState(changeShowHistory)
}
/>
</div>
<div className="media-right">{selector}</div>
</article>
</span>
);
@@ -149,7 +152,8 @@ class Content extends React.Component<Props, State> {
const { showHistory } = this.state;
const header = this.showHeader();
const content = showHistory ? (
const content =
showHistory && file._links.history ? (
<HistoryView file={file} repository={repository} />
) : (
<SourcesView

View File

@@ -87,7 +87,6 @@ class HistoryView extends React.Component<Props, State> {
}
render() {
console.log(this.state);
const { file } = this.props;
const { loaded, error } = this.state;