forked from qgriffith-zz/OpenEats
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* poring browse to redux * fixing up search * adding dynamic count * adding correct logic for pagination * adding some css for pagination * fixing up mini-browse * make sure the qs has the defaults * moving search and filter to there other component * adding a reset button and better styles for the filters * removing debug * removing loading page from browse container * adding ordering * removing totals from sorting * adding custom reducer to browse * loading state as a history object * saving cache * centering pagination * updating code quility * adding dynamic link generation * removing onClick func * fixing searching * refactoring search bar * adding history to filter stores * updating filter Ui and fixing pagination * adding loading to reducers * saving browse section overhall * fixing issue with apis being called when they shouldnt * fixing up browse * adding active links to pagination * adding basic multi select support * fixing issue with flashing UI * adding multi select to filters * saving * fixing algorithm for multi select * adding flag for multi select filters * updating merge conflicts * cleaning up the filters more * adding css styles for mobile * adding prop types to browse * adding some basic tests * fixing list recipes locaiton in mini browse * more tests * creating some place holder tests * up * removing bad tests * more back the side bar * getting more side bar stuff working * configuring bootstrap columns * redesigning filters * redesigning filters * adding mobile dropdown * adding state to dropdown menu * adding bootstrap cols for mobile layout * fixing issues causing the filters to flash * cleaning up the placement of the clear search button and recipe count * saving * fixing up desktop UI * adding reset filter for mobile
- Loading branch information
Showing
37 changed files
with
1,128 additions
and
783 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import queryString from 'query-string' | ||
|
||
import { request } from '../../common/CustomSuperagent'; | ||
import { serverURLs } from '../../common/config' | ||
import FilterConstants from '../constants/FilterConstants' | ||
|
||
const parsedFilter = filter => { | ||
let parsedFilters = {}; | ||
for (let f in filter) { | ||
if (!['limit', 'offset'].includes(f)) { | ||
parsedFilters[f] = filter[f]; | ||
} | ||
} | ||
return parsedFilters; | ||
}; | ||
|
||
export const loadCourses = (filter) => { | ||
return dispatch => { | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_LOADING, | ||
filterName: FilterConstants.BROWSE_FILTER_COURSE, | ||
}); | ||
|
||
request() | ||
.get(serverURLs.course_count) | ||
.query(parsedFilter(filter)) | ||
.then(res => ( | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_LOAD, | ||
filterName: FilterConstants.BROWSE_FILTER_COURSE, | ||
qs: queryString.stringify(filter), | ||
res: res.body.results | ||
}) | ||
)) | ||
.catch(err => ( | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_ERROR, | ||
filterName: FilterConstants.BROWSE_FILTER_COURSE, | ||
}) | ||
)); | ||
} | ||
}; | ||
|
||
export const loadCuisines = (filter) => { | ||
return dispatch => { | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_LOADING, | ||
filterName: FilterConstants.BROWSE_FILTER_CUISINE, | ||
}); | ||
|
||
request() | ||
.get(serverURLs.cuisine_count) | ||
.query(parsedFilter(filter)) | ||
.then(res => ( | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_LOAD, | ||
filterName: FilterConstants.BROWSE_FILTER_CUISINE, | ||
qs: queryString.stringify(filter), | ||
res: res.body.results | ||
}) | ||
)) | ||
.catch(err => ( | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_ERROR, | ||
filterName: FilterConstants.BROWSE_FILTER_CUISINE, | ||
}) | ||
)); | ||
} | ||
}; | ||
|
||
export const loadRatings = (filter) => { | ||
return dispatch => { | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_LOADING, | ||
filterName: FilterConstants.BROWSE_FILTER_RATING, | ||
}); | ||
|
||
request() | ||
.get(serverURLs.ratings) | ||
.query(parsedFilter(filter)) | ||
.then(res => ( | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_LOAD, | ||
filterName: FilterConstants.BROWSE_FILTER_RATING, | ||
qs: queryString.stringify(filter), | ||
res: res.body.results | ||
}) | ||
)) | ||
.catch(err => ( | ||
dispatch({ | ||
type: FilterConstants.BROWSE_FILTER_ERROR, | ||
filterName: FilterConstants.BROWSE_FILTER_RATING, | ||
}) | ||
)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import queryString from 'query-string' | ||
|
||
import SearchConstants from '../constants/SearchConstants' | ||
import { request } from '../../common/CustomSuperagent'; | ||
import { serverURLs } from '../../common/config' | ||
|
||
export const loadRecipes = (filter) => { | ||
return dispatch => { | ||
dispatch({ type: SearchConstants.BROWSE_SEARCH_LOADING }); | ||
|
||
const map = { | ||
'cuisine': 'cuisine__slug', | ||
'course': 'course__slug' | ||
}; | ||
|
||
let parsedFilter = {}; | ||
for (let f in filter) { | ||
if (filter[f] !== null) { | ||
parsedFilter[f in map ? map[f] : f] = filter[f]; | ||
} | ||
} | ||
|
||
request() | ||
.get(serverURLs.browse) | ||
.query(parsedFilter) | ||
.then(res => ( | ||
dispatch({ | ||
type: SearchConstants.BROWSE_SEARCH_RESULTS, | ||
qs: queryString.stringify(filter), | ||
res: res.body | ||
}) | ||
)); | ||
} | ||
}; |
Oops, something went wrong.