mirror of https://github.com/kern/filepizza
Add a notice in Chrome when dloading files >500MB.
parent
07cafdb08b
commit
31adc45333
@ -0,0 +1,39 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import DownloadStore from '../stores/DownloadStore'
|
||||||
|
import SupportStore from '../stores/SupportStore'
|
||||||
|
|
||||||
|
function getState() {
|
||||||
|
return {
|
||||||
|
active: SupportStore.getState().isChrome && DownloadStore.getState().file.size >= 500000000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class ChromeNotice extends React.Component {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.state = getState()
|
||||||
|
|
||||||
|
this._onChange = () => {
|
||||||
|
this.setState(getState())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
DownloadStore.listen(this._onChange)
|
||||||
|
SupportStore.listen(this._onChange)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUnmount() {
|
||||||
|
DownloadStore.unlisten(this._onChange)
|
||||||
|
SupportStore.unlisten(this._onChange)
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
if (this.state.active) {
|
||||||
|
return <p className="notice">Chrome has issues downloading files > 500 MB. Try using Firefox instead.</p>
|
||||||
|
} else {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue