Commit ae202c7b authored by Paul Kaplan's avatar Paul Kaplan

Remove Debug component in studios

parent fa8aff58
import React from 'react';
import PropTypes from 'prop-types';
const Debug = ({label, data}) => (<div style={{padding: '2rem', border: '1px solid red', margin: '2rem'}}>
<small>{label}</small>
<code>
<pre style={{fontSize: '0.75rem'}}>
{JSON.stringify(data, null, ' ')}
</pre>
</code>
</div>);
Debug.propTypes = {
label: PropTypes.string,
data: PropTypes.any // eslint-disable-line react/forbid-prop-types
};
export default Debug;
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
"studio.followErrors.confirmEmail": "Please confirm your email address first", "studio.followErrors.confirmEmail": "Please confirm your email address first",
"studio.followErrors.generic": "Something went wrong following the studio", "studio.followErrors.generic": "Something went wrong following the studio",
"studio.sectionLoadError.projectsHeadline": "Something went wrong loading projects",
"studio.sectionLoadError.curatorsHeadline": "Something went wrong loading curators",
"studio.sectionLoadError.managersHeadline": "Something went wrong loading managers",
"studio.sectionLoadError.activityHeadline": "Something went wrong loading managers",
"studio.sectionLoadError.tryAgain": "Try again",
"studio.projectsHeader": "Projects", "studio.projectsHeader": "Projects",
"studio.addProjectsHeader": "Add Projects", "studio.addProjectsHeader": "Add Projects",
"studio.addProject": "Add", "studio.addProject": "Add",
......
...@@ -6,7 +6,6 @@ import {connect} from 'react-redux'; ...@@ -6,7 +6,6 @@ import {connect} from 'react-redux';
import {activity} from './lib/redux-modules'; import {activity} from './lib/redux-modules';
import {loadActivity} from './lib/studio-activity-actions'; import {loadActivity} from './lib/studio-activity-actions';
import Debug from './debug.jsx';
import classNames from 'classnames'; import classNames from 'classnames';
import SocialMessage from '../../components/social-message/social-message.jsx'; import SocialMessage from '../../components/social-message/social-message.jsx';
...@@ -181,10 +180,15 @@ const StudioActivity = ({items, loading, error, moreToLoad, onLoadMore}) => { ...@@ -181,10 +180,15 @@ const StudioActivity = ({items, loading, error, moreToLoad, onLoadMore}) => {
<h2><FormattedMessage id="studio.activityHeader" /></h2> <h2><FormattedMessage id="studio.activityHeader" /></h2>
</div> </div>
{loading && <div>Loading...</div>} {loading && <div>Loading...</div>}
{error && <Debug {error && <div className="studio-section-load-error studio-info-box studio-info-box-error">
label="Error" <h3><FormattedMessage id="studio.sectionLoadError.activityHeadline" /></h3>
data={error} <button
/>} className="button"
onClick={onLoadMore}
>
<FormattedMessage id="studio.sectionLoadError.tryAgain" />
</button>
</div>}
<ul <ul
className="studio-messages-list" className="studio-messages-list"
> >
......
...@@ -5,7 +5,6 @@ import {FormattedMessage} from 'react-intl'; ...@@ -5,7 +5,6 @@ import {FormattedMessage} from 'react-intl';
import classNames from 'classnames'; import classNames from 'classnames';
import {curators} from './lib/redux-modules'; import {curators} from './lib/redux-modules';
import Debug from './debug.jsx';
import {CuratorTile} from './studio-member-tile.jsx'; import {CuratorTile} from './studio-member-tile.jsx';
import CuratorInviter from './studio-curator-inviter.jsx'; import CuratorInviter from './studio-curator-inviter.jsx';
import {loadCurators} from './lib/studio-member-actions'; import {loadCurators} from './lib/studio-member-actions';
...@@ -28,10 +27,15 @@ const StudioCurators = ({ ...@@ -28,10 +27,15 @@ const StudioCurators = ({
<h2><FormattedMessage id="studio.curatorsHeader" /></h2> <h2><FormattedMessage id="studio.curatorsHeader" /></h2>
</div> </div>
{canInviteCurators && <CuratorInviter />} {canInviteCurators && <CuratorInviter />}
{error && <Debug {error && <div className="studio-section-load-error studio-info-box studio-info-box-error">
label="Error" <h3><FormattedMessage id="studio.sectionLoadError.curatorsHeadline" /></h3>
data={error} <button
/>} className="button"
onClick={onLoadMore}
>
<FormattedMessage id="studio.sectionLoadError.tryAgain" />
</button>
</div>}
<div className="studio-members-grid"> <div className="studio-members-grid">
{items.length === 0 && !loading ? ( {items.length === 0 && !loading ? (
<div className="studio-empty"> <div className="studio-empty">
......
...@@ -12,7 +12,6 @@ import { ...@@ -12,7 +12,6 @@ import {
selectStudioHasReachedManagerThreshold selectStudioHasReachedManagerThreshold
} from '../../redux/studio.js'; } from '../../redux/studio.js';
import {loadManagers} from './lib/studio-member-actions'; import {loadManagers} from './lib/studio-member-actions';
import Debug from './debug.jsx';
import {ManagerTile} from './studio-member-tile.jsx'; import {ManagerTile} from './studio-member-tile.jsx';
import StudioInfoBox from './studio-info-box.jsx'; import StudioInfoBox from './studio-info-box.jsx';
import AlertProvider from '../../components/alert/alert-provider.jsx'; import AlertProvider from '../../components/alert/alert-provider.jsx';
...@@ -85,10 +84,15 @@ const StudioManagers = ({ ...@@ -85,10 +84,15 @@ const StudioManagers = ({
</div> </div>
} }
</div> </div>
{error && <Debug {error && <div className="studio-section-load-error studio-info-box studio-info-box-error">
label="Error" <h3><FormattedMessage id="studio.sectionLoadError.managersHeadline" /></h3>
data={error} <button
/>} className="button"
onClick={onLoadMore}
>
<FormattedMessage id="studio.sectionLoadError.tryAgain" />
</button>
</div>}
<div className="studio-members-grid"> <div className="studio-members-grid">
{items.map(item => {items.map(item =>
(<ManagerTile (<ManagerTile
......
...@@ -7,7 +7,6 @@ import classNames from 'classnames'; ...@@ -7,7 +7,6 @@ import classNames from 'classnames';
import {projects} from './lib/redux-modules'; import {projects} from './lib/redux-modules';
import {selectCanAddProjects, selectCanEditOpenToAll, selectShowProjectMuteError} from '../../redux/studio-permissions'; import {selectCanAddProjects, selectCanEditOpenToAll, selectShowProjectMuteError} from '../../redux/studio-permissions';
import Debug from './debug.jsx';
import StudioProjectAdder from './studio-project-adder.jsx'; import StudioProjectAdder from './studio-project-adder.jsx';
import StudioProjectTile from './studio-project-tile.jsx'; import StudioProjectTile from './studio-project-tile.jsx';
import {loadProjects} from './lib/studio-project-actions.js'; import {loadProjects} from './lib/studio-project-actions.js';
...@@ -49,12 +48,19 @@ const StudioProjects = ({ ...@@ -49,12 +48,19 @@ const StudioProjects = ({
</CommentingStatus> </CommentingStatus>
} }
{canAddProjects && <StudioProjectAdder />} {canAddProjects && <StudioProjectAdder />}
{error && <Debug
label="Error" {error && <div className="studio-section-load-error studio-info-box studio-info-box-error">
data={error} <h3><FormattedMessage id="studio.sectionLoadError.projectsHeadline" /></h3>
/>} <button
className="button"
onClick={onLoadMore}
>
<FormattedMessage id="studio.sectionLoadError.tryAgain" />
</button>
</div>}
<div className="studio-projects-grid"> <div className="studio-projects-grid">
{items.length === 0 && !loading ? ( {items.length === 0 && !loading && !error ? (
<div className="studio-empty"> <div className="studio-empty">
{canAddProjects ? ( {canAddProjects ? (
<React.Fragment> <React.Fragment>
......
...@@ -174,6 +174,13 @@ $radius: 8px; ...@@ -174,6 +174,13 @@ $radius: 8px;
} }
} }
.studio-section-load-error {
margin-top: 2rem;
padding: 1rem;
flex-direction: column;
text-align: center;
}
.studio-tab-nav { .studio-tab-nav {
border-bottom: 1px solid $active-dark-gray; border-bottom: 1px solid $active-dark-gray;
padding-bottom: 8px; padding-bottom: 8px;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment