Skip to content

Commit c85eb16

Browse files
authored
Merge pull request #842 from ubyssey/841-image-modal-patch
fix scroll load with query
2 parents 949b972 + f5f5144 commit c85eb16

File tree

1 file changed

+10
-8
lines changed
  • dispatch/static/manager/src/js/components/modals/ImageManager

1 file changed

+10
-8
lines changed

dispatch/static/manager/src/js/components/modals/ImageManager/index.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require('../../../../styles/components/image_manager.scss')
1616
const SCROLL_THRESHOLD = 100
1717

1818
const DEFAULT_QUERY = {
19-
limit: 30,
19+
limit: 50,
2020
ordering: '-created_at'
2121
}
2222

@@ -44,10 +44,10 @@ class ImageManagerComponent extends React.Component {
4444
}
4545

4646
loadMore() {
47-
if (this.props.images.count > this.state.limit){
47+
if (this.props.images.count > this.state.limit) {
4848
this.setState(prevState => ({
49-
limit: prevState.limit + 10
50-
}), this.props.listImages(this.props.token, {limit: this.state.limit, ordering: '-created_at'}))
49+
limit: prevState.limit + 25
50+
}), this.props.listImages(this.props.token, R.assoc('q', this.state.q, {limit: this.state.limit, ordering: '-created_at' })))
5151
}
5252
}
5353

@@ -97,15 +97,15 @@ class ImageManagerComponent extends React.Component {
9797

9898
onDrop(files) {
9999
files.forEach(file => {
100-
this.props.createImage(this.props.token, {img: file})
100+
this.props.createImage(this.props.token, { img: file })
101101
})
102102
}
103103

104104
render() {
105105

106106
const image = this.getImage()
107107

108-
const images = this.props.images.ids.map( id => {
108+
const images = this.props.images.ids.map(id => {
109109
const image = this.props.entities.remote[id]
110110
return (
111111
<ImageThumb
@@ -147,13 +147,15 @@ class ImageManagerComponent extends React.Component {
147147
activeClassName='c-image-manager__images--active'>
148148
<div
149149
className='c-image-manager__images__container'
150-
ref={(node) => { this.images = node }}>{images}</div>
150+
ref={(node) => { this.images = node }}>{images}
151+
</div>
152+
{this.props.images.isLoading && <h2 style={{position:'relative', top: '-8px', width:'100%', textAlign:'center'}}>Loading...</h2>}
151153
</Dropzone>
152154
{!this.props.many ?
153155
<div className='c-image-manager__active'>
154156
{image ? imagePanel : null}
155157
</div> : null}
156-
158+
157159
</div>
158160
<div className='c-image-manager__footer'>
159161
<div className='c-image-manger__footer__selected' />

0 commit comments

Comments
 (0)