mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Updating client dependancies. Switching to using yarn. * Updating React * Moving pure components to using function syntax (performance gains with newer react version) * Updating client dependancies. * Ignore .yarninstall * Enabling pre-lockfile because it's the entire point of using yarn. * Removing old webpack config * Moving to new prop-types * Fixing ESLint Errors * Updating jest snapshots. * Cleaning up package.json
87 lines
2.7 KiB
JavaScript
87 lines
2.7 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import {FormattedMessage} from 'react-intl';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
|
|
|
export default class ViewImagePopoverBar extends React.Component {
|
|
render() {
|
|
var publicLink = '';
|
|
if (global.window.mm_config.EnablePublicLink === 'true') {
|
|
publicLink = (
|
|
<div>
|
|
<a
|
|
href='#'
|
|
className='public-link text'
|
|
data-title='Public Image'
|
|
onClick={this.props.onGetPublicLink}
|
|
>
|
|
<FormattedMessage
|
|
id='view_image_popover.publicLink'
|
|
defaultMessage='Get Public Link'
|
|
/>
|
|
</a>
|
|
<span className='text'>{' | '}</span>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
var footerClass = 'modal-button-bar';
|
|
if (this.props.show) {
|
|
footerClass += ' footer--show';
|
|
}
|
|
|
|
return (
|
|
<div
|
|
ref='imageFooter'
|
|
className={footerClass}
|
|
>
|
|
<span className='pull-left text'>
|
|
<FormattedMessage
|
|
id='view_image_popover.file'
|
|
defaultMessage='File {count} of {total}'
|
|
values={{
|
|
count: (this.props.fileId + 1),
|
|
total: this.props.totalFiles
|
|
}}
|
|
/>
|
|
</span>
|
|
<div className='image-links'>
|
|
{publicLink}
|
|
<a
|
|
href={this.props.fileURL}
|
|
download={this.props.filename}
|
|
className='text'
|
|
target='_blank'
|
|
rel='noopener noreferrer'
|
|
>
|
|
<FormattedMessage
|
|
id='view_image_popover.download'
|
|
defaultMessage='Download'
|
|
/>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
ViewImagePopoverBar.defaultProps = {
|
|
show: false,
|
|
imgId: 0,
|
|
totalFiles: 0,
|
|
filename: '',
|
|
fileURL: ''
|
|
};
|
|
|
|
ViewImagePopoverBar.propTypes = {
|
|
show: PropTypes.bool.isRequired,
|
|
fileId: PropTypes.number.isRequired,
|
|
totalFiles: PropTypes.number.isRequired,
|
|
filename: PropTypes.string.isRequired,
|
|
fileURL: PropTypes.string.isRequired,
|
|
onGetPublicLink: PropTypes.func.isRequired
|
|
};
|