mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 03:11:07 +00:00
[refactor] lib container view (#6766)
* [refactor] lib container view * optimize codes
This commit is contained in:
@@ -5,7 +5,7 @@ import DirentDetail from './dirent-details';
|
||||
import ObjectUtils from '../../metadata/metadata-view/utils/object-utils';
|
||||
import { MetadataContext } from '../../metadata';
|
||||
|
||||
const Index = React.memo(({ repoID, path, dirent, currentRepoInfo, repoTags, fileTags, onClose, onFileTagChanged }) => {
|
||||
const DetailContainer = React.memo(({ repoID, path, dirent, currentRepoInfo, repoTags, fileTags, onClose, onFileTagChanged }) => {
|
||||
|
||||
useEffect(() => {
|
||||
// init context
|
||||
@@ -45,7 +45,7 @@ const Index = React.memo(({ repoID, path, dirent, currentRepoInfo, repoTags, fil
|
||||
return !isChanged;
|
||||
});
|
||||
|
||||
Index.propTypes = {
|
||||
DetailContainer.propTypes = {
|
||||
repoID: PropTypes.string,
|
||||
path: PropTypes.string,
|
||||
dirent: PropTypes.object,
|
||||
@@ -56,4 +56,4 @@ Index.propTypes = {
|
||||
onFileTagChanged: PropTypes.func,
|
||||
};
|
||||
|
||||
export default Index;
|
||||
export default DetailContainer;
|
@@ -101,7 +101,7 @@ class DirentDetails extends React.Component {
|
||||
{this.renderImage()}
|
||||
{dirent && direntDetail && (
|
||||
<div className="detail-content">
|
||||
{dirent.type !== 'file' ? (
|
||||
{dirent.type !== 'file' ?
|
||||
<DirDetails
|
||||
repoID={repoID}
|
||||
repoInfo={this.props.currentRepoInfo}
|
||||
@@ -109,7 +109,7 @@ class DirentDetails extends React.Component {
|
||||
direntDetail={direntDetail}
|
||||
path={this.props.dirent ? path + '/' + dirent.name : path}
|
||||
/>
|
||||
) : (
|
||||
:
|
||||
<FileDetails
|
||||
repoID={repoID}
|
||||
repoInfo={this.props.currentRepoInfo}
|
||||
@@ -120,7 +120,7 @@ class DirentDetails extends React.Component {
|
||||
fileTagList={dirent ? dirent.file_tags : fileTags}
|
||||
onFileTagChanged={this.props.onFileTagChanged}
|
||||
/>
|
||||
)}
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</Body>
|
||||
|
@@ -1,15 +1,15 @@
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Formatter } from '@seafile/sf-metadata-ui-component';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
import { gettext } from '../../../utils/constants';
|
||||
import { seafileAPI } from '../../../utils/seafile-api';
|
||||
import toaster from '../../toast';
|
||||
import { Detail, Header, Body } from '../detail';
|
||||
import Repo from '../../../models/repo';
|
||||
import Loading from '../../loading';
|
||||
import DetailItem from '../detail-item';
|
||||
import { CellType } from '../../../metadata/metadata-view/_basic';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import { gettext } from '../../utils/constants';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
import toaster from '../toast';
|
||||
import { Detail, Header, Body } from './detail';
|
||||
import Repo from '../../models/repo';
|
||||
import Loading from '../loading';
|
||||
import DetailItem from './detail-item';
|
||||
import { CellType } from '../../metadata/metadata-view/_basic';
|
||||
|
||||
const LibDetail = React.memo(({ currentRepoInfo, onClose }) => {
|
||||
const [isLoading, setLoading] = useState(true);
|
||||
@@ -36,9 +36,9 @@ const LibDetail = React.memo(({ currentRepoInfo, onClose }) => {
|
||||
<Detail>
|
||||
<Header title={currentRepoInfo.repo_name} icon={smallIconUrl} onClose={onClose} />
|
||||
<Body>
|
||||
{isLoading ? (
|
||||
{isLoading ?
|
||||
<div className="w-100 h-100 d-flex algin-items-center justify-content-center"><Loading /></div>
|
||||
) : (
|
||||
:
|
||||
<div className="detail-content">
|
||||
<DetailItem field={filesField} value={repo.file_count || 0} className="sf-metadata-property-detail-formatter">
|
||||
<Formatter field={filesField} value={repo.file_count || 0} />
|
||||
@@ -62,7 +62,7 @@ const LibDetail = React.memo(({ currentRepoInfo, onClose }) => {
|
||||
<Formatter field={mtimeField} value={repo.last_modified} />
|
||||
</DetailItem>
|
||||
</div>
|
||||
)}
|
||||
}
|
||||
</Body>
|
||||
</Detail>
|
||||
);
|
@@ -42,7 +42,7 @@ const propTypes = {
|
||||
isGroupOwnedRepo: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
class MultipleDirOperationToolbar extends React.Component {
|
||||
class SelectedDirentsToolbar extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@@ -471,6 +471,6 @@ class MultipleDirOperationToolbar extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
MultipleDirOperationToolbar.propTypes = propTypes;
|
||||
SelectedDirentsToolbar.propTypes = propTypes;
|
||||
|
||||
export default MultipleDirOperationToolbar;
|
||||
export default SelectedDirentsToolbar;
|
||||
|
Reference in New Issue
Block a user