mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-26 03:26:41 +07:00
routes: added range rising
This commit is contained in:
parent
febe619e8c
commit
ddb77e1245
5 changed files with 80 additions and 25 deletions
|
@ -128,18 +128,42 @@ const searchSetTab = (state, { tab = 'mine' }) => ({
|
|||
}
|
||||
});
|
||||
|
||||
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 newDistCalc = ({ distance, min, max, filter }) => {
|
||||
if (filter.min === filter.max) {
|
||||
// slider was disabled
|
||||
return [min, max];
|
||||
}
|
||||
});
|
||||
|
||||
// state.routes.filter.distance
|
||||
};
|
||||
|
||||
const searchPutRoutes = (state, { list = [], min, max }) => {
|
||||
console.log('a', state.routes.filter.distance[0], state.routes.filter.min);
|
||||
return ({
|
||||
...state,
|
||||
routes: {
|
||||
...state.routes,
|
||||
list,
|
||||
filter: {
|
||||
...state.routes.filter,
|
||||
distance: (state.routes.filter.min === state.routes.filter.max)
|
||||
? [min, max]
|
||||
: state.routes.filter.distance,
|
||||
// distance:
|
||||
// [
|
||||
// (state.routes.filter.min > min && state.routes.filter.distance[0] <= state.routes.filter.min)
|
||||
// ? min
|
||||
// : state.routes.filter.distance[0],
|
||||
// (state.routes.filter.max < max && state.routes.filter.distance[1] >= state.routes.filter.max)
|
||||
// ? max
|
||||
// : state.routes.filter.distance[1],
|
||||
// ],
|
||||
min,
|
||||
max,
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const searchSetLoading = (state, { loading = false }) => ({
|
||||
...state,
|
||||
|
@ -223,7 +247,7 @@ export const INITIAL_STATE = {
|
|||
filter: {
|
||||
title: '',
|
||||
starred: false,
|
||||
distance: [0, 300],
|
||||
distance: [0, 99999],
|
||||
author: '',
|
||||
tab: 'mine',
|
||||
min: 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue