From 06de95840b5e66c18b7b45d4a5e78f8467bfe034 Mon Sep 17 00:00:00 2001
From: llj
Date: Thu, 16 May 2024 14:51:07 +0800
Subject: [PATCH] ['Files' page] improved empty tips (#6088)
---
frontend/src/css/files.css | 7 ++++++
frontend/src/pages/libraries/index.js | 23 ++++---------------
frontend/src/pages/shared-libs/shared-libs.js | 10 ++++----
frontend/src/pages/shared-with-all/index.js | 15 ++++++------
4 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/frontend/src/css/files.css b/frontend/src/css/files.css
index 1a8d86681a..80c2db9137 100644
--- a/frontend/src/css/files.css
+++ b/frontend/src/css/files.css
@@ -2,4 +2,11 @@
text-align: left!important;
padding-left: 20px;
}
+
+#files-content-container .libraries-empty-tip {
+ color: #a4a4a4;
+ text-align: center;
+ padding: 4px 0;
+ border-bottom: 1px solid #e8e8e8;
+}
diff --git a/frontend/src/pages/libraries/index.js b/frontend/src/pages/libraries/index.js
index 981ba1c2f9..6a0134716a 100644
--- a/frontend/src/pages/libraries/index.js
+++ b/frontend/src/pages/libraries/index.js
@@ -8,7 +8,6 @@ import toaster from '../../components/toast';
import Repo from '../../models/repo';
import Group from '../../models/group';
import Loading from '../../components/loading';
-import EmptyTip from '../../components/empty-tip';
import TopToolbar from '../../components/toolbar/top-toolbar';
import MyLibsToolbar from '../../components/toolbar/my-libs-toolbar';
import GroupsToolbar from '../../components/toolbar/groups-toolbar';
@@ -193,22 +192,6 @@ class Libraries extends Component {
};
render() {
- const emptyTip = (
-
- {gettext('No libraries')}
- {gettext('You have not created any libraries yet. A library is a container to organize your files and folders. A library can also be shared with others and synced to your connected devices. You can create a library by clicking the "New Library" button in the menu bar.')}
-
- );
-
- const groupsEmptyTip = (
-
- {gettext('No groups')}
- {canAddGroup ?
- {gettext('You are not in any groups. Groups allow multiple people to collaborate on libraries. You can create a group by clicking the "New Group" button in the menu bar.')}
:
- {gettext('You are not in any groups. Groups allow multiple people to collaborate on libraries. Groups you join will be listed here.')}
- }
-
- );
return (
@@ -253,7 +236,9 @@ class Libraries extends Component {
{this.state.isLoading ? : (
this.state.errorMsg ? {this.state.errorMsg}
: (
- this.state.repoList.length === 0 ? emptyTip : (
+ this.state.repoList.length === 0 ? (
+ {gettext('No libraries')}
+ ) : (
{this.state.isGroupsLoading? : (
this.state.groupsErrorMsg ? {this.state.groupsErrorMsg}
: (
- this.state.groupList.length === 0 ? groupsEmptyTip : (
+ this.state.groupList.length > 0 && (
this.state.groupList.map((group, index) => {
return (
{gettext('No shared libraries')}
:
{gettext('No shared libraries')}
{gettext('No libraries have been shared directly with you. A shared library can be shared with full or restricted permission. If you need access to a library owned by another user, ask the user to share the library with you.')}
-
- );
+ ;
if (loading) {
return ;
@@ -113,6 +113,7 @@ class Content extends Component {
}
Content.propTypes = {
+ inAllLibs: PropTypes.bool.isRequired,
theadHidden: PropTypes.bool.isRequired,
loading: PropTypes.bool.isRequired,
errorMsg: PropTypes.string.isRequired,
@@ -460,6 +461,7 @@ class SharedLibraries extends Component {
sortItems={this.sortItems}
onMonitorRepo={this.onMonitorRepo}
theadHidden={inAllLibs}
+ inAllLibs={inAllLibs}
/>
);
};
diff --git a/frontend/src/pages/shared-with-all/index.js b/frontend/src/pages/shared-with-all/index.js
index 7fbb4ca3c4..5d261a2fb5 100644
--- a/frontend/src/pages/shared-with-all/index.js
+++ b/frontend/src/pages/shared-with-all/index.js
@@ -110,14 +110,15 @@ class PublicSharedView extends React.Component {
};
renderContent = () => {
- const { errMessage } = this.state;
- const emptyTip = (
-
- {gettext('No public libraries')}
- {gettext('No public libraries have been created yet. A public library is accessible by all users. You can create a public library by clicking the "Add Library" button in the menu bar.')}
-
- );
const { inAllLibs = false } = this.props; // inAllLibs: in 'All Libs'('Files') page
+ const { errMessage } = this.state;
+ const emptyTip = inAllLibs ?
+ {gettext('No public libraries')}
: (
+
+ {gettext('No public libraries')}
+ {gettext('No public libraries have been created yet. A public library is accessible by all users. You can create a public library by clicking the "Add Library" button in the menu bar.')}
+
+ );
return (
<>
{this.state.isLoading && }