Remove new collection creation for now

This commit is contained in:
Jori Lallo 2016-08-12 15:10:44 +02:00
parent b2d00f3384
commit bd9a55594b
5 changed files with 8 additions and 110 deletions

View File

@ -1,39 +0,0 @@
import React from 'react';
import CenteredContent from 'components/CenteredContent';
import { Button } from 'rebass';
import styles from './FullscreenField.scss';
import classNames from 'classnames/bind';
const cx = classNames.bind(styles);
class FullscreenField extends React.Component {
render() {
return (
<div className={ styles.container }>
<CenteredContent>
<div className={ styles.content }>
<h2>Create a new collection</h2>
<p>Collections are spaces where you, your teams or friends can share and collect information.</p>
<div className={ styles.field }>
<div className={ styles.label }>Collection name</div>
<input type="text" placeholder="Meeting notes" />
</div>
<div className={ cx(styles.field, styles.description) }>
<div className={ styles.label }>Description</div>
<input type="text" placeholder="All your note are belong to us" />
</div>
<div className={ styles.field }>
<button className={ styles.button }>Create collection</button>
</div>
</div>
</CenteredContent>
</div>
);
}
}
export default FullscreenField;

View File

@ -1,46 +0,0 @@
.container {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: center;
background-color: #fff;
}
.content {
padding: 100px 0;
}
.field {
padding: 20px 0;
.label {
font-size: 16px;
font-weight: bold;
color: #242425;
}
input {
font-size: 32px;
width: 100%;
padding: 5px 0;
border: 0;
border-bottom: 1px solid #242425;
border-radius: 0;
outline: none;
}
}
.button {
font-size: 20px;
background-color: #171B35;
color: #FAFAFA;
padding: 8px 20px 5px;
border: none;
}

View File

@ -1,2 +0,0 @@
import FullscreenField from './FullscreenField';
export default FullscreenField;

View File

@ -9,7 +9,6 @@ import AtlasPreview from 'components/AtlasPreview';
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
import CenteredContent from 'components/CenteredContent';
import DropdownMenu, { MenuItem, MoreIcon } from 'components/DropdownMenu';
import FullscreenField from 'components/FullscreenField';
// import styles from './Dashboard.scss';
@ -19,26 +18,16 @@ class Dashboard extends React.Component {
user: React.PropTypes.object.isRequired,
}
state = {
newAtlasVisible: false,
}
componentDidMount = () => {
store.fetchCollections(this.props.user.team.id);
}
onClickNewAtlas = () => {
this.setState({
newAtlasVisible: true,
});
}
render() {
const actions = (
<Flex>
<DropdownMenu label={ <MoreIcon /> } >
<MenuItem onClick={ this.onClickNewAtlas }>
New Atlas
Add collection
</MenuItem>
</DropdownMenu>
</Flex>
@ -59,8 +48,6 @@ class Dashboard extends React.Component {
</Flex>
</CenteredContent>
</Layout>
{ this.state.newAtlasVisible && <FullscreenField /> }
</Flex>
);
}

View File

@ -154,21 +154,19 @@ const Atlas = sequelize.define('atlas', {
},
async deleteDocument(document) {
const deleteNodeAndDocument = async (node, documentId, shouldDelete = false) => {
if (document.id === node.id) {
shouldDelete = true;
}
// Delete node if id matches
if (document.id === node.id) shouldDelete = true;
const newChildren = [];
node.children.map(async childNode => {
node.children.forEach(async childNode => {
const child = await deleteNodeAndDocument(childNode, documentId, shouldDelete);
if (child) {
newChildren.push(child);
}
if (child) newChildren.push(child);
});
node.children = newChildren;
if (shouldDelete) {
const document = await Document.findById(node.id);
await document.destroy();
const doc = await Document.findById(node.id);
await doc.destroy();
}
return shouldDelete ? null : node;