feat: change default page size pagination.

This commit is contained in:
elforjani13
2021-09-26 14:02:26 +02:00
parent 31d2b1b09a
commit fcace4213c
23 changed files with 45 additions and 59 deletions

View File

@@ -86,7 +86,7 @@ function Pagination({
currentPage,
total,
size,
pageSizesOptions = [5, 12, 20, 30, 50, 75, 100, 150],
pageSizesOptions = [20, 30, 50, 75, 100, 150],
onPageChange,
onPageSizeChange,
}) {

View File

@@ -5,7 +5,7 @@ import useApiRequest from '../useRequest';
import t from './types';
const defaultPagination = {
pageSize: 12,
pageSize: 20,
page: 0,
pagesCount: 0,
};

View File

@@ -86,7 +86,7 @@ export function useEstimates(query, props) {
estimates: [],
pagination: {
page: 1,
pageSize: 12,
pageSize: 20,
total: 0,
},
filterMeta: {},

View File

@@ -5,7 +5,7 @@ import { transformPagination } from 'utils';
import useApiRequest from '../useRequest';
const defaultPagination = {
pageSize: 12,
pageSize: 20,
page: 0,
pagesCount: 0,
};
@@ -82,7 +82,7 @@ export function useExchangeRates(query, props) {
exchangesRates: [],
pagination: {
page: 1,
pageSize: 12,
pageSize: 20,
total: 0,
},
filterMeta: {},

View File

@@ -5,7 +5,7 @@ import { transformPagination } from 'utils';
import t from './types';
const defaultPagination = {
pageSize: 12,
pageSize: 20,
page: 0,
pagesCount: 0,
};

View File

@@ -76,7 +76,7 @@ export function useInventoryAdjustments(query, props) {
transactions: [],
pagination: {
page: 1,
pageSize: 12,
pageSize: 20,
total: 0,
pagesCount: 0,
},

View File

@@ -110,7 +110,7 @@ export function useInvoices(query, props) {
invoices: [],
pagination: {
page: 1,
pageSize: 12,
pageSize: 20,
total: 0,
},
filterMeta: {},

View File

@@ -5,7 +5,7 @@ import useApiRequest from '../useRequest';
import t from './types';
const DEFAULT_PAGINATION = {
pageSize: 12,
pageSize: 20,
page: 0,
pagesCount: 0,
};
@@ -75,7 +75,7 @@ export function useDeleteItem(props) {
/**
* Activate the given item.
*/
export function useActivateItem(props) {
export function useActivateItem(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
@@ -114,7 +114,9 @@ export function useInactivateItem(props) {
const transformItemsResponse = (response) => {
return {
items: response.data.items,
pagination: transformPagination(transformResponse(response.data.pagination)),
pagination: transformPagination(
transformResponse(response.data.pagination),
),
filterMeta: transformResponse(response.data.filter_meta),
};
};
@@ -137,8 +139,8 @@ export function useItems(query, props) {
pagination: DEFAULT_PAGINATION,
filterMeta: {},
},
...props
}
...props,
},
);
}
@@ -149,7 +151,7 @@ export function useRefreshItems() {
refresh: () => {
queryClient.invalidateQueries(t.ITEMS);
},
}
};
}
/**
@@ -166,7 +168,7 @@ export function useItem(id, props) {
{
select: (response) => response.data.item,
defaultData: {},
...props
...props,
},
);
}
}

View File

@@ -44,7 +44,7 @@ export function usePaymentReceives(query, props) {
select: transformPaymentReceives,
defaultData: {
paymentReceives: [],
pagination: { page: 1, pageSize: 12, total: 0 },
pagination: { page: 1, pageSize: 20, total: 0 },
filterMeta: {},
},
...props,

View File

@@ -5,7 +5,7 @@ import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
viewSlug: null,

View File

@@ -1,13 +1,11 @@
import { createReducer } from '@reduxjs/toolkit';
import { persistReducer, purgeStoredState } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import {
createTableStateReducers,
} from 'store/tableState.reducer';
import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
viewSlug: null,
@@ -33,7 +31,4 @@ const reducerInstance = createReducer(initialState, {
},
});
export default persistReducer(
CONFIG,
reducerInstance,
);
export default persistReducer(CONFIG, reducerInstance);

View File

@@ -3,7 +3,7 @@ import { createTableStateReducers } from 'store/tableState.reducer';
const initialState = {
tableState: {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
},
};

View File

@@ -1,13 +1,11 @@
import { createReducer } from '@reduxjs/toolkit';
import { persistReducer, purgeStoredState } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import {
createTableStateReducers,
} from 'store/tableState.reducer';
import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
viewSlug: null,
@@ -27,13 +25,10 @@ const CONFIG = {
const reducerInstance = createReducer(initialState, {
...createTableStateReducers('INVOICES', defaultTableQuery),
[t.RESET]: () => {
purgeStoredState(CONFIG);
}
},
});
export default persistReducer(
CONFIG,
reducerInstance,
);
export default persistReducer(CONFIG, reducerInstance);

View File

@@ -5,7 +5,7 @@ import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
sortBy: [],

View File

@@ -1,13 +1,11 @@
import { createReducer } from '@reduxjs/toolkit';
import { persistReducer, purgeStoredState } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import {
createTableStateReducers,
} from 'store/tableState.reducer';
import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
viewSlug: null,
@@ -33,7 +31,4 @@ const reducerInstance = createReducer(initialState, {
},
});
export default persistReducer(
CONFIG,
reducerInstance,
);
export default persistReducer(CONFIG, reducerInstance);

View File

@@ -4,9 +4,8 @@ import storage from 'redux-persist/lib/storage';
import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
export const defaultTableQuery = {
pageSize: 20,
pageIndex: 0,
filterRoles: [],
};
@@ -28,7 +27,7 @@ const reducerInstance = createReducer(initialState, {
[t.RESET]: () => {
purgeStoredState(CONFIG);
}
},
});
export default persistReducer(CONFIG, reducerInstance);

View File

@@ -5,7 +5,7 @@ import { createTableStateReducers } from 'store/tableState.reducer';
// Default table query state.
export const defaultTableQueryState = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
inactiveMode: false,
filterRoles: [],

View File

@@ -6,7 +6,7 @@ import t from 'store/types';
// Default table query.
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
viewSlug: null,
@@ -30,7 +30,7 @@ const reducerInstance = createReducer(initialState, {
[t.RESET]: () => {
purgeStoredState(CONFIG);
}
},
});
export default persistReducer(CONFIG, reducerInstance);

View File

@@ -6,7 +6,7 @@ import t from 'store/types';
const initialState = {
tableState: {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
sortBy: [],
},

View File

@@ -5,7 +5,7 @@ import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
inactiveMode: false,

View File

@@ -5,11 +5,11 @@ import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
viewSlug: null,
}
};
const initialState = {
tableState: defaultTableQuery,

View File

@@ -5,7 +5,7 @@ import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQuery = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
filterRoles: [],
viewSlug: null,

View File

@@ -5,7 +5,7 @@ import { createTableStateReducers } from 'store/tableState.reducer';
import t from 'store/types';
export const defaultTableQueryState = {
pageSize: 12,
pageSize: 20,
pageIndex: 0,
inactiveMode: false,
filterRoles: [],