Merge branch 'master' of https://github.com/processing/p5.js-web-editor into fix/rename-file-set-unsaved

This commit is contained in:
ghalestrilo 2020-04-07 20:42:15 -03:00
commit 55a3d1a66b
5 changed files with 73 additions and 49 deletions

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
custom: https://processingfoundation.org/support

View file

@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import { Link, browserHistory } from 'react-router'; import { Link } from 'react-router';
import InlineSVG from 'react-inlinesvg'; import InlineSVG from 'react-inlinesvg';
import classNames from 'classnames'; import classNames from 'classnames';
import * as IDEActions from '../modules/IDE/actions/ide'; import * as IDEActions from '../modules/IDE/actions/ide';
@ -167,8 +167,6 @@ class Nav extends React.PureComponent {
handleLogout() { handleLogout() {
this.props.logoutUser(); this.props.logoutUser();
// if you're on the settings page, probably.
browserHistory.push('/');
this.setDropdown('none'); this.setDropdown('none');
} }
@ -184,7 +182,8 @@ class Nav extends React.PureComponent {
} }
handleShare() { handleShare() {
this.props.showShareModal(); const { username } = this.props.params;
this.props.showShareModal(this.props.project.id, this.props.project.name, username);
this.setDropdown('none'); this.setDropdown('none');
} }
@ -717,6 +716,7 @@ Nav.propTypes = {
}).isRequired, }).isRequired,
project: PropTypes.shape({ project: PropTypes.shape({
id: PropTypes.string, id: PropTypes.string,
name: PropTypes.string,
owner: PropTypes.shape({ owner: PropTypes.shape({
id: PropTypes.string id: PropTypes.string
}) })
@ -742,7 +742,10 @@ Nav.propTypes = {
layout: PropTypes.oneOf(['dashboard', 'project']), layout: PropTypes.oneOf(['dashboard', 'project']),
rootFile: PropTypes.shape({ rootFile: PropTypes.shape({
id: PropTypes.string.isRequired id: PropTypes.string.isRequired
}).isRequired }).isRequired,
params: PropTypes.shape({
username: PropTypes.string
})
}; };
Nav.defaultProps = { Nav.defaultProps = {
@ -752,7 +755,10 @@ Nav.defaultProps = {
}, },
cmController: {}, cmController: {},
layout: 'project', layout: 'project',
warnIfUnsavedChanges: undefined warnIfUnsavedChanges: undefined,
params: {
username: undefined
}
}; };
function mapStateToProps(state) { function mapStateToProps(state) {

View file

@ -312,7 +312,7 @@ SketchListRowBase.propTypes = {
cloneProject: PropTypes.func.isRequired, cloneProject: PropTypes.func.isRequired,
exportProjectAsZip: PropTypes.func.isRequired, exportProjectAsZip: PropTypes.func.isRequired,
changeProjectName: PropTypes.func.isRequired, changeProjectName: PropTypes.func.isRequired,
onAddToCollection: PropTypes.func.isRequired, onAddToCollection: PropTypes.func.isRequired
}; };
function mapDispatchToPropsSketchListRow(dispatch) { function mapDispatchToPropsSketchListRow(dispatch) {

View file

@ -327,44 +327,46 @@ class Collection extends React.Component {
</Helmet> </Helmet>
{this._renderLoader()} {this._renderLoader()}
{this.hasCollection() && this._renderCollectionMetadata()} {this.hasCollection() && this._renderCollectionMetadata()}
<div className="collection-table-wrapper"> <div className="collection-content">
{this._renderEmptyTable()} <div className="collection-table-wrapper">
{this.hasCollectionItems() && {this._renderEmptyTable()}
<table className="sketches-table" summary="table containing all collections"> {this.hasCollectionItems() &&
<thead> <table className="sketches-table" summary="table containing all collections">
<tr> <thead>
{this._renderFieldHeader('name', 'Name')} <tr>
{this._renderFieldHeader('createdAt', 'Date Added')} {this._renderFieldHeader('name', 'Name')}
{this._renderFieldHeader('user', 'Owner')} {this._renderFieldHeader('createdAt', 'Date Added')}
<th scope="col"></th> {this._renderFieldHeader('user', 'Owner')}
</tr> <th scope="col"></th>
</thead> </tr>
<tbody> </thead>
{this.props.collection.items.map(item => <tbody>
(<CollectionItemRow {this.props.collection.items.map(item =>
key={item.id} (<CollectionItemRow
item={item} key={item.id}
user={this.props.user} item={item}
username={this.getUsername()} user={this.props.user}
collection={this.props.collection} username={this.getUsername()}
/>))} collection={this.props.collection}
</tbody> />))}
</table> </tbody>
} </table>
{ }
this.state.isAddingSketches && ( {
<Overlay this.state.isAddingSketches && (
title="Add sketch" <Overlay
actions={<SketchSearchbar />} title="Add sketch"
closeOverlay={this.hideAddSketches} actions={<SketchSearchbar />}
isFixedHeight closeOverlay={this.hideAddSketches}
> isFixedHeight
<div className="collection-add-sketch"> >
<AddToCollectionSketchList username={this.props.username} collection={this.props.collection} /> <div className="collection-add-sketch">
</div> <AddToCollectionSketchList username={this.props.username} collection={this.props.collection} />
</Overlay> </div>
) </Overlay>
} )
}
</div>
</div> </div>
</section> </section>
); );

View file

@ -1,8 +1,10 @@
.collection-container { .collection-container {
padding: #{24 / $base-font-size}rem #{66 / $base-font-size}rem; padding: #{24 / $base-font-size}rem #{66 / $base-font-size}rem;
position: relative;
flex: 1; flex: 1;
overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction:column;
} }
.collection-metadata { .collection-metadata {
@ -114,15 +116,28 @@
flex-grow: 0; flex-grow: 0;
} }
.collection-table-wrapper { .collection-content {
width: #{1012 / $base-font-size}rem; display: flex;
margin: 0 auto; flex-direction: column;
flex: 1; flex: 1;
overflow: hidden;
max-width: #{1012 / $base-font-size}rem;
margin: 0 auto;
width: 100%;
@include themify() { @include themify() {
border: 1px solid getThemifyVariable('modal-border-color'); border: 1px solid getThemifyVariable('modal-border-color');
} }
} }
.collection-table-wrapper {
overflow-y: auto;
max-width: 100%;
min-height: 100%;
}
// maybe don't need this?
[data-has-items=false] .collection-table-wrapper { [data-has-items=false] .collection-table-wrapper {
display: flex; display: flex;
justify-content: center; justify-content: center;