mocked my permissioned studios

This commit is contained in:
Ben Wheeler 2018-06-19 00:00:37 -04:00
parent 4c657a1e80
commit e05079a28c
2 changed files with 48 additions and 12 deletions

View file

@ -57,21 +57,22 @@ class AddToStudioModal extends React.Component {
render () {
const {
intl,
studios,
projectStudios,
myStudios,
onAddToStudio, // eslint-disable-line no-unused-vars
type,
...modalProps
} = this.props;
const contentLabel = intl.formatMessage({id: `addToStudio.${type}`});
const studioButtons = studios.map((studio, key) => (
<div className="studio-selector-button">
{truncate(studio.description, {'length': 20, 'separator': /[,:\.;]*\s+/})}
const projectStudioButtons = projectStudios.map((studio, index) => (
<div className="studio-selector-button" key={studio.id}>
{truncate(studio.title, {'length': 20, 'separator': /[,:\.;]*\s+/})}
</div>
));
const myStudioButtons = myStudios.map((studio, index) => (
<div className="studio-selector-button" key={studio.id}>
{truncate(studio.title, {'length': 20, 'separator': /[,:\.;]*\s+/})}
</div>
// const href = `/studio/${item.id}/`;
// <div className="studio-selector-button">
// {item.name}
// href: {href}
// </div>
));
return (
@ -93,7 +94,8 @@ class AddToStudioModal extends React.Component {
<div className="studio-list-outer-scrollbox">
<div className="studio-list-inner-scrollbox">
<div className="studio-list-container">
{studioButtons}
{[...projectStudioButtons,
...myStudioButtons]}
</div>
</div>
</div>
@ -142,7 +144,8 @@ class AddToStudioModal extends React.Component {
AddToStudioModal.propTypes = {
intl: intlShape,
studios: PropTypes.arrayOf(PropTypes.object),
projectStudios: PropTypes.arrayOf(PropTypes.object),
myStudios: PropTypes.arrayOf(PropTypes.object),
onAddToStudio: PropTypes.func,
onRequestClose: PropTypes.func,
type: PropTypes.string

View file

@ -42,6 +42,38 @@ class PreviewPresentation extends React.Component {
addToStudioOpen: false,
reportOpen: false
};
this.mockedMyStudios = [
{
id: 0,
description: "Wow, studio A rocks",
history: {created: "2015-11-15T00:24:35.000Z",
modified: "2018-05-01T00:14:48.000Z"},
image: "https://cdn2.scratch.mit.edu/get_image/gallery/1702295_170x100.png",
owner: 10689298,
stats: {followers: 0},
title: "Studio A"
},
{
id: 1,
description: "Wow, studio B rocks",
history: {created: "2015-11-15T00:24:35.000Z",
modified: "2018-05-01T00:14:48.000Z"},
image: "https://cdn2.scratch.mit.edu/get_image/gallery/1702295_170x100.png",
owner: 10689298,
stats: {followers: 0},
title: "Studio B"
},
{
id: 2,
description: "Wow, studio C rocks",
history: {created: "2015-11-15T00:24:35.000Z",
modified: "2018-05-01T00:14:48.000Z"},
image: "https://cdn2.scratch.mit.edu/get_image/gallery/1702295_170x100.png",
owner: 10689298,
stats: {followers: 0},
title: "Studio C"
}
]
}
// Add to Studio modal
@ -352,7 +384,8 @@ class PreviewPresentation extends React.Component {
isOpen={this.state.addToStudioOpen}
key="add-to-studio-modal"
type="project"
studios={studios}
projectStudios={studios}
myStudios={this.mockedMyStudios}
onAddToStudio={this.handleAddToStudioSubmit}
onRequestClose={this.handleAddToStudioClose}
/>