Skip to content

Commit

Permalink
02 change path
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael18811380328 committed Jul 11, 2024
1 parent d9b15ca commit 0aba048
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 186 deletions.
91 changes: 19 additions & 72 deletions frontend/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ import ReactDom from 'react-dom';
import { Router, navigate } from '@gatsbyjs/reach-router';
import MediaQuery from 'react-responsive';
import { Modal } from 'reactstrap';

import { siteRoot } from './utils/constants';
import { Utils } from './utils/utils';

import SystemNotification from './components/system-notification';
import Header from './components/header';
import SidePanel from './components/side-panel';
import MainPanel from './components/main-panel';

import FilesActivities from './pages/dashboard/files-activities';
import MyFileActivities from './pages/dashboard/my-file-activities';
import Starred from './pages/starred/starred';
Expand Down Expand Up @@ -230,88 +227,38 @@ class App extends Component {
onCloseSidePanel={this.onCloseSidePanel}
currentTab={currentTab}
tabItemClick={this.tabItemClick}
showLogoOnlyInMobile={true}
toggleFoldSideNav={this.toggleFoldSideNav}
/>
{/* 现在宽度是固定的 MainPanel 78%,SidePanel 22%,未来增加一个拖动工具,支持左右拖动,改变这里的宽度 */}
{/* 未来优化一下 commonProps = { onShowSidePanel={this.onShowSidePanel}, onSearchedClick={this.onSearchedClick} } */}
<MainPanel>
<Router className="reach-router">
<Libraries
path={siteRoot}
onShowSidePanel={this.onShowSidePanel}
onSearchedClick={this.onSearchedClick}
/>
<Libraries
path={siteRoot + 'libraries'}
onShowSidePanel={this.onShowSidePanel}
onSearchedClick={this.onSearchedClick}
/>
<MyLibraries
path={siteRoot + 'my-libs'}
onShowSidePanel={this.onShowSidePanel}
onSearchedClick={this.onSearchedClick}
/>
<MyLibDeleted
path={siteRoot + 'my-libs/deleted/'}
onSearchedClick={this.onSearchedClick}
/>
<ShareAdminShareLinks
path={siteRoot + 'share-admin-share-links'}
onShowSidePanel={this.onShowSidePanel}
onSearchedClick={this.onSearchedClick}
/>
<ShareAdminUploadLinks
path={siteRoot + 'share-admin-upload-links'}
onShowSidePanel={this.onShowSidePanel}
onSearchedClick={this.onSearchedClick}
/>
<PublicSharedView
path={siteRoot + 'org/'}
// onShowSidePanel={this.onShowSidePanel}
// onSearchedClick={this.onSearchedClick}
// onTabNavClick={this.tabItemClick}
/>
<Group
path={siteRoot + 'group/:groupID'}
onShowSidePanel={this.onShowSidePanel}
onSearchedClick={this.onSearchedClick}
onGroupChanged={this.onGroupChanged}
/>
<Wikis
path={siteRoot + 'published'}
// onShowSidePanel={this.onShowSidePanel}
// onSearchedClick={this.onSearchedClick}
/>
<FilesActivities
path={siteRoot + 'dashboard'}
onShowSidePanel={this.onShowSidePanel}
onSearchedClick={this.onSearchedClick}
/>
<MyFileActivities
path={siteRoot + 'my-activities'}
onShowSidePanel={this.onShowSidePanel}
onSearchedClick={this.onSearchedClick}
/>
<Starred path={siteRoot + 'starred'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
<LinkedDevices path={siteRoot + 'linked-devices'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
<ShareAdminLibraries path={siteRoot + 'share-admin-libs'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
<ShareAdminFolders path={siteRoot + 'share-admin-folders'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
<SharedLibraries path={siteRoot + 'shared-libs'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
<ShareWithOCM path={siteRoot + 'shared-with-ocm'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
<OCMViaWebdav path={siteRoot + 'ocm-via-webdav'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
<InvitationsView path={siteRoot + 'invitations/'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
<Libraries path={siteRoot} />
<Libraries path={siteRoot + 'libraries'} />
<MyLibraries path={siteRoot + 'my-libs'} />
<MyLibDeleted path={siteRoot + 'my-libs/deleted/'} />
<ShareAdminShareLinks path={siteRoot + 'share-admin-share-links'} />
<ShareAdminUploadLinks path={siteRoot + 'share-admin-upload-links'} />
<PublicSharedView path={siteRoot + 'org/'} />
<Wikis path={siteRoot + 'published'} />
<Starred path={siteRoot + 'starred'} />
<InvitationsView path={siteRoot + 'invitations/'} />
<FilesActivities path={siteRoot + 'dashboard'} />
<MyFileActivities path={siteRoot + 'my-activities'} />
<Group path={siteRoot + 'group/:groupID'} onGroupChanged={this.onGroupChanged} />
<LinkedDevices path={siteRoot + 'linked-devices'} />
<ShareAdminLibraries path={siteRoot + 'share-admin-libs'} />
<ShareAdminFolders path={siteRoot + 'share-admin-folders'} />
<SharedLibraries path={siteRoot + 'shared-libs'} />
<ShareWithOCM path={siteRoot + 'shared-with-ocm'} />
<OCMViaWebdav path={siteRoot + 'ocm-via-webdav'} />
<OCMRepoDir
path={siteRoot + 'remote-library/:providerID/:repoID/*'}
pathPrefix={this.state.pathPrefix}
onMenuClick={this.onShowSidePanel}
onTabNavClick={this.tabItemClick}
/>
<LibContentView
path={siteRoot + 'library/:repoID/*'}
pathPrefix={this.state.pathPrefix}
isSidePanelFolded={isSidePanelFolded}
onMenuClick={this.onShowSidePanel}
onTabNavClick={this.tabItemClick}
eventBus={this.eventBus}
/>
Expand Down
9 changes: 1 addition & 8 deletions frontend/src/components/logo.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { siteRoot, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle } from '../utils/constants';
import { Utils } from '../utils/utils';

const propTypes = {
onCloseSidePanel: PropTypes.func,
showCloseSidePanelIcon: PropTypes.bool,
positioned: PropTypes.bool,
showLogoOnlyInMobile: PropTypes.bool
};

class Logo extends React.Component {
Expand All @@ -17,12 +15,7 @@ class Logo extends React.Component {
};

render() {
const { positioned, showLogoOnlyInMobile } = this.props;

if (showLogoOnlyInMobile && Utils.isDesktop()) {
return null;
}

const { positioned } = this.props;
return (
<div className={`top-logo ${positioned ? 'd-none d-md-block positioned-top-logo' : ''}`}>
<a href={siteRoot} id="logo">
Expand Down
10 changes: 1 addition & 9 deletions frontend/src/components/side-panel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import Logo from './logo';
import MainSideNav from './main-side-nav';
import { SIDE_PANEL_FOLDED_WIDTH } from '../constants';

Expand All @@ -11,24 +10,17 @@ const propTypes = {
onCloseSidePanel: PropTypes.func,
tabItemClick: PropTypes.func,
children: PropTypes.object,
showLogoOnlyInMobile: PropTypes.bool,
isSidePanelFolded: PropTypes.bool,
toggleFoldSideNav: PropTypes.func
};

class SidePanel extends React.Component {

render() {
const { children, isSidePanelFolded, showLogoOnlyInMobile = false } = this.props;
const { children, isSidePanelFolded } = this.props;
const style = isSidePanelFolded ? { flexBasis: SIDE_PANEL_FOLDED_WIDTH } : {};
return (
<div className={classnames('side-panel', { 'side-panel-folded': isSidePanelFolded, 'left-zero': !this.props.isSidePanelClosed })} style={style}>
{/* <div className={'side-panel-north'}>
<Logo
onCloseSidePanel={this.props.onCloseSidePanel}
showLogoOnlyInMobile={showLogoOnlyInMobile}
/>
</div> */}
<div className="side-panel-center">
{children ? children : (
<MainSideNav
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/toolbar/common-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ const propTypes = {
onSearchedClick: PropTypes.func,
searchPlaceholder: PropTypes.string,
currentRepoInfo: PropTypes.object,
eventBus: PropTypes.object,
isViewFile: PropTypes.bool,
showSearch: PropTypes.bool
};

// eventBus={this.props.eventBus}

class CommonToolbar extends React.Component {

constructor(props) {
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/pages/groups/group-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import ModalPortal from '../../components/modal-portal';
import Group from '../../models/group';
import Repo from '../../models/repo';
import toaster from '../../components/toast';
import CommonToolbar from '../../components/toolbar/common-toolbar';
import CreateRepoDialog from '../../components/dialog/create-repo-dialog';
import GroupMembersDialog from '../../components/dialog/group-members-dialog';
import DismissGroupDialog from '../../components/dialog/dismiss-group-dialog';
Expand All @@ -26,8 +25,6 @@ import SingleDropdownToolbar from '../../components/toolbar/single-dropdown-tool
import '../../css/group-view.css';

const propTypes = {
onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired,
onGroupChanged: PropTypes.func.isRequired,
groupID: PropTypes.string,
};
Expand Down Expand Up @@ -430,12 +427,6 @@ class GroupView extends React.Component {
const opList = this.getOpList();
return (
<Fragment>
{/* <div className="main-panel-north border-left-show">
<div className="cur-view-toolbar">
<span className="sf2-icon-menu side-nav-toggle d-md-none" title="Side Nav Menu" onClick={this.props.onShowSidePanel}></span>
</div>
<CommonToolbar onSearchedClick={this.props.onSearchedClick} />
</div> */}
<div className="main-panel-center flex-row">
<div className="cur-view-container">
<div className="cur-view-path">
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/pages/invitations/invitations-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,4 @@ Content.propTypes = {
data: PropTypes.object.isRequired,
};

const InvitationsViewPropTypes = {
onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired,
};

InvitationsView.propTypes = InvitationsViewPropTypes;

export default InvitationsView;
46 changes: 2 additions & 44 deletions frontend/src/pages/lib-content-view/lib-content-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import cookie from 'react-cookies';
import moment from 'moment';
import { navigate } from '@gatsbyjs/reach-router';
import { gettext, siteRoot, username, enableVideoThumbnail, enablePDFThumbnail, repoID } from '../../utils/constants';
import { gettext, siteRoot, username, enableVideoThumbnail, enablePDFThumbnail } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import collabServer from '../../utils/collab-server';
Expand All @@ -16,18 +16,17 @@ import treeHelper from '../../components/tree-view/tree-helper';
import toaster from '../../components/toast';
import ModalPortal from '../../components/modal-portal';
import LibDecryptDialog from '../../components/dialog/lib-decrypt-dialog';
import LibContentToolbar from './lib-content-toolbar';
import LibContentContainer from './lib-content-container';
import FileUploader from '../../components/file-uploader/file-uploader';
import CopyMoveDirentProgressDialog from '../../components/dialog/copy-move-dirent-progress-dialog';
import DeleteFolderDialog from '../../components/dialog/delete-folder-dialog';
import { EVENT_BUS_TYPE } from '../../components/common/event-bus-type';

const propTypes = {
eventBus: PropTypes.object,
isSidePanelFolded: PropTypes.bool,
pathPrefix: PropTypes.array.isRequired,
onTabNavClick: PropTypes.func.isRequired,
onMenuClick: PropTypes.func.isRequired,
repoID: PropTypes.string,
};

Expand Down Expand Up @@ -2052,47 +2051,6 @@ class LibContentView extends React.Component {

return (
<Fragment>
{/* 这里比较多,实际上没有这么多功能,可以删除很多部分 */}
{/* 下面这部分属性变化后,然后发送给 common-toolbar 进行更改 */}
{/* <div className="main-panel-north border-left-show">
<LibContentToolbar
isViewFile={this.state.isViewFile}
filePermission={this.state.filePermission}
fileTags={this.state.fileTags}
onFileTagChanged={this.onToolbarFileTagChanged}
onSideNavMenuClick={this.props.onMenuClick}
repoID={this.props.repoID}
path={this.state.path}
isDirentSelected={this.state.isDirentSelected}
selectedDirentList={this.state.selectedDirentList}
onItemsMove={this.onMoveItems}
onItemsCopy={this.onCopyItems}
onItemsDelete={this.onDeleteItems}
onItemRename={this.onMainPanelItemRename}
direntList={this.state.direntList}
repoName={this.state.repoName}
repoEncrypted={this.state.repoEncrypted}
isGroupOwnedRepo={this.state.isGroupOwnedRepo}
userPerm={this.state.userPerm}
showShareBtn={showShareBtn}
enableDirPrivateShare={enableDirPrivateShare}
onAddFile={this.onAddFile}
onAddFolder={this.onAddFolder}
onUploadFile={this.onUploadFile}
onUploadFolder={this.onUploadFolder}
currentMode={this.state.currentMode}
switchViewMode={this.switchViewMode}
onSearchedClick={this.onSearchedClick}
isRepoOwner={isRepoOwner}
currentRepoInfo={this.state.currentRepoInfo}
updateDirent={this.updateDirent}
onDirentSelected={this.onDirentSelected}
showDirentDetail={this.showDirentDetail}
unSelectDirent={this.unSelectDirent}
onFilesTagChanged={this.onFileTagChanged}
repoTags={this.state.repoTags}
/>
</div> */}
<div className="main-panel-center flex-row">
<LibContentContainer
isSidePanelFolded={this.props.isSidePanelFolded}
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/pages/libraries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import GroupItem from '../../pages/groups/group-item';
import '../../css/files.css';

const propTypes = {
onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired
};

class Libraries extends Component {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/my-libs/my-libs-deleted.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ DeletedRepoItem.propTypes = {
};

MyLibsDeleted.propTypes = {
onSearchedClick: PropTypes.func.isRequired,
};

export default MyLibsDeleted;
3 changes: 0 additions & 3 deletions frontend/src/pages/my-libs/my-libs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import cookie from 'react-cookies';
import { navigate } from '@gatsbyjs/reach-router';
import { DropdownToggle, Dropdown, DropdownMenu, DropdownItem } from 'reactstrap';
Expand All @@ -17,8 +16,6 @@ import ModalPortal from '../../components/modal-portal';
import CreateRepoDialog from '../../components/dialog/create-repo-dialog';

const propTypes = {
onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired,
};

class MyLibraries extends Component {
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/pages/share-admin/share-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import ShareLinkPermissionSelect from '../../components/dialog/share-link-permis
import ShareAdminLink from '../../components/dialog/share-admin-link';
import SortOptionsDialog from '../../components/dialog/sort-options';
import CommonOperationConfirmationDialog from '../../components/dialog/common-operation-confirmation-dialog';
import TopToolbar from '../../components/toolbar/top-toolbar';
import Selector from '../../components/single-selector';
import SingleDropdownToolbar from '../../components/toolbar/single-dropdown-toolbar';

Expand Down Expand Up @@ -364,8 +363,6 @@ class Item extends Component {
Item.propTypes = itemPropTypes;

const propTypes = {
onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired
};

const PER_PAGE = 25;
Expand Down Expand Up @@ -540,11 +537,6 @@ class ShareAdminShareLinks extends Component {
render() {
return (
<Fragment>
{/* <TopToolbar
onShowSidePanel={this.props.onShowSidePanel}
onSearchedClick={this.props.onSearchedClick}
>
</TopToolbar> */}
<div className="main-panel-center">
<div className="cur-view-container">
<div className="cur-view-path share-upload-nav">
Expand Down
Loading

0 comments on commit 0aba048

Please sign in to comment.