2021-01-22 10:18:13 +00:00
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2025-02-14 06:04:25 +00:00
|
|
|
import { Button, Input, InputGroup } from 'reactstrap';
|
2021-01-22 10:18:13 +00:00
|
|
|
import { gettext } from '../utils/constants';
|
|
|
|
import ButtonQR from './btn-qr-code';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
link: PropTypes.string.isRequired,
|
|
|
|
linkExpired: PropTypes.bool.isRequired,
|
|
|
|
copyLink: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
// for 'share link' & 'upload link'
|
|
|
|
class SharedLink extends React.Component {
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { link, linkExpired, copyLink } = this.props;
|
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
<div className="d-flex">
|
|
|
|
<InputGroup>
|
|
|
|
<Input type="text" readOnly={true} value={link} />
|
2025-02-14 06:04:25 +00:00
|
|
|
<Button color="primary" onClick={copyLink} className="border-0">{gettext('Copy')}</Button>
|
2021-01-22 10:18:13 +00:00
|
|
|
</InputGroup>
|
|
|
|
<ButtonQR link={link} />
|
|
|
|
</div>
|
|
|
|
{linkExpired && <p className="err-message mt-1">({gettext('Expired')})</p>}
|
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedLink.propTypes = propTypes;
|
|
|
|
export default SharedLink;
|