diff --git a/modules/dwells/DwellsDetails.tsx b/modules/dwells/DwellsDetails.tsx deleted file mode 100644 index 25f11237c..000000000 --- a/modules/dwells/DwellsDetails.tsx +++ /dev/null @@ -1,101 +0,0 @@ -'use client'; -import React from 'react'; -import dayjs from 'dayjs'; -import type { AggregateAPIOptions, SingleDayAPIOptions } from '../../common/types/api'; -import { AggregateAPIParams, SingleDayAPIParams } from '../../common/types/api'; -import { - getParentStationForStopId, - getLocationDetails, - stopIdsForStations, -} from '../../common/utils/stations'; -import { useDelimitatedRoute } from '../../common/utils/router'; -import { BasicDataWidgetPair } from '../../common/components/widgets/BasicDataWidgetPair'; -import { BasicDataWidgetItem } from '../../common/components/widgets/BasicDataWidgetItem'; -import { averageDwells, longestDwells } from '../../common/utils/dwells'; -import { TimeWidgetValue } from '../../common/types/basicWidgets'; -import { ErrorNotice } from '../../common/components/notices/ErrorNotice'; -import { TerminusNotice } from '../../common/components/notices/TerminusNotice'; -import { useDwellsAggregateData, useDwellsSingleDayData } from '../../common/api/hooks/dwells'; -import { WidgetDiv } from '../../common/components/widgets/WidgetDiv'; -import { SingleChartWrapper } from '../../common/components/charts/SingleChartWrapper'; -import { AggregateChartWrapper } from '../../common/components/charts/AggregateChartWrapper'; -import { PageWrapper } from '../../common/layouts/PageWrapper'; -import { WidgetTitle } from '../dashboard/WidgetTitle'; -import { Layout } from '../../common/layouts/layoutTypes'; - -export function DwellsDetails() { - const { - line, - query: { startDate, endDate, to, from }, - } = useDelimitatedRoute(); - - const fromStation = from ? getParentStationForStopId(from) : undefined; - const toStation = to ? getParentStationForStopId(to) : undefined; - const { fromStopIds } = stopIdsForStations(fromStation, toStation); - - const aggregate = Boolean(startDate && endDate); - const enabled = Boolean(fromStopIds && startDate); - const parameters: SingleDayAPIOptions | AggregateAPIOptions = aggregate - ? { - [AggregateAPIParams.stop]: fromStopIds, - [AggregateAPIParams.startDate]: startDate, - [AggregateAPIParams.endDate]: endDate, - } - : { - [SingleDayAPIParams.stop]: fromStopIds, - [SingleDayAPIParams.date]: startDate, - }; - - const dwells = useDwellsSingleDayData(parameters, !aggregate && enabled); - const dwellsAggregate = useDwellsAggregateData(parameters, aggregate && enabled); - - const dwellsData = aggregate ? dwellsAggregate?.data?.by_date : dwells?.data; - - if (dwells.isError) { - return ; - } - - return ( - - - - - - - - {aggregate ? ( - - ) : ( - - )} - - - - ); -} - -DwellsDetails.Layout = Layout.Dashboard; diff --git a/modules/headways/HeadwaysDetails.tsx b/modules/headways/HeadwaysDetails.tsx deleted file mode 100644 index 5471dc1eb..000000000 --- a/modules/headways/HeadwaysDetails.tsx +++ /dev/null @@ -1,122 +0,0 @@ -'use client'; - -import React from 'react'; -import dayjs from 'dayjs'; -import type { AggregateAPIOptions, SingleDayAPIOptions } from '../../common/types/api'; -import { AggregateAPIParams, SingleDayAPIParams } from '../../common/types/api'; -import { - getLocationDetails, - getParentStationForStopId, - stopIdsForStations, -} from '../../common/utils/stations'; -import { useDelimitatedRoute } from '../../common/utils/router'; -import { BasicDataWidgetPair } from '../../common/components/widgets/BasicDataWidgetPair'; -import { BasicDataWidgetItem } from '../../common/components/widgets/BasicDataWidgetItem'; -import { averageHeadway, longestHeadway } from '../../common/utils/headways'; -import { TimeWidgetValue } from '../../common/types/basicWidgets'; -import { TerminusNotice } from '../../common/components/notices/TerminusNotice'; -import { - useHeadwaysAggregateData, - useHeadwaysSingleDayData, -} from '../../common/api/hooks/headways'; -import { WidgetDiv } from '../../common/components/widgets/WidgetDiv'; -import { SingleChartWrapper } from '../../common/components/charts/SingleChartWrapper'; -import { AggregateChartWrapper } from '../../common/components/charts/AggregateChartWrapper'; -import { PageWrapper } from '../../common/layouts/PageWrapper'; -import { WidgetTitle } from '../dashboard/WidgetTitle'; -import { Layout } from '../../common/layouts/layoutTypes'; -import { HeadwaysHistogramWrapper } from './charts/HeadwaysHistogramWrapper'; - -export function HeadwaysDetails() { - const { - line, - query: { startDate, endDate, to, from }, - } = useDelimitatedRoute(); - - const fromStation = from ? getParentStationForStopId(from) : undefined; - const toStation = to ? getParentStationForStopId(to) : undefined; - const { fromStopIds } = stopIdsForStations(fromStation, toStation); - - const aggregate = Boolean(startDate && endDate); - const enabled = Boolean(fromStopIds && startDate); - const parameters: SingleDayAPIOptions | AggregateAPIOptions = aggregate - ? { - [AggregateAPIParams.stop]: fromStopIds, - [AggregateAPIParams.startDate]: startDate, - [AggregateAPIParams.endDate]: endDate, - } - : { - [SingleDayAPIParams.stop]: fromStopIds, - [SingleDayAPIParams.date]: startDate, - }; - - const headways = useHeadwaysSingleDayData(parameters, !aggregate && enabled); - const headwaysAggregate = useHeadwaysAggregateData(parameters, aggregate && enabled); - - const headwaysData = aggregate ? headwaysAggregate?.data?.by_date : headways?.data; - - return ( - - - - - - - - - {aggregate ? ( - - ) : ( - - )} - - {!aggregate && ( - - - - - - )} - - - ); -} - -HeadwaysDetails.Layout = Layout.Dashboard; diff --git a/modules/traveltimes/TravelTimesDetails.tsx b/modules/traveltimes/TravelTimesDetails.tsx deleted file mode 100644 index bf25768c1..000000000 --- a/modules/traveltimes/TravelTimesDetails.tsx +++ /dev/null @@ -1,107 +0,0 @@ -'use client'; - -import React from 'react'; -import type { AggregateAPIOptions, SingleDayAPIOptions } from '../../common/types/api'; -import { AggregateAPIParams, SingleDayAPIParams } from '../../common/types/api'; -import { - getLocationDetails, - getParentStationForStopId, - stopIdsForStations, -} from '../../common/utils/stations'; -import { useDelimitatedRoute } from '../../common/utils/router'; -import { TerminusNotice } from '../../common/components/notices/TerminusNotice'; -import { - useTravelTimesAggregateData, - useTravelTimesSingleDayData, -} from '../../common/api/hooks/traveltimes'; -import { WidgetDiv } from '../../common/components/widgets/WidgetDiv'; -import { SingleChartWrapper } from '../../common/components/charts/SingleChartWrapper'; -import { AggregateChartWrapper } from '../../common/components/charts/AggregateChartWrapper'; -import { PageWrapper } from '../../common/layouts/PageWrapper'; -import { ButtonGroup } from '../../common/components/general/ButtonGroup'; -import { WidgetTitle } from '../dashboard/WidgetTitle'; -import { Layout } from '../../common/layouts/layoutTypes'; - -export function TravelTimesDetails() { - const { - line, - query: { startDate, endDate, to, from }, - } = useDelimitatedRoute(); - - const fromStation = from ? getParentStationForStopId(from) : undefined; - const toStation = to ? getParentStationForStopId(to) : undefined; - const { fromStopIds, toStopIds } = stopIdsForStations(fromStation, toStation); - const location = getLocationDetails(fromStation, toStation); - - const aggregate = Boolean(startDate && endDate); - const enabled = Boolean(fromStopIds && toStopIds && startDate); - const parameters: SingleDayAPIOptions | AggregateAPIOptions = aggregate - ? { - [AggregateAPIParams.fromStop]: fromStopIds, - [AggregateAPIParams.toStop]: toStopIds, - [AggregateAPIParams.startDate]: startDate, - [AggregateAPIParams.endDate]: endDate, - } - : { - [SingleDayAPIParams.fromStop]: fromStopIds, - [SingleDayAPIParams.toStop]: toStopIds, - [SingleDayAPIParams.stop]: fromStopIds, - [SingleDayAPIParams.date]: startDate, - }; - - const travelTimes = useTravelTimesSingleDayData(parameters, !aggregate && enabled); - const travelTimesAggregate = useTravelTimesAggregateData(parameters, aggregate && enabled); - - const [peakTime, setPeakTime] = React.useState<'weekday' | 'weekend'>('weekday'); - - return ( - - - - {aggregate ? ( - - ) : ( - - )} - - {aggregate && ( - - - -
- -
-
- )} - -
- ); -} - -TravelTimesDetails.Layout = Layout.Dashboard; diff --git a/pages/[line]/trips/dwells.tsx b/pages/[line]/trips/dwells.tsx deleted file mode 100644 index 12c8a982c..000000000 --- a/pages/[line]/trips/dwells.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { ALL_LINE_PATHS } from '../../../common/types/lines'; -import { DwellsDetails } from '../../../modules/dwells/DwellsDetails'; - -export async function getStaticProps() { - return { props: {} }; -} - -export async function getStaticPaths() { - return { - paths: ALL_LINE_PATHS, - fallback: false, - }; -} - -export default DwellsDetails; diff --git a/pages/[line]/trips/headways.tsx b/pages/[line]/trips/headways.tsx deleted file mode 100644 index 838d0aeee..000000000 --- a/pages/[line]/trips/headways.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { ALL_LINE_PATHS, BUS_PATH } from '../../../common/types/lines'; -import { HeadwaysDetails } from '../../../modules/headways/HeadwaysDetails'; - -export async function getStaticProps() { - return { props: {} }; -} - -export async function getStaticPaths() { - return { - paths: [...ALL_LINE_PATHS, BUS_PATH], - fallback: false, - }; -} - -export default HeadwaysDetails; diff --git a/pages/[line]/trips/traveltimes.tsx b/pages/[line]/trips/traveltimes.tsx deleted file mode 100644 index f79cb23f7..000000000 --- a/pages/[line]/trips/traveltimes.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { ALL_LINE_PATHS, BUS_PATH } from '../../../common/types/lines'; -import { TravelTimesDetails } from '../../../modules/traveltimes/TravelTimesDetails'; - -export async function getStaticProps() { - return { props: {} }; -} - -export async function getStaticPaths() { - return { - paths: [...ALL_LINE_PATHS, BUS_PATH], - fallback: false, - }; -} - -export default TravelTimesDetails;