Merge pull request #3127 from matrix-org/t3chguy/file_upload_filesize

Add file size to UploadConfirmDialog
This commit is contained in:
J. Ryan Stinnett 2019-06-21 09:19:27 +01:00 committed by GitHub
commit d3b552411c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
/* /*
Copyright 2019 New Vector Ltd Copyright 2019 New Vector Ltd
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -18,6 +19,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import filesize from "filesize";
export default class UploadConfirmDialog extends React.Component { export default class UploadConfirmDialog extends React.Component {
static propTypes = { static propTypes = {
@ -75,7 +77,7 @@ export default class UploadConfirmDialog extends React.Component {
preview = <div className="mx_UploadConfirmDialog_previewOuter"> preview = <div className="mx_UploadConfirmDialog_previewOuter">
<div className="mx_UploadConfirmDialog_previewInner"> <div className="mx_UploadConfirmDialog_previewInner">
<div><img className="mx_UploadConfirmDialog_imagePreview" src={this._objectUrl} /></div> <div><img className="mx_UploadConfirmDialog_imagePreview" src={this._objectUrl} /></div>
<div>{this.props.file.name}</div> <div>{this.props.file.name} ({filesize(this.props.file.size)})</div>
</div> </div>
</div>; </div>;
} else { } else {
@ -84,7 +86,7 @@ export default class UploadConfirmDialog extends React.Component {
<img className="mx_UploadConfirmDialog_fileIcon" <img className="mx_UploadConfirmDialog_fileIcon"
src={require("../../../../res/img/files.png")} src={require("../../../../res/img/files.png")}
/> />
{this.props.file.name} {this.props.file.name} ({filesize(this.props.file.size)})
</div> </div>
</div>; </div>;
} }