From eec118c190c731ffc3a16dcefbaa9a734f980699 Mon Sep 17 00:00:00 2001 From: Josue Monteiro Date: Tue, 17 Dec 2024 16:48:27 +0000 Subject: [PATCH] Fix linting issues --- .../components/common/TimetableSchedules/index.tsx | 14 +++++++------- frontend/contexts/LinesDetail.context.tsx | 4 ++-- frontend/utils/createTimetable.ts | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/components/common/TimetableSchedules/index.tsx b/frontend/components/common/TimetableSchedules/index.tsx index 63e1683c..1ca07c8e 100644 --- a/frontend/components/common/TimetableSchedules/index.tsx +++ b/frontend/components/common/TimetableSchedules/index.tsx @@ -3,10 +3,10 @@ import type { Timetable } from '@/types/timetables.types'; import type { Minute } from '@/types/timetables.types'; +import { useLinesDetailContext } from '@/contexts/LinesDetail.context'; import { useTranslations } from 'next-intl'; import styles from './styles.module.css'; -import { useLinesDetailContext } from '@/contexts/LinesDetail.context'; /* * */ @@ -42,11 +42,11 @@ export default function TimetableSchedules({ selectedExceptionIds, setSelectedEx {hourData.minutes.map(minuteData => ( linesDetailContext.data.highlighted_trip_ids?.includes(tripId)))} minuteData={minuteData} + onClick={() => linesDetailContext.actions.setHighlightedTripIds(minuteData.trip_ids)} selectedExceptionIds={selectedExceptionIds} setSelectedExceptionIds={setSelectedExceptionIds} - isHighlighted={Boolean(linesDetailContext.data.highlighted_trip_ids && minuteData.trip_ids.some(tripId => linesDetailContext.data.highlighted_trip_ids?.includes(tripId)))} - onClick={() => linesDetailContext.actions.setHighlightedTripIds(minuteData.trip_ids)} /> ))} @@ -60,16 +60,16 @@ export default function TimetableSchedules({ selectedExceptionIds, setSelectedEx /* * */ interface TimetableSchedulesMinuteProps { + isHighlighted: boolean minuteData: Minute + onClick?: () => void selectedExceptionIds: string[] setSelectedExceptionIds: (values: string[]) => void - isHighlighted: boolean - onClick?: () => void } /* * */ -function TimetableSchedulesMinute({ minuteData, selectedExceptionIds, setSelectedExceptionIds, isHighlighted, onClick }: TimetableSchedulesMinuteProps) { +function TimetableSchedulesMinute({ isHighlighted, minuteData, onClick, selectedExceptionIds, setSelectedExceptionIds }: TimetableSchedulesMinuteProps) { // // @@ -95,9 +95,9 @@ function TimetableSchedulesMinute({ minuteData, selectedExceptionIds, setSelecte

0 && styles.withException} ${isSelected && styles.isSelected} ${!isSelected && selectedExceptionIds.length > 0 && styles.isOthersSelected} ${isHighlighted && styles.isHighlighted}`} + onClick={onClick} onMouseOut={handleMouseOutException} onMouseOver={handleMouseOverException} - onClick={onClick} > {minuteData.minute_label} {minuteData.exception_ids.length > 0 && minuteData.exception_ids.map(exceptionId => ( diff --git a/frontend/contexts/LinesDetail.context.tsx b/frontend/contexts/LinesDetail.context.tsx index 913c78d1..9270d9ba 100644 --- a/frontend/contexts/LinesDetail.context.tsx +++ b/frontend/contexts/LinesDetail.context.tsx @@ -30,11 +30,11 @@ interface LinesDetailContextState { active_waypoint: null | Waypoint all_patterns: null | Pattern[][] demand_metrics: DemandMetricsByLine | undefined + highlighted_trip_ids: null | string[] line: Line | undefined routes: Route[] service_metrics: ServiceMetrics[] valid_patterns: Pattern[] | undefined - highlighted_trip_ids: null | string[] } filters: { active_pattern_id: null | string @@ -360,11 +360,11 @@ export const LinesDetailContextProvider = ({ children, lineId }) => { active_waypoint: dataActiveWaypointState, all_patterns: dataAllPatternsState, demand_metrics: dataDemandMetricsState, + highlighted_trip_ids: dataHighlightedTripIdsState, line: dataLineState, routes: dataRoutesState, service_metrics: dataServiceMetricsState, valid_patterns: dataValidPatternsState, - highlighted_trip_ids: dataHighlightedTripIdsState, }, filters: { active_pattern_id: filterActivePatternIdState, diff --git a/frontend/utils/createTimetable.ts b/frontend/utils/createTimetable.ts index 6e1d320e..447b660d 100644 --- a/frontend/utils/createTimetable.ts +++ b/frontend/utils/createTimetable.ts @@ -51,7 +51,7 @@ export default function createTimetable(primaryPatternGroup: Pattern, secondaryP // Find or create the hour entry in the timetable let hourEntry = timetableResult.hours.find(h => h.hour_value === hourValue); if (!hourEntry) { - hourEntry = { hour_label: hour24, hour_value: hourValue, minutes: []}; + hourEntry = { hour_label: hour24, hour_value: hourValue, minutes: [] }; timetableResult.hours.push(hourEntry); } // Find or create the minute entry in the timetable