diff --git a/frontend/src/css/sdoc-file-history.css b/frontend/src/css/sdoc-file-history.css index 9fee100721..c7c4d75093 100644 --- a/frontend/src/css/sdoc-file-history.css +++ b/frontend/src/css/sdoc-file-history.css @@ -20,7 +20,6 @@ .sdoc-file-history .sdoc-file-history-header .sdoc-file-history-header-right { height: 100%; - min-width: 100px; } .sdoc-file-history .sdoc-file-history-header .sdoc-file-changes-container { diff --git a/frontend/src/pages/sdoc-file-history/index.js b/frontend/src/pages/sdoc-file-history/index.js index 0d13168be5..d5fe14b0f4 100644 --- a/frontend/src/pages/sdoc-file-history/index.js +++ b/frontend/src/pages/sdoc-file-history/index.js @@ -138,50 +138,66 @@ class SdocFileHistory extends React.Component { this.jumpToElement(currentDiffIndex + 1); } - render() { - const { currentVersion, isShowChanges, currentVersionContent, lastVersionContent, isLoading, changes, currentDiffIndex } = this.state; + renderChangesTip = () => { + const { isShowChanges, changes, currentDiffIndex, isLoading } = this.state; + if (isLoading) return null; + if (!isShowChanges) return null; const changesCount = changes ? changes.length : 0; - const isShowChangesTips = isShowChanges && changesCount > 0; + if (changesCount === 0) { + return ( +
+
+ {gettext('No changes')} +
+
+ ); + } + + return ( +
+
+
+ {`${gettext('Changes')} ${currentDiffIndex + 1}/${changesCount}`} +
+
+
+ +
+
+
+ +
+ + {gettext('Last modification')} + + + {gettext('Next modification')} + +
+
+ ); + } + + render() { + const { currentVersion, isShowChanges, currentVersionContent, lastVersionContent, isLoading } = this.state; return (
-
+
{fileName}
- {isShowChangesTips && ( -
-
-
- {`${gettext('Changes')} ${currentDiffIndex + 1}/${changesCount}`} -
-
-
- -
-
-
- -
- - {gettext('Last modification')} - - - {gettext('Next modification')} - -
-
- )} + {this.renderChangesTip()}
this.historyContentRef = ref}> {isLoading ? (