mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 00:20:07 +00:00
Wiki coding style improve (#2380)
This commit is contained in:
committed by
Daniel Pan
parent
3d165ec733
commit
db47fb34a7
@@ -1,13 +1,21 @@
|
||||
import React, { Component } from 'react';
|
||||
import { gettext, repoID, serviceUrl, slug, siteRoot, isPro, permission } from '../../components/constants';
|
||||
import Search from '../../components/search';
|
||||
import { gettext, repoID, serviceUrl, slug, siteRoot, isPro } from '../../components/constants';
|
||||
import Search from '../../components/search/search';
|
||||
import Account from '../../components/account';
|
||||
import Notification from '../../components/notification';
|
||||
import PathToolbar from '../../components/toolbar/path-toolbar';
|
||||
import MarkdownViewer from '../../components/markdown-viewer';
|
||||
import TreeDirView from '../../components/tree-dir-view/tree-dir-view';
|
||||
|
||||
class MainPanel extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isWikiMode: true
|
||||
}
|
||||
}
|
||||
|
||||
onMenuClick = () => {
|
||||
this.props.onMenuClick();
|
||||
}
|
||||
@@ -24,6 +32,10 @@ class MainPanel extends Component {
|
||||
|
||||
switchViewMode = (e) => {
|
||||
e.preventDefault();
|
||||
if (e.target.id === 'wiki') {
|
||||
return;
|
||||
}
|
||||
this.setState({isWikiMode: false});
|
||||
this.props.switchViewMode(e.target.id);
|
||||
}
|
||||
|
||||
@@ -42,7 +54,15 @@ class MainPanel extends Component {
|
||||
} else {
|
||||
nodePath += "/" + item;
|
||||
return (
|
||||
<a key={index} className="custom-link" data-path={nodePath} onClick={this.onMainNavBarClick}><span className="path-split">/</span>{item}</a>
|
||||
<span key={index} >
|
||||
<span className="path-split">/</span>
|
||||
<a
|
||||
className="path-link"
|
||||
data-path={nodePath}
|
||||
onClick={this.onMainNavBarClick}>
|
||||
{item}
|
||||
</a>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
});
|
||||
@@ -50,18 +70,24 @@ class MainPanel extends Component {
|
||||
return (
|
||||
<div className="wiki-main-panel o-hidden">
|
||||
<div className="main-panel-top panel-top">
|
||||
<span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.onMenuClick}></span>
|
||||
<div className="wiki-page-ops">
|
||||
{ permission &&
|
||||
<a className="btn btn-secondary btn-topbar" title="Edit File" onClick={this.onEditClick}>{gettext("Edit")}</a>
|
||||
}
|
||||
<a className="btn btn-secondary btn-topbar sf2-icon-list-view" id='list' title={gettext("List")} onClick={this.switchViewMode}></a>
|
||||
<a className="btn btn-secondary btn-topbar sf2-icon-grid-view" id='grid' title={gettext("Grid")} onClick={this.switchViewMode}></a>
|
||||
<div className="cur-view-toolbar">
|
||||
<span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.onMenuClick}></span>
|
||||
<div>
|
||||
{
|
||||
this.props.permission === 'rw' &&
|
||||
<button className="btn btn-secondary top-toolbar-btn" title="Edit File" onClick={this.onEditClick}>{gettext("Edit")}</button>
|
||||
}
|
||||
</div>
|
||||
<div className="btn-group">
|
||||
<button className="btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-list-view" id='list' title={gettext("List")} onClick={this.switchViewMode}></button>
|
||||
<button className="btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-grid-view" id='grid' title={gettext("Grid")} onClick={this.switchViewMode}></button>
|
||||
<button className={`btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-wiki-view ${this.state.isWikiMode ? 'current-mode' : ''}`} id='wiki' title={gettext("wiki")} onClick={this.switchViewMode}></button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="common-toolbar">
|
||||
{isPro && <Search onSearchedClick={this.props.onSearchedClick}
|
||||
placeholder={gettext("Search files in this library")}
|
||||
/>
|
||||
{
|
||||
isPro &&
|
||||
<Search onSearchedClick={this.props.onSearchedClick} placeholder={gettext("Search files in this library")} />
|
||||
}
|
||||
<Notification />
|
||||
<Account />
|
||||
@@ -75,8 +101,9 @@ class MainPanel extends Component {
|
||||
<a href={siteRoot + 'wiki/lib/' + repoID + '/'} className="normal">{slug}</a>
|
||||
{pathElem}
|
||||
</div>
|
||||
<PathToolbar />
|
||||
</div>
|
||||
<div className="cur-view-container">
|
||||
<div className="cur-view-container table-container">
|
||||
{ this.props.isViewFileState && <MarkdownViewer
|
||||
markdownContent={this.props.content}
|
||||
latestContributor={this.props.latestContributor}
|
||||
|
Reference in New Issue
Block a user