Add a notice in Chrome when dloading files >500MB.

pull/18/head
Alex Kern 11 years ago
parent 07cafdb08b
commit 31adc45333

@ -37,18 +37,23 @@ p {
color: gray; color: gray;
font: 18px/22px "Quicksand", sans-serif; font: 18px/22px "Quicksand", sans-serif;
text-align: center; text-align: center;
margin: 0 0; margin: 0;
} }
p.byline { p.byline {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-bottom: 15px; margin-bottom: 15px;
left: 0; left: 0;
right: 0; right: 0;
font: 16px/22px "Quicksand", sans-serif; font: 16px/22px "Quicksand", sans-serif;
}
p.notice {
margin: 10px 0;
font-style: italic;
} }
.drop-zone { .drop-zone {

@ -3,6 +3,7 @@ import alt from '../alt'
export default alt.createActions(class SupportActions { export default alt.createActions(class SupportActions {
constructor() { constructor() {
this.generateActions( this.generateActions(
'isChrome',
'noSupport' 'noSupport'
) )
} }

@ -14,4 +14,8 @@ window.FilePizza = () => {
}) })
if (!webrtcSupport.support) SupportActions.noSupport() if (!webrtcSupport.support) SupportActions.noSupport()
let isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1
if (isChrome) SupportActions.isChrome()
} }

@ -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
}
}
}

@ -1,4 +1,5 @@
import Centered from './Centered' import Centered from './Centered'
import ChromeNotice from './ChromeNotice'
import DownloadActions from '../actions/DownloadActions' import DownloadActions from '../actions/DownloadActions'
import DownloadButton from './DownloadButton' import DownloadButton from './DownloadButton'
import DownloadStore from '../stores/DownloadStore' import DownloadStore from '../stores/DownloadStore'
@ -45,6 +46,7 @@ export default class DownloadPage extends React.Component {
name={this.state.file.name} name={this.state.file.name}
size={this.state.file.size} /> size={this.state.file.size} />
<ChromeNotice />
<DownloadButton onClick={this.downloadFile.bind(this)} /> <DownloadButton onClick={this.downloadFile.bind(this)} />
</Centered> </Centered>
@ -58,6 +60,7 @@ export default class DownloadPage extends React.Component {
name={this.state.file.name} name={this.state.file.name}
size={this.state.file.size} /> size={this.state.file.size} />
<ChromeNotice />
<ProgressBar value={this.state.progress} /> <ProgressBar value={this.state.progress} />
</Centered> </Centered>
@ -70,6 +73,7 @@ export default class DownloadPage extends React.Component {
name={this.state.file.name} name={this.state.file.name}
size={this.state.file.size} /> size={this.state.file.size} />
<ChromeNotice />
<ProgressBar value={-1} /> <ProgressBar value={-1} />
</Centered> </Centered>
@ -82,6 +86,7 @@ export default class DownloadPage extends React.Component {
name={this.state.file.name} name={this.state.file.name}
size={this.state.file.size} /> size={this.state.file.size} />
<ChromeNotice />
<ProgressBar value={1} /> <ProgressBar value={1} />
</Centered> </Centered>

@ -6,10 +6,15 @@ export default alt.createStore(class SupportStore {
constructor() { constructor() {
this.bindActions(SupportActions) this.bindActions(SupportActions)
this.isSupported = true this.isSupported = true
this.isChrome = false
} }
onNoSupport() { onNoSupport() {
this.isSupported = false this.isSupported = false
} }
onIsChrome() {
this.isChrome = true
}
}, 'SupportStore') }, 'SupportStore')

Loading…
Cancel
Save