Add missing PropTypes
parent
35b3da155d
commit
0561ff64ac
|
|
@ -248,10 +248,10 @@ export default class RoomClient
|
|||
logger.error('getFileHistory() | failed: %o', error);
|
||||
|
||||
this._dispatch(requestActions.notify({
|
||||
type: 'error',
|
||||
text: 'Could not get file history'
|
||||
type : 'error',
|
||||
text : 'Could not get file history'
|
||||
}));
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
muteMic()
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import React, { Component, Fragment } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import magnet from 'magnet-uri';
|
||||
import * as requestActions from '../../redux/requestActions';
|
||||
import { saveAs } from 'file-saver/FileSaver';
|
||||
import { client } from './index';
|
||||
import { client } from './index';
|
||||
|
||||
const DEFAULT_PICTURE = 'resources/images/avatar-empty.jpeg';
|
||||
|
||||
|
|
@ -71,13 +72,13 @@ class FileEntry extends Component
|
|||
});
|
||||
};
|
||||
|
||||
download = () =>
|
||||
handleDownload = () =>
|
||||
{
|
||||
this.setState({
|
||||
active : true
|
||||
});
|
||||
|
||||
const magnet = this.props.data.file.magnet;
|
||||
const magnetURI = this.props.data.file.magnet;
|
||||
|
||||
const existingTorrent = client.get(magnet);
|
||||
|
||||
|
|
@ -87,7 +88,7 @@ class FileEntry extends Component
|
|||
return this.handleTorrent(existingTorrent);
|
||||
}
|
||||
|
||||
client.add(magnet, this.handleTorrent);
|
||||
client.add(magnetURI, this.handleTorrent);
|
||||
}
|
||||
|
||||
render()
|
||||
|
|
@ -105,7 +106,7 @@ class FileEntry extends Component
|
|||
|
||||
{!this.state.active && !this.state.files && (
|
||||
<div className='file-info'>
|
||||
<span className='button' onClick={this.download}>
|
||||
<span className='button' onClick={this.handleDownload}>
|
||||
<img src='resources/images/download-icon.svg' />
|
||||
</span>
|
||||
|
||||
|
|
@ -144,6 +145,20 @@ class FileEntry extends Component
|
|||
}
|
||||
}
|
||||
|
||||
export const FileEntryProps = {
|
||||
data : PropTypes.shape({
|
||||
name : PropTypes.string.isRequired,
|
||||
picture : PropTypes.string.isRequired,
|
||||
file : PropTypes.shape({
|
||||
magnet : PropTypes.string.isRequired
|
||||
}).isRequired,
|
||||
me : PropTypes.bool
|
||||
}).isRequired,
|
||||
notify : PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
FileEntry.propTypes = FileEntryProps;
|
||||
|
||||
const mapDispatchToProps = {
|
||||
notify : requestActions.notify
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import WebTorrent from 'webtorrent';
|
||||
import createTorrent from 'create-torrent';
|
||||
|
|
@ -8,7 +9,7 @@ import * as stateActions from '../../redux/stateActions';
|
|||
import * as requestActions from '../../redux/requestActions';
|
||||
import { store } from '../../store';
|
||||
import config from '../../../config';
|
||||
import FileEntry from './FileEntry';
|
||||
import FileEntry, { FileEntryProps } from './FileEntry';
|
||||
|
||||
export const client = new WebTorrent({
|
||||
tracker : {
|
||||
|
|
@ -130,6 +131,10 @@ class FileSharing extends Component
|
|||
}
|
||||
}
|
||||
|
||||
FileSharing.propTypes = {
|
||||
sharing : PropTypes.arrayOf(FileEntryProps.data).isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) =>
|
||||
({
|
||||
sharing : state.sharing
|
||||
|
|
|
|||
|
|
@ -452,8 +452,8 @@ export const addFile = (payload) =>
|
|||
export const addFileHistory = (fileHistory) =>
|
||||
{
|
||||
return {
|
||||
type: 'ADD_FILE_HISTORY',
|
||||
payload: { fileHistory }
|
||||
type : 'ADD_FILE_HISTORY',
|
||||
payload : { fileHistory }
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ class Room extends EventEmitter
|
|||
accept();
|
||||
|
||||
protooPeer.send('file-history-receive', {
|
||||
fileHistory: this._fileHistory
|
||||
fileHistory : this._fileHistory
|
||||
});
|
||||
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue