mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
feat: optimize commonjs (#6906)
Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import cookie from 'react-cookies';
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import classnames from 'classnames';
|
||||
import MediaQuery from 'react-responsive';
|
||||
import { Modal } from 'reactstrap';
|
||||
@@ -32,6 +33,8 @@ import { VIEW_TYPE } from '../../metadata/constants';
|
||||
|
||||
import '../../css/lib-content-view.css';
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const propTypes = {
|
||||
eventBus: PropTypes.object,
|
||||
isSidePanelFolded: PropTypes.bool,
|
||||
@@ -368,7 +371,7 @@ class LibContentView extends React.Component {
|
||||
content: res.data,
|
||||
filePermission: permission,
|
||||
latestContributor: last_modifier_name,
|
||||
lastModified: moment.unix(mtime).fromNow(),
|
||||
lastModified: dayjs.unix(mtime).fromNow(),
|
||||
isFileLoading: false,
|
||||
});
|
||||
});
|
||||
@@ -504,7 +507,7 @@ class LibContentView extends React.Component {
|
||||
content: res.data,
|
||||
filePermission: permission,
|
||||
latestContributor: last_modifier_name,
|
||||
lastModified: moment.unix(mtime).fromNow(),
|
||||
lastModified: dayjs.unix(mtime).fromNow(),
|
||||
isFileLoading: false,
|
||||
});
|
||||
});
|
||||
@@ -1632,7 +1635,7 @@ class LibContentView extends React.Component {
|
||||
const isExist = this.state.direntList.some(item => item.name === direntObject.name && item.type === direntObject.type);
|
||||
if (isExist) {
|
||||
const dirent = this.state.direntList.find(dirent => dirent.name === direntObject.name && dirent.type === direntObject.type);
|
||||
const mtime = moment.unix(direntObject.mtime).fromNow();
|
||||
const mtime = dayjs.unix(direntObject.mtime).fromNow();
|
||||
dirent && this.updateDirent(dirent, 'mtime', mtime);
|
||||
} else {
|
||||
// use current dirent parent's permission as it's permission
|
||||
|
Reference in New Issue
Block a user