mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-03 12:27:30 -05:00
fix(studios): change the curators, projects and managers load count to 24
Changing from 20 to 24 will fix the issue where we are loading rows that aren't "full" on a 3-tile row. Now it will always fill a row no matter the display breakpoint (1,2 or 3 tiles per row)
This commit is contained in:
parent
9ad67dc297
commit
4866d96da1
2 changed files with 10 additions and 9 deletions
|
@ -17,6 +17,8 @@ const Errors = keyMirror({
|
||||||
MANAGER_LIMIT: null
|
MANAGER_LIMIT: null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const PER_PAGE_LIMIT = 24;
|
||||||
|
|
||||||
const normalizeError = (err, body, res) => {
|
const normalizeError = (err, body, res) => {
|
||||||
if (err) return Errors.NETWORK;
|
if (err) return Errors.NETWORK;
|
||||||
if (res.statusCode === 400 && body.message === 'too many owners') {
|
if (res.statusCode === 400 && body.message === 'too many owners') {
|
||||||
|
@ -40,15 +42,14 @@ const loadManagers = () => ((dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const studioId = selectStudioId(state);
|
const studioId = selectStudioId(state);
|
||||||
const managerCount = managers.selector(state).items.length;
|
const managerCount = managers.selector(state).items.length;
|
||||||
const managersPerPage = 20;
|
|
||||||
const opts = {
|
const opts = {
|
||||||
uri: `/studios/${studioId}/managers/`,
|
uri: `/studios/${studioId}/managers/`,
|
||||||
params: {limit: managersPerPage, offset: managerCount}
|
params: {limit: PER_PAGE_LIMIT, offset: managerCount}
|
||||||
};
|
};
|
||||||
api(withAdmin(opts, state), (err, body, res) => {
|
api(withAdmin(opts, state), (err, body, res) => {
|
||||||
const error = normalizeError(err, body, res);
|
const error = normalizeError(err, body, res);
|
||||||
if (error) return dispatch(managers.actions.error(error));
|
if (error) return dispatch(managers.actions.error(error));
|
||||||
dispatch(managers.actions.append(body, body.length === managersPerPage));
|
dispatch(managers.actions.append(body, body.length === PER_PAGE_LIMIT));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,15 +57,14 @@ const loadCurators = () => ((dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const studioId = selectStudioId(state);
|
const studioId = selectStudioId(state);
|
||||||
const curatorCount = curators.selector(state).items.length;
|
const curatorCount = curators.selector(state).items.length;
|
||||||
const curatorsPerPage = 20;
|
|
||||||
const opts = {
|
const opts = {
|
||||||
uri: `/studios/${studioId}/curators/`,
|
uri: `/studios/${studioId}/curators/`,
|
||||||
params: {limit: curatorsPerPage, offset: curatorCount}
|
params: {limit: PER_PAGE_LIMIT, offset: curatorCount}
|
||||||
};
|
};
|
||||||
api(withAdmin(opts, state), (err, body, res) => {
|
api(withAdmin(opts, state), (err, body, res) => {
|
||||||
const error = normalizeError(err, body, res);
|
const error = normalizeError(err, body, res);
|
||||||
if (error) return dispatch(curators.actions.error(error));
|
if (error) return dispatch(curators.actions.error(error));
|
||||||
dispatch(curators.actions.append(body, body.length === curatorsPerPage));
|
dispatch(curators.actions.append(body, body.length === PER_PAGE_LIMIT));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@ const Errors = keyMirror({
|
||||||
USER_MUTED: null
|
USER_MUTED: null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const PER_PAGE_LIMIT = 24;
|
||||||
|
|
||||||
const normalizeError = (err, body, res) => {
|
const normalizeError = (err, body, res) => {
|
||||||
if (err) return Errors.NETWORK;
|
if (err) return Errors.NETWORK;
|
||||||
if (res.statusCode === 403 && body.mute_status) return Errors.USER_MUTED;
|
if (res.statusCode === 403 && body.mute_status) return Errors.USER_MUTED;
|
||||||
|
@ -32,15 +34,14 @@ const loadProjects = () => ((dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const studioId = selectStudioId(state);
|
const studioId = selectStudioId(state);
|
||||||
const projectCount = projects.selector(state).items.length;
|
const projectCount = projects.selector(state).items.length;
|
||||||
const projectsPerPage = 20;
|
|
||||||
const opts = {
|
const opts = {
|
||||||
uri: `/studios/${studioId}/projects/`,
|
uri: `/studios/${studioId}/projects/`,
|
||||||
params: {limit: projectsPerPage, offset: projectCount}
|
params: {limit: PER_PAGE_LIMIT, offset: projectCount}
|
||||||
};
|
};
|
||||||
api(withAdmin(opts, state), (err, body, res) => {
|
api(withAdmin(opts, state), (err, body, res) => {
|
||||||
const error = normalizeError(err, body, res);
|
const error = normalizeError(err, body, res);
|
||||||
if (error) return dispatch(projects.actions.error(error));
|
if (error) return dispatch(projects.actions.error(error));
|
||||||
dispatch(projects.actions.append(body, body.length === projectsPerPage));
|
dispatch(projects.actions.append(body, body.length === PER_PAGE_LIMIT));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue