-
- {this.getTitle()}
-
+
+
+ {this.getTitle()}
+
+
{this._renderLoader()}
{this.hasCollection() && this._renderCollectionMetadata()}
{this._renderEmptyTable()}
@@ -332,7 +331,7 @@ class Collection extends React.Component {
}
-
+
);
}
}
@@ -343,7 +342,10 @@ Collection.propTypes = {
authenticated: PropTypes.bool.isRequired
}).isRequired,
getCollections: PropTypes.func.isRequired,
- collection: PropTypes.shape({}).isRequired, // TODO
+ collection: PropTypes.shape({
+ name: PropTypes.string.isRequired,
+ description: PropTypes.string,
+ }).isRequired,
username: PropTypes.string,
loading: PropTypes.bool.isRequired,
toggleDirectionForField: PropTypes.func.isRequired,
diff --git a/client/modules/User/components/CollectionCreate.jsx b/client/modules/User/components/CollectionCreate.jsx
index 3542e6a3..139982b5 100644
--- a/client/modules/User/components/CollectionCreate.jsx
+++ b/client/modules/User/components/CollectionCreate.jsx
@@ -41,7 +41,10 @@ class CollectionCreate extends React.Component {
this.props.createCollection(this.state.collection)
.then(({ id, owner }) => {
- browserHistory.replace(`/${owner.username}/collections/${id}`);
+ const pathname = `/${owner.username}/collections/${id}`;
+ const location = { pathname, state: { skipSavingPath: true } };
+
+ browserHistory.replace(location);
})
.catch((error) => {
console.error('Error creating collection', error);
@@ -58,42 +61,49 @@ class CollectionCreate extends React.Component {
const invalid = name === '' || name == null;
return (
-
+
+
Create collection
+
+
+
);
}
}
diff --git a/client/modules/User/pages/CollectionView.jsx b/client/modules/User/pages/CollectionView.jsx
index 652e4310..a0834bdc 100644
--- a/client/modules/User/pages/CollectionView.jsx
+++ b/client/modules/User/pages/CollectionView.jsx
@@ -7,6 +7,7 @@ import { updateSettings, initiateVerification, createApiKey, removeApiKey } from
import NavBasic from '../../../components/NavBasic';
import CollectionCreate from '../components/CollectionCreate';
+import Collection from '../components/Collection';
class CollectionView extends React.Component {
static defaultProps = {
@@ -61,7 +62,12 @@ class CollectionView extends React.Component {
return
;
}
- return 'collection page';
+ return (
+
+ );
}
render() {
@@ -69,15 +75,7 @@ class CollectionView extends React.Component {
-
-
-
{this.pageTitle()}
-
-
-
- {this.renderContent()}
-
-
+ {this.renderContent()}
);
}
@@ -102,6 +100,7 @@ CollectionView.propTypes = {
pathname: PropTypes.string.isRequired,
}).isRequired,
params: PropTypes.shape({
+ collection_id: PropTypes.string.isRequired,
username: PropTypes.string.isRequired,
}).isRequired,
previousPath: PropTypes.string.isRequired,
diff --git a/client/routes.jsx b/client/routes.jsx
index 598a2dbe..56a2d18e 100644
--- a/client/routes.jsx
+++ b/client/routes.jsx
@@ -46,7 +46,7 @@ const routes = store => (
-
+
diff --git a/client/styles/components/_collection.scss b/client/styles/components/_collection.scss
new file mode 100644
index 00000000..f49c7345
--- /dev/null
+++ b/client/styles/components/_collection.scss
@@ -0,0 +1,21 @@
+.collection-container {
+
+}
+
+.collection-metadata {
+ margin: 0px #{56 / $base-font-size}rem;
+ padding: #{24 / $base-font-size}rem #{10 / $base-font-size}rem;
+
+ @include themify() {
+ background-color: getThemifyVariable('modal-background-color');
+ border-bottom: 1px dotted getThemifyVariable('modal-border-color');
+ }
+}
+
+.collection-metadata__user {
+ padding-top: #{12 / $base-font-size}rem;
+}
+
+.collection-metadata__description {
+ padding-top: #{24 / $base-font-size}rem;
+}
diff --git a/client/styles/components/_dashboard-header.scss b/client/styles/components/_dashboard-header.scss
index 126f88a9..b5661776 100644
--- a/client/styles/components/_dashboard-header.scss
+++ b/client/styles/components/_dashboard-header.scss
@@ -7,6 +7,10 @@
flex-direction:column;
}
+.dashboard-header--no-vertical-padding {
+ padding: 0 66px;
+}
+
.dashboard-header__tabs {
display: flex;
padding-top: #{24 / $base-font-size}rem;
diff --git a/client/styles/main.scss b/client/styles/main.scss
index 128b0aee..ee459c6c 100644
--- a/client/styles/main.scss
+++ b/client/styles/main.scss
@@ -49,6 +49,7 @@
@import 'components/tabs';
@import 'components/dashboard-header';
@import 'components/editable-input';
+@import 'components/collection';
@import 'layout/dashboard';
@import 'layout/ide';
diff --git a/server/routes/server.routes.js b/server/routes/server.routes.js
index 8222ce96..eb428ce2 100644
--- a/server/routes/server.routes.js
+++ b/server/routes/server.routes.js
@@ -112,10 +112,14 @@ router.get('/:username/sketches', (req, res) => {
));
});
-router.get('/:username/collections', (req, res) => {
- userExists(req.params.username, exists => (
- exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html))
- ));
+router.get('/:username/collections/create', (req, res) => {
+ userExists(req.params.username, (exists) => {
+ const isLoggedInUser = req.user && req.user.username === req.params.username;
+ const canAccess = exists && isLoggedInUser;
+ return canAccess ?
+ res.send(renderIndex()) :
+ get404Sketch(html => res.send(html));
+ });
});
router.get('/:username/collections/create', (req, res) => {
@@ -136,4 +140,10 @@ router.get('/:username/collections/:id', (req, res) => {
));
});
+router.get('/:username/collections', (req, res) => {
+ userExists(req.params.username, exists => (
+ exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html))
+ ));
+});
+
export default router;