Make "max. to download" setting easier to change

This commit is contained in:
Christopher Gurnee 2021-12-03 11:01:56 -05:00
parent 245bfe1f6b
commit 0cc254eb20
2 changed files with 5 additions and 3 deletions

View file

@ -27,10 +27,11 @@ const sortBy = props => {
<label htmlFor='maxComments'>max. to download:</label>
<span className='space' />
<input id='maxComments' onChange={e => {
if (e.target.value > props.global.state.maxComments)
if (parseInt(e.target.value) > props.global.state.maxComments && props.global.state.maxComments < maxCommentsLimit)
setReloadVisible(true)
props.global.setMaxComments(e.target.value)
}} value={props.global.state.maxComments} type='number' size='5' maxLength='5' required min='100' max={maxCommentsLimit} step='100' />
}} onBlur={e => {
e.target.value = props.global.setMaxComments(e.target.value)
}} defaultValue={props.global.state.maxComments} type='number' size='5' maxLength='5' required min='100' max={maxCommentsLimit} step='100' />
{reloadVisible && <>
<span className='space' />
<input onClick={() => location.replace(location.href)} type='button' value='Reload' />

View file

@ -50,6 +50,7 @@ class GlobalState extends Container {
maxComments = 100
put(maxCommentsKey, maxComments)
this.setState({maxComments})
return maxComments
}
setSuccess = () => this.setState({statusText: '', statusImage: '/images/success.png'})