mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
routes: filtering by distance
This commit is contained in:
parent
c69da00b2a
commit
8248d9f166
12 changed files with 546 additions and 43 deletions
|
@ -128,11 +128,24 @@ const searchSetTab = (state, { tab = 'mine' }) => ({
|
|||
}
|
||||
});
|
||||
|
||||
const searchPutRoutes = (state, { list = [] }) => ({
|
||||
const searchPutRoutes = (state, { list = [], min, max }) => ({
|
||||
...state,
|
||||
routes: {
|
||||
...state.routes,
|
||||
list,
|
||||
filter: {
|
||||
...state.routes.filter,
|
||||
min: min || state.routes.filter.min,
|
||||
max: max || state.routes.filter.max,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const searchSetLoading = (state, { loading = false }) => ({
|
||||
...state,
|
||||
routes: {
|
||||
...state.routes,
|
||||
loading,
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -168,6 +181,7 @@ const HANDLERS = ({
|
|||
[ACTIONS.SEARCH_SET_DISTANCE]: searchSetDistance,
|
||||
[ACTIONS.SEARCH_SET_TAB]: searchSetTab,
|
||||
[ACTIONS.SEARCH_PUT_ROUTES]: searchPutRoutes,
|
||||
[ACTIONS.SEARCH_SET_LOADING]: searchSetLoading,
|
||||
}: { [key: String]: Function });
|
||||
|
||||
export const INITIAL_STATE = {
|
||||
|
@ -210,9 +224,10 @@ export const INITIAL_STATE = {
|
|||
title: '',
|
||||
starred: false,
|
||||
distance: [0, 300],
|
||||
|
||||
author: '',
|
||||
tab: 'mine',
|
||||
min: 0,
|
||||
max: 300,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue