🚧 update nav mobile routes when logged in
This commit is contained in:
commit
27168f09c8
12 changed files with 80 additions and 43 deletions
|
@ -36,9 +36,7 @@ const DropdownWrapper = styled.ul`
|
||||||
background-color: ${prop('Button.hover.background')};
|
background-color: ${prop('Button.hover.background')};
|
||||||
color: ${prop('Button.hover.foreground')};
|
color: ${prop('Button.hover.foreground')};
|
||||||
|
|
||||||
& button, & a {
|
* { color: ${prop('Button.hover.foreground')}; }
|
||||||
color: ${prop('Button.hover.foreground')};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
|
@ -48,12 +46,21 @@ const DropdownWrapper = styled.ul`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
& button,
|
& button,
|
||||||
|
& button span,
|
||||||
& a {
|
& a {
|
||||||
color: ${prop('primaryTextColor')};
|
|
||||||
width: 100%;
|
|
||||||
text-align: left;
|
|
||||||
padding: ${remSize(8)} ${remSize(16)};
|
padding: ${remSize(8)} ${remSize(16)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
text-align: left;
|
||||||
|
justify-content: left;
|
||||||
|
|
||||||
|
color: ${prop('primaryTextColor')};
|
||||||
|
width: 100%;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
& button span { padding: 0px }
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -63,18 +70,22 @@ const DropdownWrapper = styled.ul`
|
||||||
const Dropdown = ({ items, align }) => (
|
const Dropdown = ({ items, align }) => (
|
||||||
<DropdownWrapper align={align} >
|
<DropdownWrapper align={align} >
|
||||||
{/* className="nav__items-left" */}
|
{/* className="nav__items-left" */}
|
||||||
{items && items.map(({ title, icon, href }) => (
|
{items && items.map(({
|
||||||
|
title, icon, href, action
|
||||||
|
}) => (
|
||||||
<li key={`nav-${title && title.toLowerCase()}`}>
|
<li key={`nav-${title && title.toLowerCase()}`}>
|
||||||
<Link to={href}>
|
{/* {MaybeIcon(icon, `Navigate to ${title}`)} */}
|
||||||
{/* {MaybeIcon(icon, `Navigate to ${title}`)} */}
|
{href
|
||||||
{title}
|
? <IconButton to={href}>{title}</IconButton>
|
||||||
</Link>
|
: <IconButton onClick={() => action()}>{title}</IconButton>}
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</DropdownWrapper>
|
</DropdownWrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
Dropdown.propTypes = {
|
Dropdown.propTypes = {
|
||||||
align: PropTypes.oneOf(['left', 'right']),
|
align: PropTypes.oneOf(['left', 'right']),
|
||||||
items: PropTypes.arrayOf(PropTypes.shape({
|
items: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
|
|
@ -17,7 +17,7 @@ const IconButton = (props) => {
|
||||||
const Icon = icon;
|
const Icon = icon;
|
||||||
|
|
||||||
return (<ButtonWrapper
|
return (<ButtonWrapper
|
||||||
iconBefore={<Icon />}
|
iconBefore={icon && <Icon />}
|
||||||
kind={Button.kinds.inline}
|
kind={Button.kinds.inline}
|
||||||
focusable="false"
|
focusable="false"
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
|
@ -25,7 +25,11 @@ const IconButton = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
IconButton.propTypes = {
|
IconButton.propTypes = {
|
||||||
icon: PropTypes.func.isRequired
|
icon: PropTypes.func
|
||||||
|
};
|
||||||
|
|
||||||
|
IconButton.defaultProps = {
|
||||||
|
icon: null
|
||||||
};
|
};
|
||||||
|
|
||||||
export default IconButton;
|
export default IconButton;
|
||||||
|
|
|
@ -14,3 +14,9 @@ export function clearLintMessage() {
|
||||||
type: ActionTypes.CLEAR_LINT_MESSAGE
|
type: ActionTypes.CLEAR_LINT_MESSAGE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function toggleForceDesktop() {
|
||||||
|
return {
|
||||||
|
type: ActionTypes.TOGGLE_FORCE_DESKTOP
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import Loader from '../../App/components/loader';
|
||||||
import QuickAddList from './QuickAddList';
|
import QuickAddList from './QuickAddList';
|
||||||
|
|
||||||
const projectInCollection = (project, collection) =>
|
const projectInCollection = (project, collection) =>
|
||||||
collection.items.find(item => item.project.id === project.id) != null;
|
collection.items.find(item => item.projectId === project.id) != null;
|
||||||
|
|
||||||
class CollectionList extends React.Component {
|
class CollectionList extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -81,12 +81,14 @@ class CollectionList extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="quick-add-wrapper">
|
<div className="collection-add-sketch">
|
||||||
<Helmet>
|
<div className="quick-add-wrapper">
|
||||||
<title>{this.getTitle()}</title>
|
<Helmet>
|
||||||
</Helmet>
|
<title>{this.getTitle()}</title>
|
||||||
|
</Helmet>
|
||||||
|
|
||||||
{content}
|
{content}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,13 @@ class SketchList extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="quick-add-wrapper">
|
<div className="collection-add-sketch">
|
||||||
<Helmet>
|
<div className="quick-add-wrapper">
|
||||||
<title>{this.getSketchesTitle()}</title>
|
<Helmet>
|
||||||
</Helmet>
|
<title>{this.getSketchesTitle()}</title>
|
||||||
{content}
|
</Helmet>
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,12 +170,10 @@ class CollectionList extends React.Component {
|
||||||
closeOverlay={this.hideAddSketches}
|
closeOverlay={this.hideAddSketches}
|
||||||
isFixedHeight
|
isFixedHeight
|
||||||
>
|
>
|
||||||
<div className="collection-add-sketch">
|
<AddToCollectionSketchList
|
||||||
<AddToCollectionSketchList
|
username={this.props.username}
|
||||||
username={this.props.username}
|
collection={find(this.props.collections, { id: this.state.addingSketchesToCollectionId })}
|
||||||
collection={find(this.props.collections, { id: this.state.addingSketchesToCollectionId })}
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Overlay>
|
</Overlay>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import { getHTMLFile } from '../reducers/files';
|
||||||
|
|
||||||
// Local Imports
|
// Local Imports
|
||||||
import Editor from '../components/Editor';
|
import Editor from '../components/Editor';
|
||||||
import { PlayIcon, MoreIcon, CircleFolderIcon } from '../../../common/icons';
|
import { PlayIcon, MoreIcon } from '../../../common/icons';
|
||||||
|
|
||||||
import IconButton from '../../../components/mobile/IconButton';
|
import IconButton from '../../../components/mobile/IconButton';
|
||||||
import Header from '../../../components/mobile/Header';
|
import Header from '../../../components/mobile/Header';
|
||||||
|
@ -63,18 +63,20 @@ const NavItem = styled.li`
|
||||||
position: relative;
|
position: relative;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const getNavOptions = (username = undefined, toggleForceDesktop = () => {}) =>
|
const getNavOptions = (username = undefined, logoutUser = () => {}, toggleForceDesktop = () => {}) =>
|
||||||
(username
|
(username
|
||||||
? [
|
? [
|
||||||
{ icon: PreferencesIcon, title: 'Preferences', href: '/preferences', },
|
{ icon: PreferencesIcon, title: 'Preferences', href: '/preferences', },
|
||||||
{ icon: PreferencesIcon, title: 'My Stuff', href: `/${username}/sketches` },
|
{ icon: PreferencesIcon, title: 'My Stuff', href: `/${username}/sketches` },
|
||||||
{ icon: PreferencesIcon, title: 'Examples', href: '/p5/sketches' },
|
{ icon: PreferencesIcon, title: 'Examples', href: '/p5/sketches' },
|
||||||
{ icon: PreferencesIcon, title: 'Original Editor', action: toggleForceDesktop, },
|
{ icon: PreferencesIcon, title: 'Original Editor', action: toggleForceDesktop, },
|
||||||
|
{ icon: PreferencesIcon, title: 'Logout', action: logoutUser, },
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
{ icon: PreferencesIcon, title: 'Preferences', href: '/preferences', },
|
{ icon: PreferencesIcon, title: 'Preferences', href: '/preferences', },
|
||||||
{ icon: PreferencesIcon, title: 'Examples', href: '/p5/sketches' },
|
{ icon: PreferencesIcon, title: 'Examples', href: '/p5/sketches' },
|
||||||
{ icon: PreferencesIcon, title: 'Original Editor', href: '/', },
|
{ icon: PreferencesIcon, title: 'Original Editor', action: toggleForceDesktop, },
|
||||||
|
{ icon: PreferencesIcon, title: 'Login', href: '/login', },
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -82,7 +84,7 @@ const MobileIDEView = (props) => {
|
||||||
const {
|
const {
|
||||||
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
|
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
|
||||||
selectedFile, updateFileContent, files, user, params,
|
selectedFile, updateFileContent, files, user, params,
|
||||||
closeEditorOptions, showEditorOptions,
|
closeEditorOptions, showEditorOptions, logoutUser,
|
||||||
startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console,
|
startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console,
|
||||||
showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch, getProject, clearPersistedState, setUnsavedChanges,
|
showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch, getProject, clearPersistedState, setUnsavedChanges,
|
||||||
toggleForceDesktop
|
toggleForceDesktop
|
||||||
|
@ -111,7 +113,7 @@ const MobileIDEView = (props) => {
|
||||||
|
|
||||||
// Screen Modals
|
// Screen Modals
|
||||||
const [toggleNavDropdown, NavDropDown] = useAsModal(<Dropdown
|
const [toggleNavDropdown, NavDropDown] = useAsModal(<Dropdown
|
||||||
items={getNavOptions(username, toggleForceDesktop)}
|
items={getNavOptions(username, logoutUser, toggleForceDesktop)}
|
||||||
align="right"
|
align="right"
|
||||||
/>);
|
/>);
|
||||||
|
|
||||||
|
@ -296,6 +298,8 @@ MobileIDEView.propTypes = {
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
|
||||||
|
logoutUser: PropTypes.func.isRequired,
|
||||||
|
|
||||||
setUnsavedChanges: PropTypes.func.isRequired,
|
setUnsavedChanges: PropTypes.func.isRequired,
|
||||||
getProject: PropTypes.func.isRequired,
|
getProject: PropTypes.func.isRequired,
|
||||||
clearPersistedState: PropTypes.func.isRequired,
|
clearPersistedState: PropTypes.func.isRequired,
|
||||||
|
|
|
@ -7,6 +7,7 @@ const initialState = {
|
||||||
let messageId = 0;
|
let messageId = 0;
|
||||||
|
|
||||||
const editorAccessibility = (state = initialState, action) => {
|
const editorAccessibility = (state = initialState, action) => {
|
||||||
|
console.log('accessbility');
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ActionTypes.UPDATE_LINT_MESSAGE:
|
case ActionTypes.UPDATE_LINT_MESSAGE:
|
||||||
messageId += 1;
|
messageId += 1;
|
||||||
|
@ -18,7 +19,7 @@ const editorAccessibility = (state = initialState, action) => {
|
||||||
case ActionTypes.CLEAR_LINT_MESSAGE:
|
case ActionTypes.CLEAR_LINT_MESSAGE:
|
||||||
return Object.assign({}, state, { lintMessages: [] });
|
return Object.assign({}, state, { lintMessages: [] });
|
||||||
case ActionTypes.TOGGLE_FORCE_DESKTOP:
|
case ActionTypes.TOGGLE_FORCE_DESKTOP:
|
||||||
return { ...state, forceDesktop: !state.forceDesktop };
|
return Object.assign({}, state, { forceDesktop: !(state.forceDesktop) });
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,9 +398,10 @@ class Collection extends React.Component {
|
||||||
closeOverlay={this.hideAddSketches}
|
closeOverlay={this.hideAddSketches}
|
||||||
isFixedHeight
|
isFixedHeight
|
||||||
>
|
>
|
||||||
<div className="collection-add-sketch">
|
<AddToCollectionSketchList
|
||||||
<AddToCollectionSketchList username={this.props.username} collection={this.props.collection} />
|
username={this.props.username}
|
||||||
</div>
|
collection={this.props.collection}
|
||||||
|
/>
|
||||||
</Overlay>
|
</Overlay>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ const onRouteChange = (store) => {
|
||||||
|
|
||||||
const routes = store => (
|
const routes = store => (
|
||||||
<Route path="/" component={App} onChange={() => { onRouteChange(store); }}>
|
<Route path="/" component={App} onChange={() => { onRouteChange(store); }}>
|
||||||
<IndexRoute onEnter={checkAuth(store)} component={mobileFirst(MobileIDEView, IDEView)} />
|
<IndexRoute onEnter={checkAuth(store)} component={mobileFirst(MobileIDEView, IDEView, store)} />
|
||||||
|
|
||||||
<Route path="/login" component={userIsNotAuthenticated(LoginView)} />
|
<Route path="/login" component={userIsNotAuthenticated(LoginView)} />
|
||||||
<Route path="/signup" component={userIsNotAuthenticated(SignupView)} />
|
<Route path="/signup" component={userIsNotAuthenticated(SignupView)} />
|
||||||
|
|
|
@ -88,6 +88,7 @@ $themes: (
|
||||||
nav-border-color: $middle-light,
|
nav-border-color: $middle-light,
|
||||||
error-color: $p5js-pink,
|
error-color: $p5js-pink,
|
||||||
table-row-stripe-color: $medium-light,
|
table-row-stripe-color: $medium-light,
|
||||||
|
table-row-stripe-color-alternate: $medium-light,
|
||||||
codefold-icon-open: url(../images/triangle-arrow-down.svg?byUrl),
|
codefold-icon-open: url(../images/triangle-arrow-down.svg?byUrl),
|
||||||
codefold-icon-closed: url(../images/triangle-arrow-right.svg?byUrl),
|
codefold-icon-closed: url(../images/triangle-arrow-right.svg?byUrl),
|
||||||
|
|
||||||
|
@ -163,6 +164,7 @@ $themes: (
|
||||||
nav-border-color: $middle-dark,
|
nav-border-color: $middle-dark,
|
||||||
error-color: $p5js-pink,
|
error-color: $p5js-pink,
|
||||||
table-row-stripe-color: $dark,
|
table-row-stripe-color: $dark,
|
||||||
|
table-row-stripe-color-alternate: $darker,
|
||||||
codefold-icon-open: url(../images/triangle-arrow-down-white.svg?byUrl),
|
codefold-icon-open: url(../images/triangle-arrow-down-white.svg?byUrl),
|
||||||
codefold-icon-closed: url(../images/triangle-arrow-right-white.svg?byUrl),
|
codefold-icon-closed: url(../images/triangle-arrow-right-white.svg?byUrl),
|
||||||
|
|
||||||
|
@ -236,6 +238,7 @@ $themes: (
|
||||||
nav-border-color: $middle-dark,
|
nav-border-color: $middle-dark,
|
||||||
error-color: $p5-contrast-pink,
|
error-color: $p5-contrast-pink,
|
||||||
table-row-stripe-color: $dark,
|
table-row-stripe-color: $dark,
|
||||||
|
table-row-stripe-color-alternate: $darker,
|
||||||
codefold-icon-open: url(../images/triangle-arrow-down-white.svg?byUrl),
|
codefold-icon-open: url(../images/triangle-arrow-down-white.svg?byUrl),
|
||||||
codefold-icon-closed: url(../images/triangle-arrow-right-white.svg?byUrl),
|
codefold-icon-closed: url(../images/triangle-arrow-right-white.svg?byUrl),
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
.quick-add-wrapper {
|
.quick-add-wrapper {
|
||||||
min-width: #{600 / $base-font-size}rem;
|
min-width: #{600 / $base-font-size}rem;
|
||||||
overflow-y: scroll;
|
padding: #{24 / $base-font-size}rem;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-add {
|
.quick-add {
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: #{24 / $base-font-size}rem;
|
overflow-y: scroll;
|
||||||
|
height: 100%;
|
||||||
|
@include themify() {
|
||||||
|
border: 1px solid getThemifyVariable('modal-border-color');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-add__item {
|
.quick-add__item {
|
||||||
|
@ -23,7 +28,7 @@
|
||||||
|
|
||||||
.quick-add__item:nth-child(odd) {
|
.quick-add__item:nth-child(odd) {
|
||||||
@include themify() {
|
@include themify() {
|
||||||
background: getThemifyVariable('table-row-stripe-color');
|
background: getThemifyVariable('table-row-stripe-color-alternate');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue