Skip to content

Commit

Permalink
Merge pull request #1011 from opentripplanner/remove-calltaker-index-…
Browse files Browse the repository at this point in the history
…imports

Remove calltaker index imports
  • Loading branch information
binh-dam-ibigroup authored Oct 19, 2023
2 parents c3a143f + 64b4c72 commit 9a8f7f1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/percy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 2 additions & 15 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ import {
BatchResultsScreen,
BatchRoutingPanel,
BatchSearchScreen,
CallHistoryWindow,
CallTakerControls,
CallTakerPanel,
DefaultItinerary,
FieldTripWindows,
MailablesWindow,
ResponsiveWebapp
} from './index'

Expand Down Expand Up @@ -178,17 +173,9 @@ const components = {

ItineraryBody: DefaultItinerary,

MainControls: isCallTakerModuleEnabled ? CallTakerControls : null,
MainPanel: BatchRoutingPanel,

MainPanel: isCallTakerModuleEnabled ? CallTakerPanel : BatchRoutingPanel,

MapWindows: isCallTakerModuleEnabled ? (
<>
<CallHistoryWindow />
<FieldTripWindows />
<MailablesWindow />
</>
) : null,
MapWindows: isCallTakerModuleEnabled ? jsConfig.MapWindows : null,

MobileResultsScreen: BatchResultsScreen,

Expand Down
12 changes: 0 additions & 12 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'
Expand All @@ -50,12 +45,6 @@ const MobileResultsScreen = BatchResultsScreen
const MobileSearchScreen = BatchSearchScreen

export {
// module components
CallHistoryWindow,
CallTakerControls,
FieldTripWindows,
MailablesWindow,

// form components
DateTimeModal,
DateTimePreview,
Expand Down Expand Up @@ -96,7 +85,6 @@ export {
// app components,
ResponsiveWebapp,
AppMenu,
CallTakerPanel,
DesktopNav,

// batch routing components
Expand Down
14 changes: 10 additions & 4 deletions lib/reducers/call-taker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions lib/util/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions percy/har-mock-config-call-taker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9a8f7f1

Please sign in to comment.