mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-23 04:18:21 +00:00
feat: sdoc history empty changes tip (#5580)
* feat: sdoc history empty changes tip * feat: optimize code
This commit is contained in:
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
.sdoc-file-history .sdoc-file-history-header .sdoc-file-history-header-right {
|
.sdoc-file-history .sdoc-file-history-header .sdoc-file-history-header-right {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-width: 100px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sdoc-file-history .sdoc-file-history-header .sdoc-file-changes-container {
|
.sdoc-file-history .sdoc-file-history-header .sdoc-file-changes-container {
|
||||||
|
@@ -138,20 +138,22 @@ class SdocFileHistory extends React.Component {
|
|||||||
this.jumpToElement(currentDiffIndex + 1);
|
this.jumpToElement(currentDiffIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
renderChangesTip = () => {
|
||||||
const { currentVersion, isShowChanges, currentVersionContent, lastVersionContent, isLoading, changes, currentDiffIndex } = this.state;
|
const { isShowChanges, changes, currentDiffIndex, isLoading } = this.state;
|
||||||
|
if (isLoading) return null;
|
||||||
|
if (!isShowChanges) return null;
|
||||||
const changesCount = changes ? changes.length : 0;
|
const changesCount = changes ? changes.length : 0;
|
||||||
const isShowChangesTips = isShowChanges && changesCount > 0;
|
if (changesCount === 0) {
|
||||||
|
return (
|
||||||
|
<div className="sdoc-file-history-header-right d-flex align-items-center">
|
||||||
|
<div className="sdoc-file-changes-container d-flex align-items-center pl-2 pr-2">
|
||||||
|
{gettext('No changes')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="sdoc-file-history d-flex h-100 w-100 o-hidden">
|
|
||||||
<div className="sdoc-file-history-container d-flex flex-column">
|
|
||||||
<div className="sdoc-file-history-header pt-2 pb-2 pl-4 pr-4 d-flex justify-content-between w-100 o-hidden">
|
|
||||||
<div className={classnames('sdoc-file-history-header-left d-flex align-items-center o-hidden', { 'pr-4': isShowChangesTips })}>
|
|
||||||
<GoBack />
|
|
||||||
<div className="file-name text-truncate">{fileName}</div>
|
|
||||||
</div>
|
|
||||||
{isShowChangesTips && (
|
|
||||||
<div className="sdoc-file-history-header-right d-flex align-items-center">
|
<div className="sdoc-file-history-header-right d-flex align-items-center">
|
||||||
<div className="sdoc-file-changes-container d-flex align-items-center">
|
<div className="sdoc-file-changes-container d-flex align-items-center">
|
||||||
<div className="sdoc-file-changes-tip d-flex align-items-center justify-content-center pl-2 pr-2">
|
<div className="sdoc-file-changes-tip d-flex align-items-center justify-content-center pl-2 pr-2">
|
||||||
@@ -181,7 +183,21 @@ class SdocFileHistory extends React.Component {
|
|||||||
</UncontrolledTooltip>
|
</UncontrolledTooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { currentVersion, isShowChanges, currentVersionContent, lastVersionContent, isLoading } = this.state;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="sdoc-file-history d-flex h-100 w-100 o-hidden">
|
||||||
|
<div className="sdoc-file-history-container d-flex flex-column">
|
||||||
|
<div className="sdoc-file-history-header pt-2 pb-2 pl-4 pr-4 d-flex justify-content-between w-100 o-hidden">
|
||||||
|
<div className={classnames('sdoc-file-history-header-left d-flex align-items-center o-hidden', { 'pr-4': isShowChanges })}>
|
||||||
|
<GoBack />
|
||||||
|
<div className="file-name text-truncate">{fileName}</div>
|
||||||
|
</div>
|
||||||
|
{this.renderChangesTip()}
|
||||||
</div>
|
</div>
|
||||||
<div className="sdoc-file-history-content f-flex flex-column" ref={ref => this.historyContentRef = ref}>
|
<div className="sdoc-file-history-content f-flex flex-column" ref={ref => this.historyContentRef = ref}>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
|
Reference in New Issue
Block a user