Skip to content

Commit 686f9e5

Browse files
committed
Merge branch 'release-2.15.2' into release
2 parents 6a632a2 + d34adc2 commit 686f9e5

File tree

5 files changed

+19
-27
lines changed

5 files changed

+19
-27
lines changed

client/modules/User/components/Collection.jsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,14 @@ import ArrowDownIcon from '../../../images/sort-arrow-down.svg';
1313
import CollectionMetadata from './CollectionMetadata';
1414
import CollectionItemRow from './CollectionItemRow';
1515

16-
const Collection = ({ collectionId }) => {
16+
const Collection = ({ collectionId, username }) => {
1717
const { t } = useTranslation();
1818
const dispatch = useDispatch();
1919

20-
const { user, collection, sorting, loading, username } = useSelector(
21-
(state) => ({
22-
user: state.user,
23-
collection: getCollection(state, collectionId),
24-
sorting: state.sorting,
25-
loading: state.loading,
26-
username: state.user.username
27-
})
28-
);
20+
const user = useSelector((state) => state.user);
21+
const collection = useSelector((state) => getCollection(state, collectionId));
22+
const sorting = useSelector((state) => state.sorting);
23+
const loading = useSelector((state) => state.loading);
2924

3025
useEffect(() => {
3126
dispatch(CollectionsActions.getCollections(username));
@@ -34,7 +29,7 @@ const Collection = ({ collectionId }) => {
3429

3530
const isOwner = () =>
3631
user != null &&
37-
user.username &&
32+
typeof user.username !== 'undefined' &&
3833
collection?.owner?.username === user.username;
3934

4035
const hasCollection = () => !!collection;
@@ -160,7 +155,8 @@ const Collection = ({ collectionId }) => {
160155
};
161156

162157
Collection.propTypes = {
163-
collectionId: PropTypes.string.isRequired
158+
collectionId: PropTypes.string.isRequired,
159+
username: PropTypes.string.isRequired
164160
};
165161

166162
export default Collection;

client/modules/User/components/CollectionItemRow.jsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ import PropTypes from 'prop-types';
22
import React from 'react';
33
import { Link } from 'react-router-dom';
44
import { useTranslation } from 'react-i18next';
5+
import { useDispatch } from 'react-redux';
6+
import { removeFromCollection } from '../../IDE/actions/collections';
57
import dates from '../../../utils/formatDate';
68
import RemoveIcon from '../../../images/close.svg';
79

8-
const CollectionItemRow = ({
9-
collection,
10-
item,
11-
isOwner,
12-
removeFromCollection
13-
}) => {
10+
const CollectionItemRow = ({ collection, item, isOwner }) => {
1411
const { t } = useTranslation();
12+
const dispatch = useDispatch();
1513
const projectIsDeleted = item.isDeleted;
16-
1714
const handleSketchRemove = () => {
1815
const name = projectIsDeleted ? 'deleted sketch' : item.project.name;
1916

@@ -22,7 +19,7 @@ const CollectionItemRow = ({
2219
t('Collection.DeleteFromCollection', { name_sketch: name })
2320
)
2421
) {
25-
removeFromCollection(collection.id, item.projectId);
22+
dispatch(removeFromCollection(collection.id, item.projectId));
2623
}
2724
};
2825

@@ -75,10 +72,9 @@ CollectionItemRow.propTypes = {
7572
user: PropTypes.shape({
7673
username: PropTypes.string.isRequired
7774
})
78-
}).isRequired
75+
})
7976
}).isRequired,
80-
isOwner: PropTypes.bool.isRequired,
81-
removeFromCollection: PropTypes.func.isRequired
77+
isOwner: PropTypes.bool.isRequired
8278
};
8379

8480
export default CollectionItemRow;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p5.js-web-editor",
3-
"version": "2.15.1",
3+
"version": "2.15.2",
44
"description": "The web editor for p5.js.",
55
"scripts": {
66
"clean": "rimraf dist",

server/views/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function renderIndex() {
1212
<meta name="description" content="A web editor for p5.js, a JavaScript library with the goal of making coding accessible to artists, designers, educators, and beginners." />
1313
<title>p5.js Web Editor</title>
1414
${process.env.NODE_ENV === 'production' ? `<link rel='stylesheet' href='${assetsManifest['/app.css']}' />` : ''}
15-
<link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
15+
<link href='https://fonts.googleapis.com/css?family=Inconsolata:400,700' rel='stylesheet' type='text/css'>
1616
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
1717
<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon' / >
1818
<script>

0 commit comments

Comments
 (0)