Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jusimen committed Dec 17, 2024
1 parent 7abe780 commit eec118c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions frontend/components/common/TimetableSchedules/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/* * */

Expand Down Expand Up @@ -42,11 +42,11 @@ export default function TimetableSchedules({ selectedExceptionIds, setSelectedEx
{hourData.minutes.map(minuteData => (
<TimetableSchedulesMinute
key={minuteData.minute_value}
isHighlighted={Boolean(linesDetailContext.data.highlighted_trip_ids && minuteData.trip_ids.some(tripId => 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)}
/>
))}
</div>
Expand All @@ -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) {
//

//
Expand All @@ -95,9 +95,9 @@ function TimetableSchedulesMinute({ minuteData, selectedExceptionIds, setSelecte
<p
key={minuteData.minute_value}
className={`${styles.minute} ${minuteData.exception_ids.length > 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 => (
Expand Down
4 changes: 2 additions & 2 deletions frontend/contexts/LinesDetail.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/utils/createTimetable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eec118c

Please sign in to comment.