2018-09-24 10:58:39 -04:00
|
|
|
const FormattedDate = require('react-intl').FormattedDate;
|
2018-10-23 11:37:59 -04:00
|
|
|
const FormattedMessage = require('react-intl').FormattedMessage;
|
2018-09-24 10:58:39 -04:00
|
|
|
const PropTypes = require('prop-types');
|
|
|
|
const React = require('react');
|
|
|
|
const FlexRow = require('../../components/flex-row/flex-row.jsx');
|
|
|
|
|
|
|
|
const Button = require('../../components/forms/button.jsx');
|
2018-10-18 16:45:24 -04:00
|
|
|
const AddToStudioModal = require('./add-to-studio.jsx');
|
2018-09-24 10:58:39 -04:00
|
|
|
const ReportModal = require('../../components/modal/report/modal.jsx');
|
|
|
|
|
2018-09-24 15:28:10 -04:00
|
|
|
require('./subactions.scss');
|
|
|
|
|
2018-10-05 09:15:09 -04:00
|
|
|
const Subactions = props => (
|
|
|
|
<FlexRow className="subactions">
|
|
|
|
<div className="share-date">
|
|
|
|
<div className="copyleft">©</div>
|
|
|
|
{' '}
|
|
|
|
{/* eslint-disable react/jsx-sort-props */}
|
2018-12-10 09:15:24 -05:00
|
|
|
{props.shareDate ? (
|
2018-10-05 09:15:09 -04:00
|
|
|
<FormattedDate
|
|
|
|
value={Date.parse(props.shareDate)}
|
|
|
|
day="2-digit"
|
|
|
|
month="short"
|
|
|
|
year="numeric"
|
|
|
|
/>
|
2018-12-10 09:15:24 -05:00
|
|
|
) : 'Unshared'}
|
2018-10-05 09:15:09 -04:00
|
|
|
{/* eslint-enable react/jsx-sort-props */}
|
|
|
|
</div>
|
|
|
|
<FlexRow className="action-buttons">
|
2018-10-16 10:49:35 -04:00
|
|
|
{props.canAddToStudio &&
|
2018-09-24 10:58:39 -04:00
|
|
|
<React.Fragment>
|
|
|
|
<Button
|
2018-10-05 09:15:09 -04:00
|
|
|
className="action-button studio-button"
|
|
|
|
key="add-to-studio-button"
|
|
|
|
onClick={props.onAddToStudioClicked}
|
2018-09-24 10:58:39 -04:00
|
|
|
>
|
2018-10-23 11:37:59 -04:00
|
|
|
<FormattedMessage id="addToStudio.title" />
|
2018-10-18 16:45:24 -04:00
|
|
|
</Button>
|
|
|
|
{props.addToStudioOpen && (
|
|
|
|
<AddToStudioModal
|
|
|
|
isOpen
|
2019-01-22 17:07:52 -05:00
|
|
|
isAdmin={props.isAdmin}
|
2018-10-18 16:45:24 -04:00
|
|
|
key="add-to-studio-modal"
|
2019-01-22 17:07:52 -05:00
|
|
|
userOwnsProject={props.userOwnsProject}
|
2018-10-18 16:45:24 -04:00
|
|
|
onRequestClose={props.onAddToStudioClosed}
|
|
|
|
onToggleStudio={props.onToggleStudio}
|
|
|
|
/>
|
|
|
|
)}
|
2018-09-24 10:58:39 -04:00
|
|
|
</React.Fragment>
|
2018-10-05 09:15:09 -04:00
|
|
|
}
|
2018-11-21 11:22:57 -05:00
|
|
|
<Button
|
|
|
|
className="action-button copy-link-button"
|
|
|
|
onClick={props.onCopyProjectLink}
|
|
|
|
>
|
2018-10-23 11:37:59 -04:00
|
|
|
<FormattedMessage id="general.copyLink" />
|
2018-10-05 09:15:09 -04:00
|
|
|
</Button>
|
2018-10-16 10:49:35 -04:00
|
|
|
{(props.canReport) &&
|
2018-10-05 09:15:09 -04:00
|
|
|
<React.Fragment>
|
|
|
|
<Button
|
|
|
|
className="action-button report-button"
|
|
|
|
key="report-button"
|
|
|
|
onClick={props.onReportClicked}
|
|
|
|
>
|
2018-10-23 11:37:59 -04:00
|
|
|
<FormattedMessage id="general.report" />
|
2018-10-18 16:45:24 -04:00
|
|
|
</Button>
|
|
|
|
{props.reportOpen && (
|
|
|
|
<ReportModal
|
|
|
|
isOpen
|
|
|
|
key="report-modal"
|
|
|
|
type="project"
|
|
|
|
onReport={props.onReportSubmit}
|
|
|
|
onRequestClose={props.onReportClose}
|
|
|
|
/>
|
|
|
|
)}
|
2018-10-05 09:15:09 -04:00
|
|
|
</React.Fragment>
|
|
|
|
}
|
2018-09-24 10:58:39 -04:00
|
|
|
</FlexRow>
|
2018-10-05 09:15:09 -04:00
|
|
|
</FlexRow>
|
|
|
|
);
|
2018-09-24 10:58:39 -04:00
|
|
|
|
|
|
|
Subactions.propTypes = {
|
2018-09-25 17:16:02 -04:00
|
|
|
addToStudioOpen: PropTypes.bool,
|
2018-10-16 10:49:35 -04:00
|
|
|
canAddToStudio: PropTypes.bool,
|
|
|
|
canReport: PropTypes.bool,
|
2019-01-22 17:07:52 -05:00
|
|
|
isAdmin: PropTypes.bool,
|
2018-09-25 17:16:02 -04:00
|
|
|
onAddToStudioClicked: PropTypes.func,
|
|
|
|
onAddToStudioClosed: PropTypes.func,
|
2018-11-21 11:22:57 -05:00
|
|
|
onCopyProjectLink: PropTypes.func,
|
2018-09-24 10:58:39 -04:00
|
|
|
onReportClicked: PropTypes.func.isRequired,
|
|
|
|
onReportClose: PropTypes.func.isRequired,
|
|
|
|
onReportSubmit: PropTypes.func.isRequired,
|
2018-09-25 17:16:02 -04:00
|
|
|
onToggleStudio: PropTypes.func,
|
|
|
|
reportOpen: PropTypes.bool,
|
2019-01-22 17:07:52 -05:00
|
|
|
shareDate: PropTypes.string,
|
|
|
|
userOwnsProject: PropTypes.bool
|
2018-09-24 10:58:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Subactions;
|