Skip to content

Commit

Permalink
Merge branch 'dev' into localize-trip-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup authored Oct 20, 2023
2 parents 353fe4e + 9a8f7f1 commit 2cf2dac
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 42 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
LegDescriptionHeadsignPrefix,
PlaceName as PlaceNameWrapper,
PlaceRowWrapper,
PlaceSubheader
PlaceSubheader,
TimeColumn
} from '@opentripplanner/itinerary-body/lib/styled'
import { PlaceName } from '@opentripplanner/itinerary-body/lib/otp-react-redux'
import clone from 'clone'
Expand Down Expand Up @@ -53,6 +54,9 @@ const StyledItineraryBody = styled(ItineraryBody)`
${PlaceRowWrapper} {
max-width: inherit;
}
${TimeColumn} {
white-space: nowrap;
}
`

class ConnectedItineraryBody extends Component {
Expand Down
1 change: 0 additions & 1 deletion lib/components/narrative/metro/metro-itinerary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const ItineraryDetails = styled.ul`
margin: 0;
overflow: hidden;
padding: 0;
width: 90%;
`
const PrimaryInfo = styled.li`
color: #000000cc;
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
8 changes: 6 additions & 2 deletions lib/util/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ async function loadOtpUiLocaleData(matchedLocale) {
*/
export async function loadLocaleData(matchedLocale, customMessages) {
let messages
let otpUiLocale = matchedLocale
switch (matchedLocale) {
case 'es': // Spanish translation is not specific to a region
messages = await import('../../i18n/es.yml')
Expand All @@ -130,15 +131,18 @@ export async function loadLocaleData(matchedLocale, customMessages) {
case 'vi': // Vietnamese translation is not specific to a region
messages = await import('../../i18n/vi.yml')
break
case 'zh': // Chinese translation is not specific to a region
case 'zh': // Chinese (Simplified) translation is not specific to a region
messages = await import('../../i18n/zh.yml')
// The OTP-UI files for Chinese (Simplified) are (correctly) named `zh_Hans`.
// TODO: Rename this repo's zh files to zh_Hans
otpUiLocale = 'zh_Hans'
break
default:
messages = await import('../../i18n/en-US.yml')
break
}

const otpUiMessages = await loadOtpUiLocaleData(matchedLocale)
const otpUiMessages = await loadOtpUiLocaleData(otpUiLocale)

// Merge custom strings into the standard language strings.
const mergedMessages = {
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 2cf2dac

Please sign in to comment.