diff --git a/common/components/charts/ChartPageDiv.tsx b/common/components/charts/ChartPageDiv.tsx index c36afbee6..9cc682e6b 100644 --- a/common/components/charts/ChartPageDiv.tsx +++ b/common/components/charts/ChartPageDiv.tsx @@ -5,5 +5,5 @@ interface ChartPageDivProps { } export const ChartPageDiv: React.FC = ({ children }) => { - return
{children}
; + return
{children}
; }; diff --git a/common/components/notices/BetaDataNotice.tsx b/common/components/notices/BetaDataNotice.tsx new file mode 100644 index 000000000..4611dafe4 --- /dev/null +++ b/common/components/notices/BetaDataNotice.tsx @@ -0,0 +1,67 @@ +import React from 'react'; +import dayjs from 'dayjs'; +import Link from 'next/link'; +import classNames from 'classnames'; +import { ExclamationTriangleIcon } from '@heroicons/react/20/solid'; +import { useDelimitatedRoute } from '../../utils/router'; +import { BUS_MAX_DAY } from '../../constants/dates'; +import { lineColorTextHover } from '../../styles/general'; + +export const BetaDataNotice: React.FC = () => { + const { + line, + linePath, + query: { date, startDate, endDate }, + } = useDelimitatedRoute(); + + const isStartDateAfterBusMaxDay = + (startDate !== undefined && dayjs(startDate).isAfter(BUS_MAX_DAY)) || + (date !== undefined && dayjs(date).isAfter(BUS_MAX_DAY)); + const isEndDateAfterBusMaxDay = endDate !== undefined && dayjs(endDate).isAfter(BUS_MAX_DAY); + + if ( + (line === 'line-bus' || linePath === 'bus') && + (isStartDateAfterBusMaxDay || isEndDateAfterBusMaxDay) + ) { + return ( +
+
+
+
+
+

Real-time bus data is in beta

+
+

+ Data shown here is collected by TransitMatters using the{' '} + + MBTA's V3 API + + . Unlike other data sources we show, this data is not cleaned or filtered in any way + before display. Please expect reduced accuracy. +

+

+ We favor official performance data from the MBTA when it's available. Technical + details of our data collection can be found{' '} + + here + +

+
+
+
+
+ ); + } + return null; +}; diff --git a/common/components/notices/SameDayNotice.tsx b/common/components/notices/SameDayNotice.tsx index 076f09147..96959ba79 100644 --- a/common/components/notices/SameDayNotice.tsx +++ b/common/components/notices/SameDayNotice.tsx @@ -6,11 +6,12 @@ import { TODAY_STRING } from '../../constants/dates'; export const SameDayNotice: React.FC = () => { const { + line, query: { date, endDate }, } = useDelimitatedRoute(); const isToday = date === TODAY_STRING || endDate === TODAY_STRING; - if (isToday) { + if (isToday && line !== 'line-bus') { return (
diff --git a/common/constants/dates.ts b/common/constants/dates.ts index c58e0fea5..2f3c8a9b4 100644 --- a/common/constants/dates.ts +++ b/common/constants/dates.ts @@ -59,7 +59,7 @@ export const FLAT_PICKER_OPTIONS: { Bus: { enableTime: false, minDate: BUS_MIN_DATE, - maxDate: BUS_MAX_DATE, + maxDate: TODAY_STRING, altInput: true, altFormat: 'M j, Y', dateFormat: 'Y-m-d', @@ -141,7 +141,7 @@ export const SINGLE_PRESETS: { [key in Tab]: { [key in DatePresetKey]?: DateSelectionDefaultOptions }; } = { Subway: SINGLE_RAPID_PRESETS, - Bus: SINGLE_BUS_PRESETS, + Bus: SINGLE_RAPID_PRESETS, System: SINGLE_RAPID_PRESETS, }; @@ -263,7 +263,7 @@ export const RANGE_PRESETS: { [key in Tab]: { [key in DatePresetKey]?: DateSelectionDefaultOptions }; } = { Subway: RANGE_RAPID_PRESETS, - Bus: RANGE_BUS_PRESETS, + Bus: RANGE_RAPID_PRESETS, System: RANGE_RAPID_PRESETS, }; diff --git a/common/state/defaults/dateDefaults.ts b/common/state/defaults/dateDefaults.ts index 11b919f97..d018a02e8 100644 --- a/common/state/defaults/dateDefaults.ts +++ b/common/state/defaults/dateDefaults.ts @@ -2,8 +2,6 @@ import type { Tab } from '../../constants/dashboardTabs'; import type { DateStoreSection } from '../../constants/pages'; import type { DateStoreConfiguration } from '../types/dateStoreTypes'; import { - BUS_MAX_DATE, - BUS_MAX_DATE_MINUS_ONE_WEEK, ONE_WEEK_AGO_STRING, OVERVIEW_OPTIONS, TODAY_STRING, @@ -28,11 +26,11 @@ export const BUS_DEFAULTS: WithOptional = ({ children, line }) => {

{LINE_OBJECTS[line].name}

- {line === 'line-bus' &&

(WIP)

} + {line === 'line-bus' &&

(Beta)

}
); diff --git a/modules/tripexplorer/TripExplorer.tsx b/modules/tripexplorer/TripExplorer.tsx index bf3546e1a..98022af89 100644 --- a/modules/tripexplorer/TripExplorer.tsx +++ b/modules/tripexplorer/TripExplorer.tsx @@ -11,6 +11,7 @@ import { useDelimitatedRoute } from '../../common/utils/router'; import { getParentStationForStopId } from '../../common/utils/stations'; import { BusDataNotice } from '../../common/components/notices/BusDataNotice'; import { GobbleDataNotice } from '../../common/components/notices/GobbleDataNotice'; +import { BetaDataNotice } from '../../common/components/notices/BetaDataNotice'; import { useAlertStore } from './AlertStore'; import { TripGraphs } from './TripGraphs'; @@ -37,6 +38,7 @@ export const TripExplorer = () => { return ( + {alertsForModal?.length ? : null}
diff --git a/server/chalicelib/s3.py b/server/chalicelib/s3.py index 9860200e2..360905ce0 100644 --- a/server/chalicelib/s3.py +++ b/server/chalicelib/s3.py @@ -78,6 +78,7 @@ def download_one_event_file(date, stop_id: str, use_live_data=False): @parallel.make_parallel def parallel_download_events(datestop): (date, stop) = datestop + # TODO: Force gobble when date is past the max monthly data date return download_one_event_file(date, stop)