Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front: fix typing of TrainScheduleImportConfig.{from,to} #9814

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions front/src/applications/operationalStudies/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,22 @@ export type ImportedTrainSchedule = {
transilienName?: string;
};

export type ImportStation = {
trigram?: string;
name?: string;
yardname?: string;
town?: string;
department?: string;
region?: string;
uic?: number;
linename?: string;
pk?: string;
linecode?: string;
};

export type TrainScheduleImportConfig = {
from: string;
to: string;
from: ImportStation;
to: ImportStation;
date: string;
startTime: string;
endTime: string;
Expand Down
14 changes: 1 addition & 13 deletions front/src/common/StationCard.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
import cx from 'classnames';

import type { ImportStation } from 'applications/operationalStudies/types';
import { formatUicToCi } from 'utils/strings';

export interface ImportStation {
trigram?: string;
name?: string;
yardname?: string;
town?: string;
department?: string;
region?: string;
uic?: number;
linename?: string;
pk?: string;
linecode?: string;
}

type Props = {
station: ImportStation;
onClick?: () => void;
Expand Down
6 changes: 4 additions & 2 deletions front/src/common/api/graouApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { TrainScheduleImportConfig } from 'applications/operationalStudies/types';
import type { ImportStation } from 'common/StationCard';
import type {
ImportStation,
TrainScheduleImportConfig,
} from 'applications/operationalStudies/types';

export const GRAOU_URL = 'https://graou.info';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useTranslation } from 'react-i18next';
import nextId from 'react-id-generator';

import type {
ImportStation,
ImportedTrainSchedule,
TrainScheduleImportConfig,
Step,
Expand All @@ -15,7 +16,7 @@ import { getGraouTrainSchedules } from 'common/api/graouApi';
import { type TrainScheduleBase } from 'common/api/osrdEditoastApi';
import InputSNCF from 'common/BootstrapSNCF/InputSNCF';
import { ModalContext } from 'common/BootstrapSNCF/ModalSNCF/ModalProvider';
import StationCard, { type ImportStation } from 'common/StationCard';
import StationCard from 'common/StationCard';
import UploadFileModal from 'common/uploadFileModal';
import StationSelector from 'modules/trainschedule/components/ImportTrainSchedule/ImportTrainScheduleStationSelector';
import { setFailure } from 'reducers/main';
Expand Down Expand Up @@ -154,7 +155,7 @@ const ImportTrainScheduleConfig = ({
date,
startTime,
endTime,
} as TrainScheduleImportConfig);
});
}
}
// EXTRACT-CI-CH-CODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import nextId from 'react-id-generator';

import type { ImportStation } from 'applications/operationalStudies/types';
import { searchGraouStations } from 'common/api/graouApi';
import InputSNCF from 'common/BootstrapSNCF/InputSNCF';
import { Loader } from 'common/Loaders';
import StationCard, { type ImportStation } from 'common/StationCard';
import StationCard from 'common/StationCard';
import { useDebounce } from 'utils/helpers';

interface ImportTrainScheduleStationSelectorProps {
Expand Down
Loading