re-structure to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 01:02:31 +02:00
parent 8242ec64ba
commit 7a0a13f9d5
10400 changed files with 46966 additions and 17223 deletions

View File

@@ -0,0 +1,18 @@
// @ts-nocheck
import t from '@/store/types';
/**
* Sets the customers table state.
*/
export const setCustomersTableState = (queries) => {
return {
type: t.CUSTOMERS_TABLE_STATE_SET,
payload: { queries },
};
};
export const resetCustomersTableState = () => {
return {
type: t.CUSTOMERS_TABLE_STATE_RESET,
};
}

View File

@@ -0,0 +1,34 @@
// @ts-nocheck
import { createReducer } from '@reduxjs/toolkit';
import { persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import { createTableStateReducers } from '@/store/tableState.reducer';
// Default table query state.
export const defaultTableQueryState = {
pageSize: 20,
pageIndex: 0,
inactiveMode: false,
filterRoles: [],
viewSlug: null,
};
// initial data.
const initialState = {
tableState: defaultTableQueryState,
};
const reducerInstance = createReducer(initialState, {
...createTableStateReducers('CUSTOMERS', defaultTableQueryState),
});
const STORAGE_KEY = 'bigcapital:estimates';
export default persistReducer(
{
key: STORAGE_KEY,
whitelist: [],
storage,
},
reducerInstance,
);

View File

@@ -0,0 +1,26 @@
// @ts-nocheck
import { isEqual } from 'lodash';
import { paginationLocationQuery } from '@/store/selectors';
import { createDeepEqualSelector } from '@/utils';
import { defaultTableQueryState } from './customers.reducer';
const customerTableStateSelector = (state) => state.customers.tableState;
export const getCustomersTableStateFactory = () =>
createDeepEqualSelector(
paginationLocationQuery,
customerTableStateSelector,
(locationQuery, tableState) => {
return {
...locationQuery,
...tableState,
};
},
);
export const customersTableStateChangedFactory = () =>
createDeepEqualSelector(customerTableStateSelector, (tableState) => {
return !isEqual(tableState, defaultTableQueryState);
});

View File

@@ -0,0 +1,5 @@
// @ts-nocheck
export default {
CUSTOMERS_TABLE_STATE_SET: 'CUSTOMERS/TABLE_STATE_SET',
CUSTOMERS_TABLE_STATE_RESET: 'CUSTOMERS/TABLE_STATE_RESET'
};