Skip to content

Feature/mobile examples #1528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 68 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
de0e32f
:rotating_light: ignore proptype errors
ghalestrilo Jul 24, 2020
691df12
:construction: create bottom tabs
ghalestrilo Jul 24, 2020
96b0ed4
:twisted_rightwards_arrows: merge from feature/mobile-header-dropdown…
ghalestrilo Jul 28, 2020
57ee6f0
:construction: mount List components
ghalestrilo Jul 28, 2020
f969136
Merge branch 'feature/mobile-header-dropdown-menu' of https://github.…
ghalestrilo Jul 28, 2020
f1108c8
Merge branch 'develop' of https://github.com/processing/p5.js-web-edi…
ghalestrilo Jul 28, 2020
7e9aa18
:ok_hand: fix dropdown link to original view
ghalestrilo Jul 28, 2020
262199d
:sparkles: load examples on MobileDashboard
ghalestrilo Jul 28, 2020
b2c4a6c
:sparkles: mount searchbar on examples/dashboard view
ghalestrilo Jul 28, 2020
056455c
:broom: restore devtools sidebar, enable mobile on .env.example
ghalestrilo Jul 28, 2020
c019fbc
:twisted_rightwards_arrows: merge from feature/mobile-header-dropdown…
ghalestrilo Jul 29, 2020
6efc22c
:construction: pull from mine/mobile-examples
ghalestrilo Jul 30, 2020
6e668cd
:construction: improve routing for mobile examples screen
ghalestrilo Jul 30, 2020
bf67451
:construction: improve header navigation
ghalestrilo Jul 30, 2020
42b0025
:construction: add link to MyStuff when user is logged in
ghalestrilo Jul 30, 2020
e287e55
:construction: rename MobileDashboard to MobileDashboardView
ghalestrilo Jul 30, 2020
40db915
:bug: fix panels not changing
ghalestrilo Jul 31, 2020
4aad59a
:sparkles: update search bars
ghalestrilo Jul 31, 2020
6aeeed7
:sparkles: add new button on dashboard view
ghalestrilo Jul 31, 2020
d42f10e
:twisted_rightwards_arrows: merge from feature/mobile-header-dropdown…
ghalestrilo Jul 31, 2020
862fe1a
:ok_hand: update server.routes.js
ghalestrilo Jul 31, 2020
229c512
:bug: fix navigation problem on IDEView.jsx
ghalestrilo Aug 3, 2020
fe9f35a
:lipstick: update sketch list header alignment and font size
ghalestrilo Aug 3, 2020
b498baa
:lipstick: adjust table width to fit 320px
ghalestrilo Aug 3, 2020
6e323fd
Merge branch 'develop' of https://github.com/processing/p5.js-web-edi…
ghalestrilo Aug 4, 2020
e9ad261
:lipstick: omit creation date on sketch and collection list
ghalestrilo Aug 4, 2020
aa0ab1a
:lipstick: make bottom tab switcher thinner
ghalestrilo Aug 4, 2020
f5f0248
:lipstick: format dates for mobile, limit <td /> width
ghalestrilo Aug 4, 2020
d3a620e
:lipstick: limit width of right-aligned cells
ghalestrilo Aug 4, 2020
a3a1834
:lipstick: make sketch name bold on sketch list
ghalestrilo Aug 4, 2020
d452ebc
:lipstick: update styling so that it affects assets panel
ghalestrilo Aug 4, 2020
9771f8f
:construction: make sketchlist route to /mobile if on mobile views
ghalestrilo Aug 5, 2020
dd431a0
:construction: update mobile nav dropdown option list structure
ghalestrilo Aug 5, 2020
f2e8d40
:construction: write hooks for mounting MobileIDEView component
ghalestrilo Aug 5, 2020
8fcf653
:bug: restore sidebar
ghalestrilo Aug 5, 2020
02f51af
:sparkles: load sketches via URL
ghalestrilo Aug 6, 2020
2ed4664
Merge branch 'develop' into feature/mobile-examples
ghalestrilo Aug 6, 2020
3c28682
Merge branch 'develop' into feature/mobile-examples
catarak Aug 6, 2020
8ddd7a7
Merge branch 'develop' of https://github.com/processing/p5.js-web-edi…
ghalestrilo Aug 7, 2020
7558cf5
:sparkles: make dropdown for sketch and collection creation
ghalestrilo Aug 7, 2020
38b59d2
Merge branch 'feature/mobile-examples' of https://github.com/ghalestr…
ghalestrilo Aug 7, 2020
88c48c3
:sparkles: update bottom tab styles
ghalestrilo Aug 10, 2020
0baf64c
:recycle: make Tab and TabSwitcher mobile components
ghalestrilo Aug 10, 2020
f93c077
:bug: fix mobile dashboard loading wrong user's sketches
ghalestrilo Aug 10, 2020
672fd40
:lipstick: transform table into card list
ghalestrilo Aug 10, 2020
702adf9
:lipstick: improve visibility on dark mode
ghalestrilo Aug 10, 2020
8d0cfdc
:lipstick: improve visibility on light mode
ghalestrilo Aug 10, 2020
8886352
Merge develop to feature/mobile-examples
catarak Aug 11, 2020
4a1eb0e
:ok_hand: create space between dropdown icon and sortable th
ghalestrilo Aug 11, 2020
9c25daa
:ok_hand: update card fields alignment
ghalestrilo Aug 11, 2020
35716b1
:ok_hand: update header alignment
ghalestrilo Aug 11, 2020
222b6d8
:ok_hand: remove gap between header and search bar
ghalestrilo Aug 11, 2020
5a96c0f
:ok_hand: centralize loader
ghalestrilo Aug 11, 2020
a9061af
:ok_hand: restore sidebar
ghalestrilo Aug 11, 2020
19bff74
:ok_hand: distribute table header evenly
ghalestrilo Aug 11, 2020
a28a4a5
:ok_hand: restore sidebar
ghalestrilo Aug 11, 2020
ceb8dc5
:twisted_rightwards_arrows: merge from develop
ghalestrilo Aug 12, 2020
4b12f2f
Add minor styling fixes for MobileDashboardView
catarak Aug 12, 2020
9f3e083
:construction: move drop arrow to top of card, unhide CollectionList …
ghalestrilo Aug 12, 2020
69acd3a
:construction: add gap to dashboard cards
ghalestrilo Aug 12, 2020
03f2832
:ok_hand: hide header on assets list
ghalestrilo Aug 13, 2020
fe81240
:twisted_rightwards_arrows: merge from develop
ghalestrilo Aug 13, 2020
2e34bd7
:lipstick: omit 'Date' from header fields on mobile
ghalestrilo Aug 13, 2020
e181a74
:lipstick: omit 'Date' from header fields on mobile
ghalestrilo Aug 13, 2020
cbae85f
:lipstick: reduce '# sketches' to 'Sketches' on collections list
ghalestrilo Aug 13, 2020
2aa49d5
:twisted_rightwards_arrows: merge from develop
ghalestrilo Aug 17, 2020
dd79bf7
Merge branch 'feature/mobile-examples' of https://github.com/ghalestr…
ghalestrilo Aug 17, 2020
6638035
Merge branch 'develop' into feature/mobile-examples
ghalestrilo Aug 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ S3_BUCKET_URL_BASE=<alt-for-s3-url>
SESSION_SECRET=whatever_you_want_this_to_be_it_only_matters_for_production
UI_ACCESS_TOKEN_ENABLED=false
UPLOAD_LIMIT=250000000
MOBILE_ENABLED=true
31 changes: 22 additions & 9 deletions client/components/mobile/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@ import styled from 'styled-components';
import PropTypes from 'prop-types';
import { prop, remSize } from '../../theme';

const background = transparent => prop(transparent ? 'backgroundColor' : 'MobilePanel.default.background');
const textColor = prop('primaryTextColor');

const background = ({ transparent, inverted }) => prop(transparent === true
? 'backgroundColor'
: `MobilePanel.default.${inverted === true ? 'foreground' : 'background'}`);

const textColor = ({ transparent, inverted }) => prop((transparent === false && inverted === true)
? 'MobilePanel.default.background'
: 'primaryTextColor');


const HeaderDiv = styled.div`
position: fixed;
width: 100%;
background: ${props => background(props.transparent === true)};
background: ${props => background(props)};
color: ${textColor};
padding: ${remSize(12)};
padding: ${props => remSize(props.slim === true ? 2 : 12)};
padding-left: ${remSize(16)};
padding-right: ${remSize(16)};
z-index: 1;
Expand All @@ -25,8 +31,10 @@ const HeaderDiv = styled.div`

svg {
max-height: ${remSize(32)};
padding: ${remSize(4)}
padding: ${remSize(4)};
}

& svg path { fill: ${textColor} !important; }
`;

const IconContainer = styled.div`
Expand All @@ -48,9 +56,10 @@ const TitleContainer = styled.div`
`;

const Header = ({
title, subtitle, leftButton, children, transparent
title, subtitle, leftButton, children,
transparent, inverted, slim
}) => (
<HeaderDiv transparent={transparent}>
<HeaderDiv transparent={transparent} slim={slim} inverted={inverted}>
{leftButton}
<TitleContainer padded={subtitle === null}>
{title && <h2>{title}</h2>}
Expand All @@ -67,15 +76,19 @@ Header.propTypes = {
subtitle: PropTypes.string,
leftButton: PropTypes.element,
children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]),
transparent: PropTypes.bool
transparent: PropTypes.bool,
inverted: PropTypes.bool,
slim: PropTypes.bool,
};

Header.defaultProps = {
title: null,
subtitle: null,
leftButton: null,
children: [],
transparent: false
transparent: false,
inverted: false,
slim: false
};

export default Header;
18 changes: 18 additions & 0 deletions client/components/mobile/Tab.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import styled from 'styled-components';
import { Link } from 'react-router';
import { prop, remSize } from '../../theme';

export default styled(Link)`
box-sizing: border-box;


background: transparent;
/* border-top: ${remSize(4)} solid ${props => prop(props.selected ? 'colors.p5jsPink' : 'MobilePanel.default.background')}; */
border-top: ${remSize(4)} solid ${props => (props.selected ? prop('TabHighlight') : 'transparent')};

color: ${prop('primaryTextColor')};

padding: ${remSize(8)} ${remSize(16)};
width: 30%;
`;
15 changes: 15 additions & 0 deletions client/components/mobile/TabSwitcher.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import styled from 'styled-components';

import { prop, remSize } from '../../theme';

export default styled.div`
display: flex;
justify-content: space-between;

h3 { text-align: center; width: 100%; }
border-top: 1px solid ${prop('Separator')};

background: ${props => prop('backgroundColor')};
`;

1 change: 1 addition & 0 deletions client/modules/IDE/actions/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function getCollections(username) {
} else {
url = '/collections';
}
console.log(url);
apiClient.get(url)
.then((response) => {
dispatch({
Expand Down
15 changes: 10 additions & 5 deletions client/modules/IDE/components/CollectionList/CollectionList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import CollectionListRow from './CollectionListRow';
import ArrowUpIcon from '../../../../images/sort-arrow-up.svg';
import ArrowDownIcon from '../../../../images/sort-arrow-down.svg';


class CollectionList extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -127,6 +128,7 @@ class CollectionList extends React.Component {

render() {
const username = this.props.username !== undefined ? this.props.username : this.props.user.username;
const { mobile } = this.props;

return (
<article className="sketches-table-container">
Expand All @@ -141,15 +143,16 @@ class CollectionList extends React.Component {
<thead>
<tr>
{this._renderFieldHeader('name', 'Name')}
{this._renderFieldHeader('createdAt', 'Date Created')}
{this._renderFieldHeader('updatedAt', 'Date Updated')}
{this._renderFieldHeader('numItems', '# sketches')}
{this._renderFieldHeader('createdAt', `${mobile ? '' : 'Date '}Created`)}
{this._renderFieldHeader('updatedAt', `${mobile ? '' : 'Date '}Updated`)}
{this._renderFieldHeader('numItems', mobile ? 'Sketches' : '# sketches')}
<th scope="col"></th>
</tr>
</thead>
<tbody>
{this.props.collections.map(collection =>
(<CollectionListRow
mobile={mobile}
key={collection.id}
collection={collection}
user={this.props.user}
Expand Down Expand Up @@ -209,7 +212,8 @@ CollectionList.propTypes = {
owner: PropTypes.shape({
id: PropTypes.string
})
})
}),
mobile: PropTypes.bool,
};

CollectionList.defaultProps = {
Expand All @@ -218,7 +222,8 @@ CollectionList.defaultProps = {
id: undefined,
owner: undefined
},
username: undefined
username: undefined,
mobile: false
};

function mapStateToProps(state, ownProps) {
Expand Down
15 changes: 11 additions & 4 deletions client/modules/IDE/components/CollectionList/CollectionListRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import * as ToastActions from '../../actions/toast';

import DownFilledTriangleIcon from '../../../../images/down-filled-triangle.svg';

const formatDateCell = (date, mobile = false) => format(new Date(date), 'MMM D, YYYY');

class CollectionListRowBase extends React.Component {
static projectInCollection(project, collection) {
return collection.items.find(item => item.project.id === project.id) != null;
Expand Down Expand Up @@ -199,7 +201,7 @@ class CollectionListRowBase extends React.Component {
}

render() {
const { collection } = this.props;
const { collection, mobile } = this.props;

return (
<tr
Expand All @@ -211,9 +213,9 @@ class CollectionListRowBase extends React.Component {
{this.renderCollectionName()}
</span>
</th>
<td>{format(new Date(collection.createdAt), 'MMM D, YYYY')}</td>
<td>{format(new Date(collection.updatedAt), 'MMM D, YYYY')}</td>
<td>{(collection.items || []).length}</td>
<td>{mobile && 'Created: '}{format(new Date(collection.createdAt), 'MMM D, YYYY')}</td>
<td>{mobile && 'Updated: '}{formatDateCell(collection.updatedAt)}</td>
<td>{mobile && '# sketches: '}{(collection.items || []).length}</td>
<td className="sketch-list__dropdown-column">
{this.renderActions()}
</td>
Expand Down Expand Up @@ -245,6 +247,11 @@ CollectionListRowBase.propTypes = {
deleteCollection: PropTypes.func.isRequired,
editCollection: PropTypes.func.isRequired,
onAddSketches: PropTypes.func.isRequired,
mobile: PropTypes.bool,
};

CollectionListRowBase.defaultProps = {
mobile: false,
};

function mapDispatchToPropsSketchListRow(dispatch) {
Expand Down
21 changes: 16 additions & 5 deletions client/modules/IDE/components/EditableInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ import EditIcon from '../../../images/pencil.svg';

// TODO I think this needs a description prop so that it's accessible
function EditableInput({
validate, value, emptyPlaceholder, InputComponent, inputProps, onChange
validate,
value,
emptyPlaceholder,
InputComponent,
inputProps,
onChange,
}) {
const [isEditing, setIsEditing] = React.useState(false);
const [currentValue, setCurrentValue] = React.useState(value || '');
const displayValue = currentValue || emptyPlaceholder;
const hasValue = currentValue !== '';
const classes = `editable-input editable-input--${isEditing ? 'is-editing' : 'is-not-editing'} editable-input--${hasValue ? 'has-value' : 'has-placeholder'}`;
const classes = `editable-input editable-input--${
isEditing ? 'is-editing' : 'is-not-editing'
} editable-input--${hasValue ? 'has-value' : 'has-placeholder'}`;
const inputRef = React.createRef();

React.useEffect(() => {
Expand Down Expand Up @@ -54,7 +61,11 @@ function EditableInput({
aria-label={`Edit ${displayValue} value`}
>
<span>{displayValue}</span>
<EditIcon className="editable-input__icon" focusable="false" aria-hidden="true" />
<EditIcon
className="editable-input__icon"
focusable="false"
aria-hidden="true"
/>
</button>

<InputComponent
Expand All @@ -68,7 +79,7 @@ function EditableInput({
ref={inputRef}
value={currentValue}
/>
</span >
</span>
);
}

Expand All @@ -84,7 +95,7 @@ EditableInput.propTypes = {
emptyPlaceholder: PropTypes.string,
InputComponent: PropTypes.elementType,
// eslint-disable-next-line react/forbid-prop-types
inputProps: PropTypes.object,
inputProps: PropTypes.object, // eslint-disable-line
onChange: PropTypes.func.isRequired,
validate: PropTypes.func,
value: PropTypes.string,
Expand Down
17 changes: 13 additions & 4 deletions client/modules/IDE/components/NewFileForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class NewFileForm extends React.Component {
}

render() {
const { fields: { name }, handleSubmit } = this.props;
const {
fields: { name },
handleSubmit,
} = this.props;
return (
<form
className="new-file-form"
Expand All @@ -26,22 +29,28 @@ class NewFileForm extends React.Component {
}}
>
<div className="new-file-form__input-wrapper">
<label className="new-file-form__name-label" htmlFor="name">Name:</label>
<label className="new-file-form__name-label" htmlFor="name">
Name:
</label>
<input
className="new-file-form__name-input"
id="name"
type="text"
placeholder={this.props.t('NewFileForm.Placeholder')}
maxLength="128"
{...domOnlyProps(name)}
ref={(element) => { this.fileName = element; }}
ref={(element) => {
this.fileName = element;
}}
/>
<Button
type="submit"
>{this.props.t('NewFileForm.AddFileSubmit')}
</Button>
</div>
{name.touched && name.error && <span className="form-error">{name.error}</span>}
{name.touched && name.error && (
<span className="form-error">{name.error}</span>
)}
</form>
);
}
Expand Down
13 changes: 9 additions & 4 deletions client/modules/IDE/components/NewFolderForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class NewFolderForm extends React.Component {

render() {
const {
fields: { name }, handleSubmit
fields: { name },
handleSubmit,
} = this.props;
return (
<form
Expand All @@ -28,7 +29,9 @@ class NewFolderForm extends React.Component {
}}
>
<div className="new-folder-form__input-wrapper">
<label className="new-folder-form__name-label" htmlFor="name">Name:</label>
<label className="new-folder-form__name-label" htmlFor="name">
Name:
</label>
<input
className="new-folder-form__name-input"
id="name"
Expand All @@ -43,7 +46,9 @@ class NewFolderForm extends React.Component {
>{this.props.t('NewFolderForm.AddFolderSubmit')}
</Button>
</div>
{name.touched && name.error && <span className="form-error">{name.error}</span>}
{name.touched && name.error && (
<span className="form-error">{name.error}</span>
)}
</form>
);
}
Expand All @@ -62,6 +67,6 @@ NewFolderForm.propTypes = {
};
NewFolderForm.defaultProps = {
submitting: false,
pristine: true
pristine: true,
};
export default withTranslation()(NewFolderForm);
Loading