diff --git a/src/app/screens/FeedSubmission/index.tsx b/src/app/[locale]/contribute/FeedSubmission/FeedSubmission.tsx similarity index 95% rename from src/app/screens/FeedSubmission/index.tsx rename to src/app/[locale]/contribute/FeedSubmission/FeedSubmission.tsx index 398c64b0..700d822b 100644 --- a/src/app/screens/FeedSubmission/index.tsx +++ b/src/app/[locale]/contribute/FeedSubmission/FeedSubmission.tsx @@ -1,3 +1,5 @@ +'use client'; + import * as React from 'react'; import { useSelector } from 'react-redux'; import { @@ -9,11 +11,11 @@ import { Typography, } from '@mui/material'; import CheckIcon from '@mui/icons-material/Check'; -import { selectIsAuthenticated } from '../../store/profile-selectors'; +import { selectIsAuthenticated } from '../../../store/profile-selectors'; import { useTranslations } from 'next-intl'; import { useSearchParams } from 'next/navigation'; import FeedSubmissionForm from './Form'; -import { ColoredContainer } from '../../styles/PageLayout.style'; +import { ColoredContainer } from '../../../styles/PageLayout.style'; function Component(): React.ReactElement { const t = useTranslations('feeds'); diff --git a/src/app/screens/FeedSubmission/Form/FirstStep.tsx b/src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx similarity index 98% rename from src/app/screens/FeedSubmission/Form/FirstStep.tsx rename to src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx index 0a360647..c46c7687 100644 --- a/src/app/screens/FeedSubmission/Form/FirstStep.tsx +++ b/src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx @@ -18,11 +18,11 @@ import { useForm, useWatch, } from 'react-hook-form'; -import { type YesNoFormInput, type FeedSubmissionFormFormInput } from '.'; import { useEffect } from 'react'; import { useTranslations } from 'next-intl'; -import { isValidFeedLink } from '../../../services/feeds/utils'; +import { isValidFeedLink } from '../../../../services/feeds/utils'; import FormLabelDescription from './components/FormLabelDescription'; +import { type FeedSubmissionFormFormInput, type YesNoFormInput } from './types'; export interface FeedSubmissionFormFormInputFirstStep { isOfficialProducer: YesNoFormInput; diff --git a/src/app/screens/FeedSubmission/Form/FourthStep.tsx b/src/app/[locale]/contribute/FeedSubmission/Form/FourthStep.tsx similarity index 98% rename from src/app/screens/FeedSubmission/Form/FourthStep.tsx rename to src/app/[locale]/contribute/FeedSubmission/Form/FourthStep.tsx index a207fed4..cc6d784a 100644 --- a/src/app/screens/FeedSubmission/Form/FourthStep.tsx +++ b/src/app/[locale]/contribute/FeedSubmission/Form/FourthStep.tsx @@ -14,9 +14,9 @@ import { useForm, useWatch, } from 'react-hook-form'; -import { type YesNoFormInput, type FeedSubmissionFormFormInput } from '.'; import { useTranslations } from 'next-intl'; import FormLabelDescription from './components/FormLabelDescription'; +import { type FeedSubmissionFormFormInput, type YesNoFormInput } from './types'; export interface FeedSubmissionFormInputFourthStep { dataProducerEmail?: string; diff --git a/src/app/screens/FeedSubmission/Form/SecondStep.tsx b/src/app/[locale]/contribute/FeedSubmission/Form/SecondStep.tsx similarity index 99% rename from src/app/screens/FeedSubmission/Form/SecondStep.tsx rename to src/app/[locale]/contribute/FeedSubmission/Form/SecondStep.tsx index 1e13c4ef..481b91bd 100644 --- a/src/app/screens/FeedSubmission/Form/SecondStep.tsx +++ b/src/app/[locale]/contribute/FeedSubmission/Form/SecondStep.tsx @@ -10,11 +10,11 @@ import { FormHelperText, } from '@mui/material'; import { Controller, type SubmitHandler, useForm } from 'react-hook-form'; -import { type FeedSubmissionFormFormInput } from '.'; import { useTranslations } from 'next-intl'; import { getCountryDataList } from 'countries-list'; import { useState } from 'react'; import FormLabelDescription from './components/FormLabelDescription'; +import { type FeedSubmissionFormFormInput } from './types'; export interface FeedSubmissionFormInputSecondStep { country: string; diff --git a/src/app/screens/FeedSubmission/Form/SecondStepRealtime.tsx b/src/app/[locale]/contribute/FeedSubmission/Form/SecondStepRealtime.tsx similarity index 99% rename from src/app/screens/FeedSubmission/Form/SecondStepRealtime.tsx rename to src/app/[locale]/contribute/FeedSubmission/Form/SecondStepRealtime.tsx index 82915217..4a37854a 100644 --- a/src/app/screens/FeedSubmission/Form/SecondStepRealtime.tsx +++ b/src/app/[locale]/contribute/FeedSubmission/Form/SecondStepRealtime.tsx @@ -7,10 +7,10 @@ import { TextField, } from '@mui/material'; import { type SubmitHandler, Controller, useForm } from 'react-hook-form'; -import { type AuthTypes, type FeedSubmissionFormFormInput } from '.'; import { useEffect } from 'react'; import { useTranslations } from 'next-intl'; -import { isValidFeedLink } from '../../../services/feeds/utils'; +import { isValidFeedLink } from '../../../../services/feeds/utils'; +import { type AuthTypes, type FeedSubmissionFormFormInput } from './types'; export interface FeedSubmissionFormInputSecondStepRT { tripUpdates: string; diff --git a/src/app/screens/FeedSubmission/Form/ThirdStep.tsx b/src/app/[locale]/contribute/FeedSubmission/Form/ThirdStep.tsx similarity index 98% rename from src/app/screens/FeedSubmission/Form/ThirdStep.tsx rename to src/app/[locale]/contribute/FeedSubmission/Form/ThirdStep.tsx index 7aeda6d0..e5eb485d 100644 --- a/src/app/screens/FeedSubmission/Form/ThirdStep.tsx +++ b/src/app/[locale]/contribute/FeedSubmission/Form/ThirdStep.tsx @@ -14,10 +14,10 @@ import { useForm, useWatch, } from 'react-hook-form'; -import { type FeedSubmissionFormFormInput, type AuthTypes } from '.'; import { useTranslations } from 'next-intl'; -import { isValidFeedLink } from '../../../services/feeds/utils'; +import { isValidFeedLink } from '../../../../services/feeds/utils'; import FormLabelDescription from './components/FormLabelDescription'; +import { type AuthTypes, type FeedSubmissionFormFormInput } from './types'; export interface FeedSubmissionFormInputThirdStep { authType: AuthTypes; diff --git a/src/app/screens/FeedSubmission/Form/components/FormLabelDescription.tsx b/src/app/[locale]/contribute/FeedSubmission/Form/components/FormLabelDescription.tsx similarity index 100% rename from src/app/screens/FeedSubmission/Form/components/FormLabelDescription.tsx rename to src/app/[locale]/contribute/FeedSubmission/Form/components/FormLabelDescription.tsx diff --git a/src/app/screens/FeedSubmission/Form/index.tsx b/src/app/[locale]/contribute/FeedSubmission/Form/index.tsx similarity index 82% rename from src/app/screens/FeedSubmission/Form/index.tsx rename to src/app/[locale]/contribute/FeedSubmission/Form/index.tsx index 9fc8cfd2..6993a4a1 100644 --- a/src/app/screens/FeedSubmission/Form/index.tsx +++ b/src/app/[locale]/contribute/FeedSubmission/Form/index.tsx @@ -13,48 +13,9 @@ import { } from '@mui/material'; import { useRouter, useSearchParams, usePathname } from 'next/navigation'; import FormThirdStep from './ThirdStep'; -import { submitNewFeedForm } from '../../../services/feeds/add-feed-form-service'; +import { submitNewFeedForm } from '../../../../services/feeds/add-feed-form-service'; import { useTranslations } from 'next-intl'; - -export type YesNoFormInput = 'yes' | 'no' | ''; -export type AuthTypes = - | 'None - 0' - | 'API key - 1' - | 'HTTP header - 2' - | 'choiceRequired'; - -export interface FeedSubmissionFormFormInput { - isOfficialProducer: YesNoFormInput; - isOfficialFeed: 'yes' | 'no' | 'unsure' | undefined; - dataType: 'gtfs' | 'gtfs_rt'; - transitProviderName: string; - feedLink?: string; - oldFeedLink?: string; - isUpdatingFeed?: YesNoFormInput; - licensePath?: string; - country?: string; - region?: string; - municipality?: string; - tripUpdates?: string; - vehiclePositions?: string; - serviceAlerts?: string; - oldTripUpdates?: string; - oldVehiclePositions?: string; - oldServiceAlerts?: string; - gtfsRelatedScheduleLink?: string; - name?: string; - authType: AuthTypes; - authSignupLink?: string; - authParameterName?: string; - dataProducerEmail: string; - isInterestedInQualityAudit: YesNoFormInput; - userInterviewEmail?: string; - whatToolsUsedText?: string; - hasLogoPermission: YesNoFormInput; - unofficialDesc?: string; // Why was this feed created? - updateFreq?: string; // How often is this feed updated? - emptyLicenseUsage?: string; // Confirm usage if no license and official -} +import { type FeedSubmissionFormFormInput, type YesNoFormInput } from './types'; const defaultFormValues: FeedSubmissionFormFormInput = { isOfficialProducer: '', @@ -176,14 +137,20 @@ export default function FeedSubmissionForm(): React.ReactElement { const formStepSubmit = ( partialFormData: Partial, ): void => { - setFormData((prevData) => ({ ...prevData, ...partialFormData })); + setFormData((prevData: FeedSubmissionFormFormInput) => ({ + ...prevData, + ...partialFormData, + })); handleNext(); }; const formStepBack = ( partialFormData: Partial, ): void => { - setFormData((prevData) => ({ ...prevData, ...partialFormData })); + setFormData((prevData: FeedSubmissionFormFormInput) => ({ + ...prevData, + ...partialFormData, + })); handleBack(); }; diff --git a/src/app/[locale]/contribute/FeedSubmission/Form/types.ts b/src/app/[locale]/contribute/FeedSubmission/Form/types.ts new file mode 100644 index 00000000..beb8f801 --- /dev/null +++ b/src/app/[locale]/contribute/FeedSubmission/Form/types.ts @@ -0,0 +1 @@ +export * from '../../../../utils/feed-submission-types'; diff --git a/src/app/[locale]/contribute/page.tsx b/src/app/[locale]/contribute/page.tsx new file mode 100644 index 00000000..5a872e72 --- /dev/null +++ b/src/app/[locale]/contribute/page.tsx @@ -0,0 +1,11 @@ +import { type ReactElement } from 'react'; +import FeedSubmission from './FeedSubmission/FeedSubmission'; +import { ReduxGateWrapper } from '../../components/ReduxGateWrapper'; + +export default function ContributePage(): ReactElement { + return ( + + + + ); +} diff --git a/src/app/[locale]/contribute/submitted/page.tsx b/src/app/[locale]/contribute/submitted/page.tsx new file mode 100644 index 00000000..9dc32315 --- /dev/null +++ b/src/app/[locale]/contribute/submitted/page.tsx @@ -0,0 +1,6 @@ +import { type ReactElement } from 'react'; +import FeedSubmitted from '../../../screens/FeedSubmitted'; + +export default function ContributeSubmittedPage(): ReactElement { + return ; +} diff --git a/src/app/[locale]/forgot-password/page.tsx b/src/app/[locale]/forgot-password/page.tsx new file mode 100644 index 00000000..67ab605e --- /dev/null +++ b/src/app/[locale]/forgot-password/page.tsx @@ -0,0 +1,11 @@ +import { type ReactElement } from 'react'; +import ForgotPassword from '../../screens/ForgotPassword'; +import { ReduxGateWrapper } from '../../components/ReduxGateWrapper'; + +export default function ForgotPasswordPage(): ReactElement { + return ( + + + + ); +} diff --git a/src/app/screens/Analytics/GBFSFeedAnalytics/DetailPanel.tsx b/src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/DetailPanel.tsx similarity index 100% rename from src/app/screens/Analytics/GBFSFeedAnalytics/DetailPanel.tsx rename to src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/DetailPanel.tsx diff --git a/src/app/screens/Analytics/GBFSFeedAnalytics/index.tsx b/src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/GBFSFeedAnalytics.tsx similarity index 96% rename from src/app/screens/Analytics/GBFSFeedAnalytics/index.tsx rename to src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/GBFSFeedAnalytics.tsx index 814fe7e6..2f0d6cad 100644 --- a/src/app/screens/Analytics/GBFSFeedAnalytics/index.tsx +++ b/src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/GBFSFeedAnalytics.tsx @@ -1,3 +1,5 @@ +'use client'; + import React, { useMemo } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import FormHelperText from '@mui/material/FormHelperText'; @@ -29,18 +31,18 @@ import { useSearchParams } from 'next/navigation'; import { fetchAvailableFilesStart, selectFile, -} from '../../../store/gbfs-analytics-reducer'; +} from '../../../../../store/gbfs-analytics-reducer'; import { selectGBFSFeedMetrics, selectGBFSAnalyticsStatus, selectGBFSAnalyticsError, -} from '../../../store/gbfs-analytics-selector'; +} from '../../../../../store/gbfs-analytics-selector'; import { useTableColumns } from './GBFSFeedAnalyticsTable'; -import { type RootState } from '../../../store/store'; +import { type RootState } from '../../../../../store/store'; import { type AnalyticsFile, type GBFSFeedMetrics } from '../types'; -import { useRemoteConfig } from '../../../context/RemoteConfigProvider'; +import { useRemoteConfig } from '../../../../../context/RemoteConfigProvider'; import DetailPanel from './DetailPanel'; -import { setAnalyticsBucketEndpoint } from '../utils'; +import { setAnalyticsBucketEndpoint } from '../../../../../utils/metricsUtils'; export default function GBFSFeedAnalytics(): React.ReactElement { const searchParams = useSearchParams(); diff --git a/src/app/screens/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx b/src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx similarity index 100% rename from src/app/screens/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx rename to src/app/[locale]/metrics/_components/Analytics/GBFSFeedAnalytics/GBFSFeedAnalyticsTable.tsx diff --git a/src/app/screens/Analytics/GBFSNoticeAnalytics/index.tsx b/src/app/[locale]/metrics/_components/Analytics/GBFSNoticeAnalytics/GBFSNoticeAnalytics.tsx similarity index 98% rename from src/app/screens/Analytics/GBFSNoticeAnalytics/index.tsx rename to src/app/[locale]/metrics/_components/Analytics/GBFSNoticeAnalytics/GBFSNoticeAnalytics.tsx index 28c4ebae..1aefd028 100644 --- a/src/app/screens/Analytics/GBFSNoticeAnalytics/index.tsx +++ b/src/app/[locale]/metrics/_components/Analytics/GBFSNoticeAnalytics/GBFSNoticeAnalytics.tsx @@ -1,3 +1,5 @@ +'use client'; + import { useState, useEffect, useMemo } from 'react'; import { useSearchParams, useRouter } from 'next/navigation'; @@ -24,7 +26,7 @@ import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import { InfoOutlined, ListAltOutlined } from '@mui/icons-material'; import { type GBFSNoticeMetrics } from '../types'; -import { useRemoteConfig } from '../../../context/RemoteConfigProvider'; +import { useRemoteConfig } from '../../../../../context/RemoteConfigProvider'; export default function GBFSNoticeAnalytics(): React.ReactElement { const router = useRouter(); diff --git a/src/app/screens/Analytics/GBFSVersionAnalytics/index.tsx b/src/app/[locale]/metrics/_components/Analytics/GBFSVersionAnalytics/GBFSVersionAnalytics.tsx similarity index 97% rename from src/app/screens/Analytics/GBFSVersionAnalytics/index.tsx rename to src/app/[locale]/metrics/_components/Analytics/GBFSVersionAnalytics/GBFSVersionAnalytics.tsx index 438ed5f3..2ec10c29 100644 --- a/src/app/screens/Analytics/GBFSVersionAnalytics/index.tsx +++ b/src/app/[locale]/metrics/_components/Analytics/GBFSVersionAnalytics/GBFSVersionAnalytics.tsx @@ -1,3 +1,5 @@ +'use client'; + import { useState, useEffect, useMemo } from 'react'; import { useSearchParams, useRouter } from 'next/navigation'; @@ -31,9 +33,9 @@ import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import { InfoOutlined, ListAltOutlined } from '@mui/icons-material'; import { type GBFSVersionMetrics } from '../types'; -import { useRemoteConfig } from '../../../context/RemoteConfigProvider'; +import { useRemoteConfig } from '../../../../../context/RemoteConfigProvider'; import MUITooltip from '@mui/material/Tooltip'; -import { GBFS_LINK } from '../../../constants/Navigation'; +import { GBFS_LINK } from '../../../../../constants/Navigation'; export default function GBFSVersionAnalytics(): React.ReactElement { const router = useRouter(); diff --git a/src/app/screens/Analytics/GTFSFeatureAnalytics/index.tsx b/src/app/[locale]/metrics/_components/Analytics/GTFSFeatureAnalytics/GTFSFeatureAnalytics.tsx similarity index 97% rename from src/app/screens/Analytics/GTFSFeatureAnalytics/index.tsx rename to src/app/[locale]/metrics/_components/Analytics/GTFSFeatureAnalytics/GTFSFeatureAnalytics.tsx index 4ef16a8f..0e4260f3 100644 --- a/src/app/screens/Analytics/GTFSFeatureAnalytics/index.tsx +++ b/src/app/[locale]/metrics/_components/Analytics/GTFSFeatureAnalytics/GTFSFeatureAnalytics.tsx @@ -1,3 +1,5 @@ +'use client'; + import { useState, useEffect, useMemo } from 'react'; import { useSearchParams, useRouter } from 'next/navigation'; import { @@ -29,13 +31,13 @@ import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import { InfoOutlined, ListAltOutlined } from '@mui/icons-material'; import { type FeatureMetrics } from '../types'; -import { useRemoteConfig } from '../../../context/RemoteConfigProvider'; +import { useRemoteConfig } from '../../../../../context/RemoteConfigProvider'; import MUITooltip from '@mui/material/Tooltip'; -import { GTFS_ORG_LINK } from '../../../constants/Navigation'; +import { GTFS_ORG_LINK } from '../../../../../constants/Navigation'; import { DATASET_FEATURES, getComponentDecorators, -} from '../../../utils/consts'; +} from '../../../../../utils/consts'; export default function GTFSFeatureAnalytics(): React.ReactElement { const router = useRouter(); diff --git a/src/app/screens/Analytics/GTFSFeedAnalytics/DetailPanel.tsx b/src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/DetailPanel.tsx similarity index 98% rename from src/app/screens/Analytics/GTFSFeedAnalytics/DetailPanel.tsx rename to src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/DetailPanel.tsx index c9b0e094..58a19144 100644 --- a/src/app/screens/Analytics/GTFSFeedAnalytics/DetailPanel.tsx +++ b/src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/DetailPanel.tsx @@ -22,7 +22,7 @@ import { CalendarToday, } from '@mui/icons-material'; import { type GTFSFeedMetrics } from '../types'; -import { getLocationName } from '../../../services/feeds/utils'; +import { getLocationName } from '../../../../../services/feeds/utils'; interface RowData { original: GTFSFeedMetrics; diff --git a/src/app/screens/Analytics/GTFSFeedAnalytics/index.tsx b/src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalytics.tsx similarity index 95% rename from src/app/screens/Analytics/GTFSFeedAnalytics/index.tsx rename to src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalytics.tsx index 37bc6702..f4d0c2f8 100644 --- a/src/app/screens/Analytics/GTFSFeedAnalytics/index.tsx +++ b/src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalytics.tsx @@ -1,3 +1,5 @@ +'use client'; + import React, { useMemo } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { @@ -23,23 +25,20 @@ import { useSearchParams } from 'next/navigation'; import { fetchAvailableFilesStart, selectFile, -} from '../../../store/gtfs-analytics-reducer'; +} from '../../../../../store/gtfs-analytics-reducer'; import { selectGTFSFeedMetrics, selectGTFSAnalyticsStatus, selectGTFSAnalyticsError, -} from '../../../store/gtfs-analytics-selector'; +} from '../../../../../store/gtfs-analytics-selector'; import { useTableColumns } from './GTFSFeedAnalyticsTable'; import DetailPanel from './DetailPanel'; -import { type RootState } from '../../../store/store'; +import { type RootState } from '../../../../../store/store'; import { type AnalyticsFile, type GTFSFeedMetrics } from '../types'; -import { useRemoteConfig } from '../../../context/RemoteConfigProvider'; +import { useRemoteConfig } from '../../../../../context/RemoteConfigProvider'; import DownloadIcon from '@mui/icons-material/Download'; import { download, generateCsv, mkConfig } from 'export-to-csv'; - -let globalAnalyticsBucketEndpoint: string | undefined; -export const getAnalyticsBucketEndpoint = (): string | undefined => - globalAnalyticsBucketEndpoint; +import { setAnalyticsBucketEndpoint } from '../../../../../utils/metricsUtils'; export default function GTFSFeedAnalytics(): React.ReactElement { const searchParams = useSearchParams(); @@ -79,7 +78,7 @@ export default function GTFSFeedAnalytics(): React.ReactElement { }; React.useEffect(() => { - globalAnalyticsBucketEndpoint = config.gtfsMetricsBucketEndpoint; + setAnalyticsBucketEndpoint(config.gtfsMetricsBucketEndpoint); dispatch(fetchAvailableFilesStart()); }, [dispatch, config.gtfsMetricsBucketEndpoint]); diff --git a/src/app/screens/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx b/src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx similarity index 99% rename from src/app/screens/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx rename to src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx index 018f9c30..44bb0890 100644 --- a/src/app/screens/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx +++ b/src/app/[locale]/metrics/_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalyticsTable.tsx @@ -8,7 +8,7 @@ import { OpenInNew } from '@mui/icons-material'; import { getComponentDecorators, groupFeaturesByComponent, -} from '../../../utils/consts'; +} from '../../../../../utils/consts'; /** * Returns the columns for the feed analytics table. diff --git a/src/app/screens/Analytics/GTFSNoticeAnalytics/index.tsx b/src/app/[locale]/metrics/_components/Analytics/GTFSNoticeAnalytics/GTFSNoticeAnalytics.tsx similarity index 97% rename from src/app/screens/Analytics/GTFSNoticeAnalytics/index.tsx rename to src/app/[locale]/metrics/_components/Analytics/GTFSNoticeAnalytics/GTFSNoticeAnalytics.tsx index 43aa064f..5c003a8a 100644 --- a/src/app/screens/Analytics/GTFSNoticeAnalytics/index.tsx +++ b/src/app/[locale]/metrics/_components/Analytics/GTFSNoticeAnalytics/GTFSNoticeAnalytics.tsx @@ -1,3 +1,5 @@ +'use client'; + import { useState, useEffect, useMemo } from 'react'; import { useSearchParams, useRouter } from 'next/navigation'; @@ -32,8 +34,8 @@ import * as React from 'react'; import { useTheme } from '@mui/material/styles'; import { InfoOutlined, ListAltOutlined } from '@mui/icons-material'; import { type NoticeMetrics } from '../types'; -import { WEB_VALIDATOR_LINK } from '../../../constants/Navigation'; -import { useRemoteConfig } from '../../../context/RemoteConfigProvider'; +import { WEB_VALIDATOR_LINK } from '../../../../../constants/Navigation'; +import { useRemoteConfig } from '../../../../../context/RemoteConfigProvider'; export default function GTFSNoticeAnalytics(): React.ReactElement { const router = useRouter(); diff --git a/src/app/screens/Analytics/analytics.css b/src/app/[locale]/metrics/_components/Analytics/analytics.css similarity index 100% rename from src/app/screens/Analytics/analytics.css rename to src/app/[locale]/metrics/_components/Analytics/analytics.css diff --git a/src/app/[locale]/metrics/_components/Analytics/types.ts b/src/app/[locale]/metrics/_components/Analytics/types.ts new file mode 100644 index 00000000..bddb0caf --- /dev/null +++ b/src/app/[locale]/metrics/_components/Analytics/types.ts @@ -0,0 +1 @@ +export * from '../../../../utils/analytics-types'; diff --git a/src/app/[locale]/metrics/gbfs/feeds/page.tsx b/src/app/[locale]/metrics/gbfs/feeds/page.tsx new file mode 100644 index 00000000..b96a3363 --- /dev/null +++ b/src/app/[locale]/metrics/gbfs/feeds/page.tsx @@ -0,0 +1,6 @@ +import { type ReactElement } from 'react'; +import GBFSFeedAnalytics from '../../_components/Analytics/GBFSFeedAnalytics/GBFSFeedAnalytics'; + +export default function GBFSFeedsMetricsPage(): ReactElement { + return ; +} diff --git a/src/app/[locale]/metrics/gbfs/notices/page.tsx b/src/app/[locale]/metrics/gbfs/notices/page.tsx new file mode 100644 index 00000000..16d28f39 --- /dev/null +++ b/src/app/[locale]/metrics/gbfs/notices/page.tsx @@ -0,0 +1,6 @@ +import { type ReactElement } from 'react'; +import GBFSNoticeAnalytics from '../../_components/Analytics/GBFSNoticeAnalytics/GBFSNoticeAnalytics'; + +export default function GBFSNoticesMetricsPage(): ReactElement { + return ; +} diff --git a/src/app/[locale]/metrics/gbfs/versions/page.tsx b/src/app/[locale]/metrics/gbfs/versions/page.tsx new file mode 100644 index 00000000..eb1556a2 --- /dev/null +++ b/src/app/[locale]/metrics/gbfs/versions/page.tsx @@ -0,0 +1,6 @@ +import { type ReactElement } from 'react'; +import GBFSVersionAnalytics from '../../_components/Analytics/GBFSVersionAnalytics/GBFSVersionAnalytics'; + +export default function GBFSVersionsMetricsPage(): ReactElement { + return ; +} diff --git a/src/app/[locale]/metrics/gtfs/features/page.tsx b/src/app/[locale]/metrics/gtfs/features/page.tsx new file mode 100644 index 00000000..dd02c5bf --- /dev/null +++ b/src/app/[locale]/metrics/gtfs/features/page.tsx @@ -0,0 +1,6 @@ +import { type ReactElement } from 'react'; +import GTFSFeatureAnalytics from '../../_components/Analytics/GTFSFeatureAnalytics/GTFSFeatureAnalytics'; + +export default function GTFSFeaturesMetricsPage(): ReactElement { + return ; +} diff --git a/src/app/[locale]/metrics/gtfs/feeds/page.tsx b/src/app/[locale]/metrics/gtfs/feeds/page.tsx new file mode 100644 index 00000000..cc9dcc9e --- /dev/null +++ b/src/app/[locale]/metrics/gtfs/feeds/page.tsx @@ -0,0 +1,6 @@ +import { type ReactElement } from 'react'; +import GTFSFeedAnalytics from '../../_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalytics'; + +export default function GTFSFeedsMetricsPage(): ReactElement { + return ; +} diff --git a/src/app/[locale]/metrics/gtfs/notices/page.tsx b/src/app/[locale]/metrics/gtfs/notices/page.tsx new file mode 100644 index 00000000..a9e8aa85 --- /dev/null +++ b/src/app/[locale]/metrics/gtfs/notices/page.tsx @@ -0,0 +1,6 @@ +import { type ReactElement } from 'react'; +import GTFSNoticeAnalytics from '../../_components/Analytics/GTFSNoticeAnalytics/GTFSNoticeAnalytics'; + +export default function GTFSNoticesMetricsPage(): ReactElement { + return ; +} diff --git a/src/app/[locale]/metrics/gtfs/page.tsx b/src/app/[locale]/metrics/gtfs/page.tsx new file mode 100644 index 00000000..3a3b5a9a --- /dev/null +++ b/src/app/[locale]/metrics/gtfs/page.tsx @@ -0,0 +1,6 @@ +import { type ReactElement } from 'react'; +import GTFSFeedAnalytics from '../_components/Analytics/GTFSFeedAnalytics/GTFSFeedAnalytics'; + +export default function GTFSMetricsPage(): ReactElement { + return ; +} diff --git a/src/app/[locale]/metrics/layout.tsx b/src/app/[locale]/metrics/layout.tsx new file mode 100644 index 00000000..16e72512 --- /dev/null +++ b/src/app/[locale]/metrics/layout.tsx @@ -0,0 +1,10 @@ +import { type ReactElement } from 'react'; +import { ReduxGateWrapper } from '../../components/ReduxGateWrapper'; + +export default function MetricsLayout({ + children, +}: { + children: React.ReactNode; +}): ReactElement { + return {children}; +} diff --git a/src/app/router/Router.tsx b/src/app/router/Router.tsx index dc277a77..1a12816b 100644 --- a/src/app/router/Router.tsx +++ b/src/app/router/Router.tsx @@ -1,34 +1,5 @@ -import React from 'react'; -import { Routes, Route } from 'react-router-dom'; -import ForgotPassword from '../screens/ForgotPassword'; -import FeedSubmission from '../screens/FeedSubmission'; -import FeedSubmitted from '../screens/FeedSubmitted'; -import GTFSFeedAnalytics from '../screens/Analytics/GTFSFeedAnalytics'; -import GTFSNoticeAnalytics from '../screens/Analytics/GTFSNoticeAnalytics'; -import GTFSFeatureAnalytics from '../screens/Analytics/GTFSFeatureAnalytics'; -import GBFSFeedAnalytics from '../screens/Analytics/GBFSFeedAnalytics'; -import GBFSNoticeAnalytics from '../screens/Analytics/GBFSNoticeAnalytics'; -import GBFSVersionAnalytics from '../screens/Analytics/GBFSVersionAnalytics'; +import type React from 'react'; -export const AppRouter: React.FC = () => { - return ( - - } /> - } /> - } /> - - } /> - } /> - } /> - } /> - - - } /> - } /> - } /> - - - ); -}; +export const AppRouter: React.FC = () => null; export default AppRouter; diff --git a/src/app/screens/FeedSubmitted.tsx b/src/app/screens/FeedSubmitted.tsx index 1286c04a..6cfa7427 100644 --- a/src/app/screens/FeedSubmitted.tsx +++ b/src/app/screens/FeedSubmitted.tsx @@ -1,17 +1,11 @@ -import { - Typography, - Box, - Container, - CssBaseline, - useTheme, - Button, -} from '@mui/material'; +'use client'; + +import { Typography, Box, Container, useTheme, Button } from '@mui/material'; export default function FeedSubmitted(): React.ReactElement { const theme = useTheme(); return ( - diff --git a/src/app/store/gtfs-analytics-reducer.ts b/src/app/store/gtfs-analytics-reducer.ts index 259ee962..3a9d6897 100644 --- a/src/app/store/gtfs-analytics-reducer.ts +++ b/src/app/store/gtfs-analytics-reducer.ts @@ -4,7 +4,7 @@ import { type FeatureMetrics, type GTFSFeedMetrics, type AnalyticsFile, -} from '../screens/Analytics/types'; +} from '../utils/analytics-types'; interface GTFSAnalyticsState { feedMetrics: GTFSFeedMetrics[]; diff --git a/src/app/store/gtfs-analytics-selector.ts b/src/app/store/gtfs-analytics-selector.ts index a6cd6dad..a0ad3e75 100644 --- a/src/app/store/gtfs-analytics-selector.ts +++ b/src/app/store/gtfs-analytics-selector.ts @@ -1,5 +1,5 @@ import { type RootState } from './store'; -import { type GTFSFeedMetrics } from '../screens/Analytics/types'; +import { type GTFSFeedMetrics } from '../utils/analytics-types'; export const selectGTFSFeedMetrics = (state: RootState): GTFSFeedMetrics[] => state.gtfsAnalytics.feedMetrics; diff --git a/src/app/store/saga/gbfs-analytics-saga.ts b/src/app/store/saga/gbfs-analytics-saga.ts index 1a995a40..d64567ce 100644 --- a/src/app/store/saga/gbfs-analytics-saga.ts +++ b/src/app/store/saga/gbfs-analytics-saga.ts @@ -11,9 +11,9 @@ import { type AnalyticsFile, type GBFSFeedMetrics, type GBFSMetrics, -} from '../../screens/Analytics/types'; +} from '../../utils/analytics-types'; import { getLocationName } from '../../services/feeds/utils'; -import { getAnalyticsBucketEndpoint } from '../../screens/Analytics/utils'; +import { getAnalyticsBucketEndpoint } from '../../utils/metricsUtils'; function* fetchFeedMetricsSaga( action: ReturnType, diff --git a/src/app/store/saga/gtfs-analytics-saga.ts b/src/app/store/saga/gtfs-analytics-saga.ts index 7c6803ad..f1e1d7f3 100644 --- a/src/app/store/saga/gtfs-analytics-saga.ts +++ b/src/app/store/saga/gtfs-analytics-saga.ts @@ -11,9 +11,9 @@ import { type AnalyticsFile, type GTFSFeedMetrics, type GTFSMetrics, -} from '../../screens/Analytics/types'; +} from '../../utils/analytics-types'; import { getLocationName } from '../../services/feeds/utils'; -import { getAnalyticsBucketEndpoint } from '../../screens/Analytics/GTFSFeedAnalytics'; +import { getAnalyticsBucketEndpoint } from '../../utils/metricsUtils'; function* fetchFeedMetricsSaga( action: ReturnType, diff --git a/src/app/screens/Analytics/types.ts b/src/app/utils/analytics-types.ts similarity index 92% rename from src/app/screens/Analytics/types.ts rename to src/app/utils/analytics-types.ts index 0c6cc92d..4ad4cb68 100644 --- a/src/app/screens/Analytics/types.ts +++ b/src/app/utils/analytics-types.ts @@ -1,4 +1,4 @@ -import { type EntityLocations } from '../../services/feeds/utils'; +import { type EntityLocations } from '../services/feeds/utils'; export interface Notices { errors: string[]; @@ -40,7 +40,7 @@ export interface FeatureMetrics { computed_on: Date[]; feeds_count: number[]; latest_feed_count: number; - feature_group?: string; // Add a property to handle feature grouping + feature_group?: string; feature_sub_group?: string; } diff --git a/src/app/utils/feed-submission-types.ts b/src/app/utils/feed-submission-types.ts new file mode 100644 index 00000000..e172a343 --- /dev/null +++ b/src/app/utils/feed-submission-types.ts @@ -0,0 +1,40 @@ +export type YesNoFormInput = 'yes' | 'no' | ''; + +export type AuthTypes = + | 'None - 0' + | 'API key - 1' + | 'HTTP header - 2' + | 'choiceRequired'; + +export interface FeedSubmissionFormFormInput { + isOfficialProducer: YesNoFormInput; + isOfficialFeed: 'yes' | 'no' | 'unsure' | undefined; + dataType: 'gtfs' | 'gtfs_rt'; + transitProviderName: string; + feedLink?: string; + oldFeedLink?: string; + isUpdatingFeed?: YesNoFormInput; + licensePath?: string; + country?: string; + region?: string; + municipality?: string; + tripUpdates?: string; + vehiclePositions?: string; + serviceAlerts?: string; + oldTripUpdates?: string; + oldVehiclePositions?: string; + oldServiceAlerts?: string; + gtfsRelatedScheduleLink?: string; + name?: string; + authType: AuthTypes; + authSignupLink?: string; + authParameterName?: string; + dataProducerEmail: string; + isInterestedInQualityAudit: YesNoFormInput; + userInterviewEmail?: string; + whatToolsUsedText?: string; + hasLogoPermission: YesNoFormInput; + unofficialDesc?: string; + updateFreq?: string; + emptyLicenseUsage?: string; +} diff --git a/src/app/screens/Analytics/utils.ts b/src/app/utils/metricsUtils.ts similarity index 84% rename from src/app/screens/Analytics/utils.ts rename to src/app/utils/metricsUtils.ts index 58a8888d..2f374ab6 100644 --- a/src/app/screens/Analytics/utils.ts +++ b/src/app/utils/metricsUtils.ts @@ -1,5 +1,5 @@ /** - * Global analytics bucket endpoint storage and access + * Global analytics bucket endpoint storage and access. */ let globalAnalyticsBucketEndpoint: string | undefined;