Skip to content

Commit 0e0be3d

Browse files
committed
feed submission migration
1 parent e94d462 commit 0e0be3d

14 files changed

Lines changed: 100 additions & 56 deletions

File tree

src/app/screens/FeedSubmission/index.tsx renamed to src/app/[locale]/contribute/FeedSubmission/FeedSubmission.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import * as React from 'react';
24
import { useSelector } from 'react-redux';
35
import {
@@ -9,11 +11,11 @@ import {
911
Typography,
1012
} from '@mui/material';
1113
import CheckIcon from '@mui/icons-material/Check';
12-
import { selectIsAuthenticated } from '../../store/profile-selectors';
14+
import { selectIsAuthenticated } from '../../../store/profile-selectors';
1315
import { useTranslations } from 'next-intl';
1416
import { useSearchParams } from 'next/navigation';
1517
import FeedSubmissionForm from './Form';
16-
import { ColoredContainer } from '../../styles/PageLayout.style';
18+
import { ColoredContainer } from '../../../styles/PageLayout.style';
1719

1820
function Component(): React.ReactElement {
1921
const t = useTranslations('feeds');

src/app/screens/FeedSubmission/Form/FirstStep.tsx renamed to src/app/[locale]/contribute/FeedSubmission/Form/FirstStep.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ import {
1818
useForm,
1919
useWatch,
2020
} from 'react-hook-form';
21-
import { type YesNoFormInput, type FeedSubmissionFormFormInput } from '.';
2221
import { useEffect } from 'react';
2322
import { useTranslations } from 'next-intl';
24-
import { isValidFeedLink } from '../../../services/feeds/utils';
23+
import { isValidFeedLink } from '../../../../services/feeds/utils';
2524
import FormLabelDescription from './components/FormLabelDescription';
25+
import {
26+
type FeedSubmissionFormFormInput,
27+
type YesNoFormInput,
28+
} from './types';
2629

2730
export interface FeedSubmissionFormFormInputFirstStep {
2831
isOfficialProducer: YesNoFormInput;

src/app/screens/FeedSubmission/Form/FourthStep.tsx renamed to src/app/[locale]/contribute/FeedSubmission/Form/FourthStep.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ import {
1414
useForm,
1515
useWatch,
1616
} from 'react-hook-form';
17-
import { type YesNoFormInput, type FeedSubmissionFormFormInput } from '.';
1817
import { useTranslations } from 'next-intl';
1918
import FormLabelDescription from './components/FormLabelDescription';
19+
import {
20+
type FeedSubmissionFormFormInput,
21+
type YesNoFormInput,
22+
} from './types';
2023

2124
export interface FeedSubmissionFormInputFourthStep {
2225
dataProducerEmail?: string;

src/app/screens/FeedSubmission/Form/SecondStep.tsx renamed to src/app/[locale]/contribute/FeedSubmission/Form/SecondStep.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import {
1010
FormHelperText,
1111
} from '@mui/material';
1212
import { Controller, type SubmitHandler, useForm } from 'react-hook-form';
13-
import { type FeedSubmissionFormFormInput } from '.';
1413
import { useTranslations } from 'next-intl';
1514
import { getCountryDataList } from 'countries-list';
1615
import { useState } from 'react';
1716
import FormLabelDescription from './components/FormLabelDescription';
17+
import { type FeedSubmissionFormFormInput } from './types';
1818

1919
export interface FeedSubmissionFormInputSecondStep {
2020
country: string;

src/app/screens/FeedSubmission/Form/SecondStepRealtime.tsx renamed to src/app/[locale]/contribute/FeedSubmission/Form/SecondStepRealtime.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import {
77
TextField,
88
} from '@mui/material';
99
import { type SubmitHandler, Controller, useForm } from 'react-hook-form';
10-
import { type AuthTypes, type FeedSubmissionFormFormInput } from '.';
1110
import { useEffect } from 'react';
1211
import { useTranslations } from 'next-intl';
13-
import { isValidFeedLink } from '../../../services/feeds/utils';
12+
import { isValidFeedLink } from '../../../../services/feeds/utils';
13+
import {
14+
type AuthTypes,
15+
type FeedSubmissionFormFormInput,
16+
} from './types';
1417

1518
export interface FeedSubmissionFormInputSecondStepRT {
1619
tripUpdates: string;

src/app/screens/FeedSubmission/Form/ThirdStep.tsx renamed to src/app/[locale]/contribute/FeedSubmission/Form/ThirdStep.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ import {
1414
useForm,
1515
useWatch,
1616
} from 'react-hook-form';
17-
import { type FeedSubmissionFormFormInput, type AuthTypes } from '.';
1817
import { useTranslations } from 'next-intl';
19-
import { isValidFeedLink } from '../../../services/feeds/utils';
18+
import { isValidFeedLink } from '../../../../services/feeds/utils';
2019
import FormLabelDescription from './components/FormLabelDescription';
20+
import {
21+
type AuthTypes,
22+
type FeedSubmissionFormFormInput,
23+
} from './types';
2124

2225
export interface FeedSubmissionFormInputThirdStep {
2326
authType: AuthTypes;

src/app/screens/FeedSubmission/Form/components/FormLabelDescription.tsx renamed to src/app/[locale]/contribute/FeedSubmission/Form/components/FormLabelDescription.tsx

File renamed without changes.

src/app/screens/FeedSubmission/Form/index.tsx renamed to src/app/[locale]/contribute/FeedSubmission/Form/index.tsx

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,12 @@ import {
1313
} from '@mui/material';
1414
import { useRouter, useSearchParams, usePathname } from 'next/navigation';
1515
import FormThirdStep from './ThirdStep';
16-
import { submitNewFeedForm } from '../../../services/feeds/add-feed-form-service';
16+
import { submitNewFeedForm } from '../../../../services/feeds/add-feed-form-service';
1717
import { useTranslations } from 'next-intl';
18-
19-
export type YesNoFormInput = 'yes' | 'no' | '';
20-
export type AuthTypes =
21-
| 'None - 0'
22-
| 'API key - 1'
23-
| 'HTTP header - 2'
24-
| 'choiceRequired';
25-
26-
export interface FeedSubmissionFormFormInput {
27-
isOfficialProducer: YesNoFormInput;
28-
isOfficialFeed: 'yes' | 'no' | 'unsure' | undefined;
29-
dataType: 'gtfs' | 'gtfs_rt';
30-
transitProviderName: string;
31-
feedLink?: string;
32-
oldFeedLink?: string;
33-
isUpdatingFeed?: YesNoFormInput;
34-
licensePath?: string;
35-
country?: string;
36-
region?: string;
37-
municipality?: string;
38-
tripUpdates?: string;
39-
vehiclePositions?: string;
40-
serviceAlerts?: string;
41-
oldTripUpdates?: string;
42-
oldVehiclePositions?: string;
43-
oldServiceAlerts?: string;
44-
gtfsRelatedScheduleLink?: string;
45-
name?: string;
46-
authType: AuthTypes;
47-
authSignupLink?: string;
48-
authParameterName?: string;
49-
dataProducerEmail: string;
50-
isInterestedInQualityAudit: YesNoFormInput;
51-
userInterviewEmail?: string;
52-
whatToolsUsedText?: string;
53-
hasLogoPermission: YesNoFormInput;
54-
unofficialDesc?: string; // Why was this feed created?
55-
updateFreq?: string; // How often is this feed updated?
56-
emptyLicenseUsage?: string; // Confirm usage if no license and official
57-
}
18+
import {
19+
type FeedSubmissionFormFormInput,
20+
type YesNoFormInput,
21+
} from './types';
5822

5923
const defaultFormValues: FeedSubmissionFormFormInput = {
6024
isOfficialProducer: '',
@@ -176,14 +140,20 @@ export default function FeedSubmissionForm(): React.ReactElement {
176140
const formStepSubmit = (
177141
partialFormData: Partial<FeedSubmissionFormFormInput>,
178142
): void => {
179-
setFormData((prevData) => ({ ...prevData, ...partialFormData }));
143+
setFormData((prevData: FeedSubmissionFormFormInput) => ({
144+
...prevData,
145+
...partialFormData,
146+
}));
180147
handleNext();
181148
};
182149

183150
const formStepBack = (
184151
partialFormData: Partial<FeedSubmissionFormFormInput>,
185152
): void => {
186-
setFormData((prevData) => ({ ...prevData, ...partialFormData }));
153+
setFormData((prevData: FeedSubmissionFormFormInput) => ({
154+
...prevData,
155+
...partialFormData,
156+
}));
187157
handleBack();
188158
};
189159

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../../../utils/feed-submission-types';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { type ReactElement } from 'react';
2+
import FeedSubmission from './FeedSubmission/FeedSubmission';
3+
import { ReduxGateWrapper } from '../../components/ReduxGateWrapper';
4+
5+
export default function ContributePage(): ReactElement {
6+
return (
7+
<ReduxGateWrapper>
8+
<FeedSubmission />
9+
</ReduxGateWrapper>
10+
);
11+
}

0 commit comments

Comments
 (0)