diff --git a/client/components/Nav.jsx b/client/components/Nav.jsx index 8dab6854..e6c58e0d 100644 --- a/client/components/Nav.jsx +++ b/client/components/Nav.jsx @@ -322,6 +322,19 @@ class Nav extends React.PureComponent { Open } + { __process.env.UI_COLLECTIONS_ENABLED && + this.props.user.authenticated && + this.props.project.id && +
  • + + Add to Collection + +
  • } { __process.env.EXAMPLES_ENABLED &&
  • } + {this.props.location.pathname.match(/add-to-collection$/) && + + + + } {this.props.ide.shareModalVisible && ( + diff --git a/server/routes/server.routes.js b/server/routes/server.routes.js index eb428ce2..ddec0c22 100644 --- a/server/routes/server.routes.js +++ b/server/routes/server.routes.js @@ -27,12 +27,24 @@ router.get('/projects/:project_id', (req, res) => { )); }); +router.get('/:username/sketches/:project_id/add-to-collection', (req, res) => { + projectForUserExists(req.params.username, req.params.project_id, exists => ( + exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html)) + )); +}); + router.get('/:username/sketches/:project_id', (req, res) => { projectForUserExists(req.params.username, req.params.project_id, exists => ( exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html)) )); }); +router.get('/:username/sketches', (req, res) => { + userExists(req.params.username, exists => ( + exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html)) + )); +}); + router.get('/:username/full/:project_id', (req, res) => { projectForUserExists(req.params.username, req.params.project_id, exists => ( exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html)) @@ -106,12 +118,6 @@ router.get('/feedback', (req, res) => { res.send(renderIndex()); }); -router.get('/:username/sketches', (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; @@ -128,12 +134,6 @@ router.get('/:username/collections/create', (req, res) => { )); }); -router.get('/:username/sketches/:project_id/add-to-collection', (req, res) => { - projectForUserExists(req.params.username, req.params.project_id, exists => ( - exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html)) - )); -}); - router.get('/:username/collections/:id', (req, res) => { collectionForUserExists(req.params.username, req.params.id, exists => ( exists ? res.send(renderIndex()) : get404Sketch(html => res.send(html))