@@ -116,6 +116,15 @@ function openTimeFilterReducer(state, action) {
116116 }
117117}
118118
119+ function foodTypeFilterReducer ( state , action ) {
120+ switch ( action . type ) {
121+ case "FOOD_TYPE_FILTER_UPDATED" :
122+ return action . foodTypeFilter ;
123+ default :
124+ return state ;
125+ }
126+ }
127+
119128function listPanelReducer ( state , action ) {
120129 switch ( action . type ) {
121130 case "TOGGLE_LIST_PANEL" :
@@ -171,6 +180,7 @@ export function appReducer(state, action) {
171180 filterPanel : filterPanelReducer ( state . filterPanel , action ) ,
172181 orgNameFilter : orgNameFilterReducer ( state . orgNameFilter , action ) ,
173182 openTimeFilter : openTimeFilterReducer ( state . openTimeFilter , action ) ,
183+ foodTypeFilter : foodTypeFilterReducer ( state . foodTypeFilter , action ) ,
174184 listPanel : listPanelReducer ( state . listPanel , action ) ,
175185 isListPanelVisible : isListPanelVisibleReducer (
176186 state . isListPanelVisible ,
@@ -193,6 +203,7 @@ export function getInitialState() {
193203 filterPanel : false ,
194204 orgNameFilter : "" ,
195205 openTimeFilter : { radio : "Show All" , day : "" , time : "" } ,
206+ foodTypeFilter : [ ] ,
196207 listPanel : true ,
197208 isListPanelVisible : false ,
198209 position : "0" ,
@@ -284,6 +295,11 @@ export function useOpenTimeFilter() {
284295 return openTimeFilter ;
285296}
286297
298+ export function useFoodTypeFilter ( ) {
299+ const { foodTypeFilter } = useAppState ( ) ;
300+ return foodTypeFilter ;
301+ }
302+
287303export function useListPanel ( ) {
288304 const { listPanel } = useAppState ( ) ;
289305 return listPanel ;
0 commit comments