From 160efd7ad3392bd2dd2d01644322c35bfeb117cd Mon Sep 17 00:00:00 2001 From: shanshuirenjia <978987373@qq.com> Date: Wed, 12 Dec 2018 17:51:12 +0800 Subject: [PATCH] adjust code --- .../src/components/cur-dir-path/dir-path.js | 3 +- .../components/dialog/delete-repo-dialog.js | 2 +- frontend/src/pages/my-libs/content.js | 35 ++++++++++--------- frontend/src/pages/my-libs/item.js | 8 ++--- frontend/src/pages/my-libs/my-libs.js | 10 +++--- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/frontend/src/components/cur-dir-path/dir-path.js b/frontend/src/components/cur-dir-path/dir-path.js index 3b6db7bb58..05af49242b 100644 --- a/frontend/src/components/cur-dir-path/dir-path.js +++ b/frontend/src/components/cur-dir-path/dir-path.js @@ -1,5 +1,6 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; +import { Link } from '@reach/router'; import { siteRoot, gettext } from '../../utils/constants'; const propTypes = { @@ -49,7 +50,7 @@ class DirPath extends React.Component { {this.props.pathPrefix ? this.props.pathPrefix : - {gettext('Libraries')} + {gettext('Libraries')} / } diff --git a/frontend/src/components/dialog/delete-repo-dialog.js b/frontend/src/components/dialog/delete-repo-dialog.js index 1953a1a517..160564c151 100644 --- a/frontend/src/components/dialog/delete-repo-dialog.js +++ b/frontend/src/components/dialog/delete-repo-dialog.js @@ -24,7 +24,7 @@ class DeleteRepoDialog extends Component { let message = gettext("Are you sure you want to delete %s ?"); message = message.replace('%s', repoName); const popup = ( - + {gettext("Delete Library")}

diff --git a/frontend/src/pages/my-libs/content.js b/frontend/src/pages/my-libs/content.js index 4346ff89ac..fd6edb8ceb 100644 --- a/frontend/src/pages/my-libs/content.js +++ b/frontend/src/pages/my-libs/content.js @@ -1,12 +1,12 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import { gettext, storages} from '../../utils/constants'; -import TransferDialog from '../../components/dialog/transfer-dialog'; -import LibHistorySetting from '../../components/dialog/lib-history-setting-dialog'; import Loading from '../../components/loading'; -import ModalPortal from '../../components/modal-portal'; -import DeleteRepoDialog from '../../components/dialog/delete-repo-dialog'; import TableBody from './table-body'; +import ModalPortal from '../../components/modal-portal'; +import LibHistorySetting from '../../components/dialog/lib-history-setting-dialog'; +import TransferDialog from '../../components/dialog/transfer-dialog'; +import DeleteRepoDialog from '../../components/dialog/delete-repo-dialog'; const propTypes = { loading: PropTypes.bool.isRequired, @@ -83,13 +83,13 @@ class Content extends Component { const desktopThead = ( - {gettext("Library Type")} - {gettext("Name")}{/*TODO: sort*/} - {gettext("Actions")} + {gettext('Library Type')} + {gettext('Name')}{/*TODO: sort*/} + {gettext('Actions')} - {gettext("Size")} + {gettext('Size')} {showStorageBackend ? {gettext('Storage backend')} : null} - {gettext("Last Update")}{/*TODO: sort*/} + {gettext('Last Update')}{/*TODO: sort*/} ); @@ -97,13 +97,13 @@ class Content extends Component { const mobileThead = ( - {gettext("Library Type")} + {gettext('Library Type')} {gettext("Sort:")} {/* TODO: sort */} {gettext("name")} {gettext("last update")} - {gettext("Actions")} + {gettext('Actions')} ); @@ -126,11 +126,14 @@ class Content extends Component { const nonEmpty = ( {table} - + {this.state.deleteItemPopupOpen && ( + + + + )} {this.state.showTransfer && - - + + {commonToggle} @@ -220,7 +220,7 @@ class Item extends Component { const mobileOperations = ( {commonToggle} -
+
{gettext('Share')} diff --git a/frontend/src/pages/my-libs/my-libs.js b/frontend/src/pages/my-libs/my-libs.js index ff36c2108e..9cbb7863a2 100644 --- a/frontend/src/pages/my-libs/my-libs.js +++ b/frontend/src/pages/my-libs/my-libs.js @@ -18,7 +18,7 @@ class MyLibraries extends Component { } componentDidMount() { - seafileAPI.listRepos({type:'mine'}).then((res) => { + seafileAPI.listRepos({type: 'mine'}).then((res) => { // res: {data: {...}, status: 200, statusText: "OK", headers: {…}, config: {…}, …} this.setState({ loading: false, @@ -29,19 +29,19 @@ class MyLibraries extends Component { if (error.response.status == 403) { this.setState({ loading: false, - errorMsg: gettext("Permission denied") + errorMsg: gettext('Permission denied') }); location.href = `${loginUrl}?next=${encodeURIComponent(location.href)}`; } else { this.setState({ loading: false, - errorMsg: gettext("Error") + errorMsg: gettext('Error') }); } } else { this.setState({ loading: false, - errorMsg: gettext("Please check the network.") + errorMsg: gettext('Please check the network.') }); } }); @@ -102,7 +102,7 @@ class MyLibraries extends Component {
-

{gettext("My Libraries")}

+

{gettext('My Libraries')}