const bindAll = require('lodash.bindall'); const FormattedDate = require('react-intl').FormattedDate; const injectIntl = require('react-intl').injectIntl; const intlShape = require('react-intl').intlShape; const PropTypes = require('prop-types'); const React = require('react'); const Formsy = require('formsy-react').default; const classNames = require('classnames'); const GUI = require('scratch-gui').default; const IntlGUI = injectIntl(GUI); const sessionActions = require('../../redux/session.js'); const decorateText = require('../../lib/decorate-text.jsx'); const FlexRow = require('../../components/flex-row/flex-row.jsx'); const Button = require('../../components/forms/button.jsx'); const Form = require('../../components/forms/form.jsx'); const Input = require('../../components/forms/input.jsx'); const Select = require('../../components/forms/select.jsx'); const Spinner = require('../../components/spinner/spinner.jsx'); const TextArea = require('../../components/forms/textarea.jsx'); const Avatar = require('../../components/avatar/avatar.jsx'); const CappedNumber = require('../../components/cappednumber/cappednumber.jsx'); const ShareBanner = require('../../components/share-banner/share-banner.jsx'); const ThumbnailColumn = require('../../components/thumbnailcolumn/thumbnailcolumn.jsx'); const InplaceInput = require('../../components/forms/inplace-input.jsx'); const ReportModal = require('../../components/modal/report/modal.jsx'); require('./preview.scss'); class PreviewPresentation extends React.Component { constructor (props) { super(props); bindAll(this, [ 'handleReportClick', 'handleReportClose', 'handleReportReasonSelect', 'handleReportSubmit' ]); this.state = { reportOpen: false, reportPrompt: 'Select a reason why above.', reportReason: '' }; } handleReportClick (e) { e.preventDefault(); this.setState({reportOpen: true}); } handleReportClose () { this.setState({reportOpen: false}); } handleReportReasonSelect (name, value) { const prompts = [ 'Please provide a link to the original project', 'Please provide links to the uncredited content', 'Please say why the project is too violent or scary', 'Please say where the inappropriate language occurs in the project (For example: Notes & Credits, sprite name, project text, etc.)', 'Please say the name of the audio file with the inappropriate music', 'Please say where the personal contact information is shared (For example: Notes & Credits, sprite name, project text, etc.)', 'Please be specific about why this project does not follow our Community Guidelines', 'not used', 'Please say the name of the sprite or the backdrop with the inappropriate image' ]; this.setState({reportPrompt: prompts[value]}); } handleReportSubmit (formData) { console.log('submit report data', formData); this.setState({reportOpen: false}); } render () { const { editable, faved, favoriteCount, intl, isFullScreen, loved, loveCount, originalInfo, parentInfo, projectId, projectInfo, remixes, sessionStatus, studios, user, onFavoriteClicked, onLoveClicked, onSeeInside, onUpdate // ...otherProps TBD } = this.props; const shareDate = (projectInfo.history && projectInfo.history.shared) ? projectInfo.history.shared : ''; return (
{projectInfo.history && shareDate === '' && This project is not shared — so only you can see it. Click share to let everyone see it! } { projectInfo && projectInfo.author && projectInfo.author.id && (
{editable ? :
{projectInfo.title}
} {`${intl.formatMessage({id: 'thumbnail.by'})} `} {projectInfo.author.username}
{sessionStatus === sessionActions.Status.FETCHED && Object.keys(user).length > 0 && user.id !== projectInfo.author.id && }
{parentInfo && parentInfo.author && parentInfo.id && (
Thanks to {parentInfo.author.username} for the original project {parentInfo.title} .
)} {originalInfo && originalInfo.author && originalInfo.id && (
Thanks to {originalInfo.author.username} for the original project {originalInfo.title} .
)}
Instructions
{editable ? :
{decorateText(projectInfo.instructions)}
}
Notes and Credits
{editable ? :
{decorateText(projectInfo.description)}
}
{loveCount}
{favoriteCount}
{projectInfo.remix.count}
©
{' '} {/* eslint-disable react/jsx-sort-props */} {shareDate === null ? 'Unshared' : } {/* eslint-enable react/jsx-sort-props */}
{ sessionStatus === sessionActions.Status.FETCHED && Object.keys(user).length > 0 && user.id !== projectInfo.author.id && [ , From the dropdown below, please select the reason why you feel this project is disrespectful or inappropriate or otherwise breaks the Scratch Community Guidelines.