summaryrefslogtreecommitdiffstats
path: root/web/react/components/file_info_preview.jsx
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2016-01-05 15:49:45 -0500
committerhmhealey <harrisonmhealey@gmail.com>2016-01-06 09:44:12 -0500
commit239d147d9757c62cbfb6ae7b2900b0e5ace6f71c (patch)
tree05032970def7f0a021fe4d5c403f0fb973c24ae9 /web/react/components/file_info_preview.jsx
parent0eb145218edb37d911cc5ec135b0006f866a44b2 (diff)
downloadchat-239d147d9757c62cbfb6ae7b2900b0e5ace6f71c.tar.gz
chat-239d147d9757c62cbfb6ae7b2900b0e5ace6f71c.tar.bz2
chat-239d147d9757c62cbfb6ae7b2900b0e5ace6f71c.zip
Changed Audio/Video preview to just display a file info when encountering a file that cannot be played
Diffstat (limited to 'web/react/components/file_info_preview.jsx')
-rw-r--r--web/react/components/file_info_preview.jsx31
1 files changed, 31 insertions, 0 deletions
diff --git a/web/react/components/file_info_preview.jsx b/web/react/components/file_info_preview.jsx
new file mode 100644
index 000000000..4b76cd162
--- /dev/null
+++ b/web/react/components/file_info_preview.jsx
@@ -0,0 +1,31 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as Utils from '../utils/utils.jsx';
+
+export default function FileInfoPreview({filename, fileUrl, fileInfo}) {
+ // non-image files include a section providing details about the file
+ let infoString = 'File type ' + fileInfo.extension.toUpperCase();
+ if (fileInfo.size > 0) {
+ infoString += ', Size ' + Utils.fileSizeToString(fileInfo.size);
+ }
+
+ const name = decodeURIComponent(Utils.getFileName(filename));
+
+ return (
+ <div className='file-details__container'>
+ <a
+ className={'file-details__preview'}
+ href={fileUrl}
+ target='_blank'
+ >
+ <span className='file-details__preview-helper' />
+ <img src={Utils.getPreviewImagePath(filename)}/>
+ </a>
+ <div className='file-details'>
+ <div className='file-details__name'>{name}</div>
+ <div className='file-details__info'>{infoString}</div>
+ </div>
+ </div>
+ );
+}