diff --git a/.github/workflows/percy.yml b/.github/workflows/percy.yml
index c5e878b72..9684cb875 100644
--- a/.github/workflows/percy.yml
+++ b/.github/workflows/percy.yml
@@ -52,7 +52,7 @@ jobs:
- name: Download OTP2 config file
run: curl $PERCY_OTP2_CONFIG_URL --output /tmp/otp2config.yml
env:
- PERCY_OTP2_CONFIG_URL: ${{ secrets.PERCY_MOCK_OTP2_GEOCODER_CONFIG }}
+ PERCY_OTP2_CONFIG_URL: ${{ secrets.PERCY_MOCK_OTP2_GEOCODER_CALLTAKER_CONFIG }}
- name: Build OTP-RR Calltaker
# Calltaker has a separate config file, so another build should be produced.
run: yarn build
diff --git a/lib/app.js b/lib/app.js
index 4ea733227..fda84a81f 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -21,12 +21,7 @@ import {
BatchResultsScreen,
BatchRoutingPanel,
BatchSearchScreen,
- CallHistoryWindow,
- CallTakerControls,
- CallTakerPanel,
DefaultItinerary,
- FieldTripWindows,
- MailablesWindow,
ResponsiveWebapp
} from './index'
@@ -178,17 +173,9 @@ const components = {
ItineraryBody: DefaultItinerary,
- MainControls: isCallTakerModuleEnabled ? CallTakerControls : null,
+ MainPanel: BatchRoutingPanel,
- MainPanel: isCallTakerModuleEnabled ? CallTakerPanel : BatchRoutingPanel,
-
- MapWindows: isCallTakerModuleEnabled ? (
- <>
-
-
-
- >
- ) : null,
+ MapWindows: isCallTakerModuleEnabled ? jsConfig.MapWindows : null,
MobileResultsScreen: BatchResultsScreen,
diff --git a/lib/index.js b/lib/index.js
index 9b8180f8a..f7d142a80 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,9 +1,5 @@
/* eslint-disable prettier/prettier */
/* eslint-disable sort-imports-es6-autofix/sort-imports-es6 */
-import CallTakerControls from './components/admin/call-taker-controls'
-import CallHistoryWindow from './components/admin/call-history-window'
-import FieldTripWindows from './components/admin/field-trip-windows'
-import MailablesWindow from './components/admin/mailables-window'
import DateTimeModal from './components/form/date-time-modal'
import DateTimePreview from './components/form/date-time-preview'
import ErrorMessage from './components/form/error-message'
@@ -29,7 +25,6 @@ import ViewStopButton from './components/viewers/view-stop-button'
import ViewerContainer from './components/viewers/viewer-container'
import ResponsiveWebapp from './components/app/responsive-webapp'
import AppMenu from './components/app/app-menu'
-import CallTakerPanel from './components/app/call-taker-panel'
import DesktopNav from './components/app/desktop-nav'
import BatchRoutingPanel from './components/app/batch-routing-panel'
import BatchResultsScreen from './components/mobile/batch-results-screen'
@@ -50,12 +45,6 @@ const MobileResultsScreen = BatchResultsScreen
const MobileSearchScreen = BatchSearchScreen
export {
- // module components
- CallHistoryWindow,
- CallTakerControls,
- FieldTripWindows,
- MailablesWindow,
-
// form components
DateTimeModal,
DateTimePreview,
@@ -96,7 +85,6 @@ export {
// app components,
ResponsiveWebapp,
AppMenu,
- CallTakerPanel,
DesktopNav,
// batch routing components
diff --git a/lib/reducers/call-taker.js b/lib/reducers/call-taker.js
index 202bc22c0..9953484ef 100644
--- a/lib/reducers/call-taker.js
+++ b/lib/reducers/call-taker.js
@@ -6,11 +6,17 @@ import { FETCH_STATUS } from '../util/constants'
import { getISOLikeTimestamp } from '../util/state'
import { getModuleConfig, Modules } from '../util/config'
+function getCalltakerConfig(config) {
+ return getModuleConfig({ otp: { config } }, Modules.CALL_TAKER)
+}
+
function createCallTakerReducer(config) {
- const calltakerConfig = getModuleConfig(
- { otp: { config } },
- Modules.CALL_TAKER
- )
+ const calltakerConfig = getCalltakerConfig(config)
+ if (!calltakerConfig) {
+ // Don't include the calltaker reducer at all if calltaker is not enabled in config.
+ return undefined
+ }
+
const initialState = {
activeCall: null,
callHistory: {
diff --git a/lib/util/state.js b/lib/util/state.js
index c25b0b615..dee8fd604 100644
--- a/lib/util/state.js
+++ b/lib/util/state.js
@@ -245,8 +245,8 @@ function getActiveSearchRealtimeResponse(state) {
* https://decembersoft.com/posts/error-selector-creators-expect-all-input-selectors-to-be-functions/
*/
export const getActiveFieldTripRequest = createSelector(
- (state) => state.callTaker?.fieldTrip.activeId,
- (state) => state.callTaker?.fieldTrip.requests,
+ (state) => state.callTaker?.fieldTrip?.activeId,
+ (state) => state.callTaker?.fieldTrip?.requests,
(activeId, requests) => {
if (!activeId || !requests) return
return requests.data.find((req) => req.id === activeId)
diff --git a/percy/har-mock-config-call-taker.js b/percy/har-mock-config-call-taker.js
index f1e892114..418f5f6c9 100644
--- a/percy/har-mock-config-call-taker.js
+++ b/percy/har-mock-config-call-taker.js
@@ -14,14 +14,14 @@ import React from 'react'
import {
BatchResultsScreen,
BatchSearchScreen,
- CallHistoryWindow,
- CallTakerPanel,
- FieldTripWindows,
- MailablesWindow,
MetroItinerary
// Webpack sets this file to run from a subdirectory within otp-react-redux
// ../lib points to the index file of otp-react-redux's source code
} from '../lib'
+import CallHistoryWindow from '../lib/components/admin/call-history-window'
+import CallTakerPanel from '../lib/components/app/call-taker-panel'
+import FieldTripWindows from '../lib/components/admin/field-trip-windows'
+import MailablesWindow from '../lib/components/admin/mailables-window'
/**
* Custom itinerary footer for this deployment.