blob: 0a07522fc5402d354f786e01475d12ca8e044887 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {FormattedMessage} from 'react-intl';
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: React.PropTypes.bool.isRequired,
fileId: React.PropTypes.number.isRequired,
totalFiles: React.PropTypes.number.isRequired,
filename: React.PropTypes.string.isRequired,
fileURL: React.PropTypes.string.isRequired,
onGetPublicLink: React.PropTypes.func.isRequired
};
|