2018-02-07 18:06:07 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
2020-08-21 11:59:58 +00:00
|
|
|
import { withTranslation } from 'react-i18next';
|
2017-10-30 18:38:41 +00:00
|
|
|
import CopyableInput from './CopyableInput';
|
2017-02-22 19:29:35 +00:00
|
|
|
|
2017-10-30 18:38:41 +00:00
|
|
|
class ShareModal extends React.PureComponent {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
projectId,
|
|
|
|
ownerUsername,
|
|
|
|
projectName
|
|
|
|
} = this.props;
|
|
|
|
const hostname = window.location.origin;
|
|
|
|
return (
|
|
|
|
<div className="share-modal">
|
|
|
|
<h3 className="share-modal__project-name">
|
|
|
|
{projectName}
|
|
|
|
</h3>
|
|
|
|
<CopyableInput
|
2020-08-21 11:59:58 +00:00
|
|
|
label={this.props.t('ShareModal.Embed')}
|
2018-10-18 18:10:37 +00:00
|
|
|
value={`<iframe src="${hostname}/${ownerUsername}/embed/${projectId}"></iframe>`}
|
2017-07-11 15:37:43 +00:00
|
|
|
/>
|
2019-01-16 17:35:34 +00:00
|
|
|
<CopyableInput
|
2020-08-21 11:59:58 +00:00
|
|
|
label={this.props.t('ShareModal.Present')}
|
2019-01-16 17:35:34 +00:00
|
|
|
hasPreviewLink
|
|
|
|
value={`${hostname}/${ownerUsername}/present/${projectId}`}
|
|
|
|
/>
|
2017-10-30 18:38:41 +00:00
|
|
|
<CopyableInput
|
2020-08-21 11:59:58 +00:00
|
|
|
label={this.props.t('ShareModal.Fullscreen')}
|
2018-10-18 18:10:37 +00:00
|
|
|
hasPreviewLink
|
|
|
|
value={`${hostname}/${ownerUsername}/full/${projectId}`}
|
2017-07-11 15:37:43 +00:00
|
|
|
/>
|
2017-10-30 18:38:41 +00:00
|
|
|
<CopyableInput
|
2020-08-21 11:59:58 +00:00
|
|
|
label={this.props.t('ShareModal.Edit')}
|
2019-01-16 17:35:34 +00:00
|
|
|
hasPreviewLink
|
2017-07-11 15:37:43 +00:00
|
|
|
value={`${hostname}/${ownerUsername}/sketches/${projectId}`}
|
|
|
|
/>
|
|
|
|
</div>
|
2017-10-30 18:38:41 +00:00
|
|
|
);
|
|
|
|
}
|
2016-09-07 02:37:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ShareModal.propTypes = {
|
|
|
|
projectId: PropTypes.string.isRequired,
|
2017-10-30 18:38:41 +00:00
|
|
|
ownerUsername: PropTypes.string.isRequired,
|
2020-08-21 11:59:58 +00:00
|
|
|
projectName: PropTypes.string.isRequired,
|
|
|
|
t: PropTypes.func.isRequired
|
2016-09-07 02:37:29 +00:00
|
|
|
};
|
|
|
|
|
2020-08-21 11:59:58 +00:00
|
|
|
export default withTranslation()(ShareModal);
|