Skip to content

Commit

Permalink
Reservation Rate Report actions, reducers, selectors
Browse files Browse the repository at this point in the history
Create actions reducers and selectors for Modal.
  • Loading branch information
Kevin Seestrand committed Mar 2, 2022
1 parent 9635599 commit 580cabe
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/actions/uiActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ export default createActions(
'HIDE_RESOURCE_INFO_MODAL',
'HIDE_RESOURCE_IMAGES_MODAL',
'HIDE_RESOURCE_SELECTOR_MODAL',
'HIDE_RESERVATIONS_RATE_REPORT_MODAL',
'SHOW_RESERVATION_CANCEL_MODAL',
'SHOW_RESERVATION_INFO_MODAL',
'SHOW_RESERVATION_SUCCESS_MODAL',
'SHOW_RESOURCE_INFO_MODAL',
'SHOW_RESOURCE_IMAGES_MODAL',
'SHOW_RESOURCE_SELECTOR_MODAL',
'SHOW_RESERVATIONS_RATE_REPORT_MODAL',
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createStructuredSelector } from 'reselect';

function showSelector(state) {
return state.modals.reservationsRateReport.show;
}

function unitsSelector(state) {
return state.data.units;
}

export default createStructuredSelector({
show: showSelector,
units: unitsSelector,
});
2 changes: 2 additions & 0 deletions app/state/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import recurringReservations from './recurringReservationsReducer';
import resourcePage from './resourcePageReducer';
import reservationCancel from './reservationCancelModalReducer';
import reservationInfo from './reservationInfoModalReducer';
import reservationsRateReport from './reservationsRateReportModalReducer';
import reservationSearchFilters from './reservationSearchFiltersReducer';
import reservationSearchResults from './reservationSearchResultsReducer';
import reservationSuccess from './reservationSuccessModalReducer';
Expand All @@ -32,6 +33,7 @@ export default combineReducers({
resourceImages,
resourceInfo,
resourceSelector: resourceSelectorModal,
reservationsRateReport,
}),
recurringReservations,
reservationSearchPage: combineReducers({
Expand Down
24 changes: 24 additions & 0 deletions app/state/reducers/reservationsRateReportModalReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { handleActions } from 'redux-actions';

import uiActions from 'actions/uiActions';
import actionTypes from 'api/actionTypes';

const initialState = {
show: false,
units: [],
};

const hide = state => ({
...state,
show: false,
units: [],
});

export default handleActions({
[uiActions.showReservationsRateReportModal]: state => ({
...state,
show: true,
}),
[uiActions.hideReservationsRateReportModal]: hide,
[actionTypes.RESERVATIONS_RATE_REPORT]: () => {},
}, initialState);

0 comments on commit 580cabe

Please sign in to comment.