diff --git a/frontend/src/components/dialog/guide-for-new-dialog.js b/frontend/src/components/dialog/guide-for-new-dialog.js new file mode 100644 index 0000000000..49c5f7d821 --- /dev/null +++ b/frontend/src/components/dialog/guide-for-new-dialog.js @@ -0,0 +1,37 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Modal, ModalBody } from 'reactstrap'; +import { gettext, mediaUrl, siteName, canAddRepo } from '../../utils/constants'; + +const propTypes = { + toggleDialog: PropTypes.func.isRequired +}; + +class GuideForNewDialog extends React.Component { + + toggle = () => { + this.props.toggleDialog(); + } + + render() { + return ( + + + +
+ +

{gettext('Welcome to {site_name_placeholder}').replace('{site_name_placeholder}', siteName)}

+ {canAddRepo ? +

{gettext('{site_name_placeholder} organizes files into libraries. Each library can be synced and shared separately. We have created a personal library for you. You can create more libraries later.').replace('{site_name_placeholder}', siteName)}

: +

{gettext('{site_name_placeholder} organizes files into libraries. Each library can be synced and shared separately. Howerver, since you are a guest user now, you can not create libraries.').replace('{site_name_placeholder}', siteName)}

+ } +
+
+
+ ); + } +} + +GuideForNewDialog.propTypes = propTypes; + +export default GuideForNewDialog; diff --git a/frontend/src/pages/my-libs/my-libs.js b/frontend/src/pages/my-libs/my-libs.js index 43860ff892..ae59018f63 100644 --- a/frontend/src/pages/my-libs/my-libs.js +++ b/frontend/src/pages/my-libs/my-libs.js @@ -13,6 +13,7 @@ import RepoViewToolbar from '../../components/toolbar/repo-view-toobar'; import LibDetail from '../../components/dirent-detail/lib-details'; import MylibRepoListView from './mylib-repo-list-view'; import SortOptionsDialog from '../../components/dialog/sort-options'; +import GuideForNewDialog from '../../components/dialog/guide-for-new-dialog'; const propTypes = { onShowSidePanel: PropTypes.func.isRequired, @@ -28,6 +29,7 @@ class MyLibraries extends Component { repoList: [], isShowDetails: false, isSortOptionsDialogOpen: false, + isGuideForNewDialogOpen: window.app.pageOptions.guideEnabled, sortBy: cookie.load('seafile-repo-dir-sort-by') || 'name', // 'name' or 'time' or 'size' sortOrder: cookie.load('seafile-repo-dir-sort-order') || 'asc', // 'asc' or 'desc' }; @@ -135,6 +137,13 @@ class MyLibraries extends Component { this.setState({isShowDetails: !this.state.isShowDetails}); } + toggleGuideForNewDialog = () => { + window.app.pageOptions.guideEnabled = false; + this.setState({ + isGuideForNewDialogOpen: false + }); + } + render() { return ( @@ -166,6 +175,11 @@ class MyLibraries extends Component { } + {!this.state.isLoading && !this.state.errorMsg && this.state.isGuideForNewDialogOpen && + + } {this.state.isSortOptionsDialogOpen &&