import React from 'react';
import PropTypes from 'prop-types';
import Account from '../common/account';
import { gettext, siteRoot, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle } from '../../utils/constants';
import { Button } from 'reactstrap';
import { Utils } from '../../utils/utils';
import SaveSharedFileDialog from '../dialog/save-shared-file-dialog';
import toaster from '../toast';
import watermark from 'watermark-dom';
import '../../css/shared-file-view.css';
const propTypes = {
content: PropTypes.object.isRequired
};
let loginUser = window.app.pageOptions.name;
const { repoID, sharedToken, trafficOverLimit, fileName, fileSize, sharedBy, siteName, enableWatermark, download, zipped } = window.shared.pageOptions;
class SharedFileView extends React.Component {
constructor(props) {
super(props);
this.state = {
showSaveSharedFileDialog: false
};
}
handleSaveSharedFileDialog = () => {
this.setState({
showSaveSharedFileDialog: true
});
}
toggleCancel = () => {
this.setState({
showSaveSharedFileDialog: false
});
}
handleSaveSharedFile = () => {
toaster.success(gettext('Successfully saved'), {
duration: 3
});
}
componentDidMount() {
if (trafficOverLimit) {
toaster.danger(gettext('File download is disabled: the share link traffic of owner is used up.'), {
duration: 3
});
}
}
renderPath = () => {
return (
{gettext('Current path: ')}{this.renderPath()}
:{gettext('Shared by:')}{' '}{sharedBy}
}