Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into refactor/AddToCo…
Browse files Browse the repository at this point in the history
…llectionList

# Conflicts:
#	client/modules/IDE/components/AddToCollectionList.jsx
  • Loading branch information
lindapaiste committed Aug 13, 2023
2 parents 95f48e8 + 0bd139b commit 0c0163b
Show file tree
Hide file tree
Showing 19 changed files with 754 additions and 1,048 deletions.
23 changes: 19 additions & 4 deletions client/modules/IDE/components/AddToCollectionList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { useEffect, useState } from 'react';
import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import styled from 'styled-components';
import Loader from '../../App/components/loader';
import {
addToCollection,
Expand All @@ -11,6 +12,20 @@ import {
} from '../actions/collections';
import getSortedCollections from '../selectors/collections';
import QuickAddList from './QuickAddList';
import { remSize } from '../../../theme';

export const CollectionAddSketchWrapper = styled.div`
width: ${remSize(600)};
max-width: 100%;
overflow: auto;
`;

export const QuickAddWrapper = styled.div`
width: ${remSize(600)};
max-width: 100%;
padding: ${remSize(24)};
height: 100%;
`;

const AddToCollectionList = ({ projectId }) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -60,14 +75,14 @@ const AddToCollectionList = ({ projectId }) => {
};

return (
<div className="collection-add-sketch">
<div className="quick-add-wrapper">
<CollectionAddSketchWrapper>
<QuickAddWrapper>
<Helmet>
<title>{t('AddToCollectionList.Title')}</title>
</Helmet>
{getContent()}
</div>
</div>
</QuickAddWrapper>
</CollectionAddSketchWrapper>
);
};

Expand Down
12 changes: 8 additions & 4 deletions client/modules/IDE/components/AddToCollectionSketchList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import * as SortingActions from '../actions/sorting';
import getSortedSketches from '../selectors/projects';
import Loader from '../../App/components/loader';
import QuickAddList from './QuickAddList';
import {
CollectionAddSketchWrapper,
QuickAddWrapper
} from './AddToCollectionList';

class SketchList extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -81,14 +85,14 @@ class SketchList extends React.Component {
}

return (
<div className="collection-add-sketch">
<div className="quick-add-wrapper">
<CollectionAddSketchWrapper>
<QuickAddWrapper>
<Helmet>
<title>{this.getSketchesTitle()}</title>
</Helmet>
{content}
</div>
</div>
</QuickAddWrapper>
</CollectionAddSketchWrapper>
);
}
}
Expand Down
6 changes: 2 additions & 4 deletions client/modules/IDE/components/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import '../../../utils/htmlmixed';
import '../../../utils/p5-javascript';
import Timer from '../components/Timer';
import EditorAccessibility from '../components/EditorAccessibility';
import { selectActiveFile } from '../selectors/files';
import AssetPreview from './AssetPreview';
import { metaKey } from '../../../utils/metaKey';
import './show-hint';
Expand Down Expand Up @@ -605,10 +606,7 @@ Editor.propTypes = {
function mapStateToProps(state) {
return {
files: state.files,
file:
state.files.find((file) => file.isSelectedFile) ||
state.files.find((file) => file.name === 'sketch.js') ||
state.files.find((file) => file.name !== 'root'),
file: selectActiveFile(state),
htmlFile: getHTMLFile(state.files),
ide: state.ide,
preferences: state.preferences,
Expand Down
8 changes: 3 additions & 5 deletions client/modules/IDE/components/Header/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { setLanguage } from '../../actions/preferences';
import NavBar from '../../../../components/Nav/NavBar';
import CaretLeftIcon from '../../../../images/left-arrow.svg';
import LogoIcon from '../../../../images/p5js-logo-small.svg';
import { selectRootFile } from '../../selectors/files';
import { selectSketchPath } from '../../selectors/project';
import { metaKey, metaKeyName } from '../../../../utils/metaKey';
import { useSketchActions } from '../../hooks';
Expand Down Expand Up @@ -102,17 +103,14 @@ const DashboardMenu = () => {
);
};

const ProjectMenu = (props) => {
const ProjectMenu = () => {
const isUserOwner = useSelector(getIsUserOwner);
const project = useSelector((state) => state.project);
const user = useSelector((state) => state.user);

const isUnsaved = !project?.id;

// TODO: use selectRootFile selector
const rootFile = useSelector(
(state) => state.files.filter((file) => file.name === 'root')[0]
);
const rootFile = useSelector(selectRootFile);

const cmRef = useContext(CmControllerContext);

Expand Down
Loading

0 comments on commit 0c0163b

Please sign in to comment.