diff --git a/frontend/components/Layout/Layout.js b/frontend/components/Layout/Layout.js index 375c578ff..30364d469 100644 --- a/frontend/components/Layout/Layout.js +++ b/frontend/components/Layout/Layout.js @@ -22,7 +22,6 @@ class Layout extends React.Component { actions: React.PropTypes.node, title: React.PropTypes.node, titleText: React.PropTypes.node, - fixed: React.PropTypes.bool, loading: React.PropTypes.bool, user: React.PropTypes.object.isRequired, search: React.PropTypes.bool, @@ -59,7 +58,7 @@ class Layout extends React.Component { ) : null } -
+
{ user.team.name } @@ -93,7 +92,9 @@ class Layout extends React.Component {
-
+
{ this.props.children }
diff --git a/frontend/components/Layout/Layout.scss b/frontend/components/Layout/Layout.scss index 0cb270d58..568c672f1 100644 --- a/frontend/components/Layout/Layout.scss +++ b/frontend/components/Layout/Layout.scss @@ -6,6 +6,7 @@ flex-direction: column; width: 100%; + height: 100%; } .header { @@ -20,15 +21,6 @@ font-size: 14px; line-height: 1; - - &.fixed { - position: fixed; - top: 0; - left: 0; - right: 0; - z-index: 900; - background: #fff; - } } .headerLeft { @@ -73,8 +65,6 @@ display: flex; flex: 1; justify-content: center; - - &.fixed { - padding-top: $headerHeight; - } + height: 100%; + overflow: scroll; } diff --git a/frontend/components/Tree/Node.js b/frontend/components/Tree/Node.js index 9408fd5e1..e4472b9b8 100644 --- a/frontend/components/Tree/Node.js +++ b/frontend/components/Tree/Node.js @@ -1,14 +1,14 @@ -var React = require('react'); +import React from 'react'; import history from 'utils/History'; import styles from './Tree.scss'; import classNames from 'classnames/bind'; const cx = classNames.bind(styles); -var Node = React.createClass({ - displayName: 'UITreeNode', +class Node extends React.Component { + displayName: 'UITreeNode' - renderCollapse() { + renderCollapse = () => { var index = this.props.index; if(index.children && index.children.length) { @@ -26,9 +26,9 @@ var Node = React.createClass({ } return null; - }, + } - renderChildren() { + renderChildren = () => { var index = this.props.index; var tree = this.props.tree; var dragging = this.props.dragging; @@ -51,6 +51,7 @@ var Node = React.createClass({ index={childIndex} key={childIndex.id} dragging={dragging} + allowUpdates={ this.props.allowUpdates } paddingLeft={this.props.paddingLeft} onCollapse={this.props.onCollapse} onDragStart={this.props.onDragStart} @@ -62,14 +63,25 @@ var Node = React.createClass({ } return null; - }, + } + + isModifying = () => { + return this.props.allowUpdates && !this.props.rootNode; + } + + onClick = () => { + const index = this.props.index; + const node = index.node; + + if (!this.isModifying()) history.push(node.url); + } render() { - var tree = this.props.tree; - var index = this.props.index; - var dragging = this.props.dragging; - var node = index.node; - var style = {}; + const tree = this.props.tree; + const index = this.props.index; + const dragging = this.props.dragging; + const node = index.node; + const style = {}; return (
e.stopPropagation() : this.handleMouseDown} + onMouseDown={this.props.rootNode || !this.props.allowUpdates ? (e) => e.stopPropagation() : this.handleMouseDown} > - {!this.props.rootNode && this.renderCollapse()} + { !this.props.rootNode && this.renderCollapse() } { history.push(node.url) }} + className={ cx(styles.nodeLabel, { + rootLabel: this.props.rootNode, + isModifying: this.isModifying(), + }) } + onClick={ this.onClick } > { node.title } @@ -92,15 +107,15 @@ var Node = React.createClass({ {this.renderChildren()}
); - }, + } - handleCollapse(e) { + handleCollapse = (e) => { e.stopPropagation(); var nodeId = this.props.index.id; if(this.props.onCollapse) this.props.onCollapse(nodeId); - }, + } - handleMouseDown(e) { + handleMouseDown = (e) => { var nodeId = this.props.index.id; var dom = this.refs.inner; @@ -108,6 +123,6 @@ var Node = React.createClass({ this.props.onDragStart(nodeId, dom, e); } } -}); +}; -module.exports = Node; \ No newline at end of file +module.exports = Node; diff --git a/frontend/components/Tree/Tree.scss b/frontend/components/Tree/Tree.scss index 2e3d443ea..9a8a0d6a1 100644 --- a/frontend/components/Tree/Tree.scss +++ b/frontend/components/Tree/Tree.scss @@ -7,9 +7,14 @@ } .tree { - position: relative; - overflow: hidden; @include no-select; + padding: 20px 20px 20px 5px; + overflow: scroll; + position: absolute; + top: 0; + bottom: 40px; + right: 0; + left: 0; } .draggable { @@ -71,6 +76,10 @@ white-space: nowrap; overflow: hidden; + &.isModifying { + cursor: move; + } + &.isActive { background-color: #31363F; } diff --git a/frontend/components/Tree/UiTree.js b/frontend/components/Tree/UiTree.js index 9fdc21e26..d7d52115e 100644 --- a/frontend/components/Tree/UiTree.js +++ b/frontend/components/Tree/UiTree.js @@ -10,8 +10,8 @@ module.exports = React.createClass({ propTypes: { tree: React.PropTypes.object.isRequired, paddingLeft: React.PropTypes.number, - renderNode: React.PropTypes.func.isRequired, onCollapse: React.PropTypes.func, + allowUpdates: React.PropTypes.bool, }, getDefaultProps() { @@ -32,7 +32,6 @@ module.exports = React.createClass({ init(props) { var tree = new Tree(props.tree); tree.isNodeCollapsed = props.isNodeCollapsed; - tree.renderNode = props.renderNode; tree.changeNodeCollapsed = props.changeNodeCollapsed; tree.updateNodesPosition(); @@ -61,11 +60,12 @@ module.exports = React.createClass({ }; return ( -
+
); @@ -81,16 +81,17 @@ module.exports = React.createClass({ return (
- {draggingDom} + { draggingDom }
); diff --git a/frontend/index.js b/frontend/index.js index d1ad6fe8b..2a8b070cd 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -43,7 +43,7 @@ function requireAuth(nextState, replace) { } render(( -
+
diff --git a/frontend/scenes/Application.js b/frontend/scenes/Application.js index 3a52ee3a4..ac5e2e65d 100644 --- a/frontend/scenes/Application.js +++ b/frontend/scenes/Application.js @@ -1,15 +1,18 @@ -import React from "react"; +import React from 'react'; import { observer } from 'mobx-react'; -import Helmet from "react-helmet"; +import Helmet from 'react-helmet'; const Application = observer((props) => { return ( -
+
{ props.children }
@@ -18,6 +21,6 @@ const Application = observer((props) => { Application.propTypes = { children: React.PropTypes.node.isRequired, -} +}; export default Application; diff --git a/frontend/scenes/DocumentScene/DocumentScene.js b/frontend/scenes/DocumentScene/DocumentScene.js index 19fbf8ea6..210b506d6 100644 --- a/frontend/scenes/DocumentScene/DocumentScene.js +++ b/frontend/scenes/DocumentScene/DocumentScene.js @@ -175,7 +175,7 @@ class DocumentScene extends React.Component { onNodeCollapse={ this.store.onNodeCollapse } /> ) } - + { this.store.updatingContent ? ( diff --git a/frontend/scenes/DocumentScene/DocumentScene.scss b/frontend/scenes/DocumentScene/DocumentScene.scss index 91ad443b6..0fa9fdf25 100644 --- a/frontend/scenes/DocumentScene/DocumentScene.scss +++ b/frontend/scenes/DocumentScene/DocumentScene.scss @@ -5,4 +5,5 @@ .content { position: relative; + overflow: scroll; } diff --git a/frontend/scenes/DocumentScene/components/Sidebar/Sidebar.js b/frontend/scenes/DocumentScene/components/Sidebar/Sidebar.js index 396b4d8b2..13f3ef748 100644 --- a/frontend/scenes/DocumentScene/components/Sidebar/Sidebar.js +++ b/frontend/scenes/DocumentScene/components/Sidebar/Sidebar.js @@ -8,10 +8,14 @@ import styles from './Sidebar.scss'; import classNames from 'classnames/bind'; const cx = classNames.bind(styles); -import treeStyles from 'components/Tree/Tree.scss'; +import SidebarStore from './SidebarStore'; + +// import treeStyles from 'components/Tree/Tree.scss'; @observer class Sidebar extends React.Component { + static store; + static propTypes = { open: PropTypes.bool, onToggle: PropTypes.func.isRequired, @@ -20,27 +24,39 @@ class Sidebar extends React.Component { onNodeCollapse: PropTypes.func.isRequired, } - renderNode = (node) => { - return ( - - { node.module.name } - - ); + constructor(props) { + super(props); + + this.store = new SidebarStore(); + } + + toggleEdit = (e) => { + e.preventDefault(); + this.store.toggleEdit(); } render() { return ( { this.props.open && ( -
- -
+ + + + + + Edit + + ) }
{ + this.isEditing = !this.isEditing; + } +} + +export default SidebarStore; diff --git a/frontend/styles/constants.scss b/frontend/styles/constants.scss index fb624d1a2..7910a5f5f 100644 --- a/frontend/styles/constants.scss +++ b/frontend/styles/constants.scss @@ -3,6 +3,9 @@ $lightGray: #eee; $textColor: #171B35; $actionColor: #2da9e1; +$darkGray: #ccc; +$lightGray: #eee; + $headerHeight: 42px; :export { diff --git a/server/static/dev.html b/server/static/dev.html index 1e106697b..091e809ca 100644 --- a/server/static/dev.html +++ b/server/static/dev.html @@ -6,6 +6,7 @@ - +
diff --git a/server/static/index.html b/server/static/index.html index f136144ac..abdd89b82 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -5,6 +5,7 @@ - +