Skip to content

Commit

Permalink
fix: respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rudiejd committed Jul 10, 2024
1 parent 173696f commit e086ad1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 3 additions & 2 deletions server/chalicelib/fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
blue_has_eyes = lambda _: False
orange_has_eyes = lambda _: False
silver_has_eyes = lambda _: False
blue_has_eyes = lambda _: False
blue_has_eyes = lambda _: True


def get_route_test_function_dict(route_ids, test_fn):
Expand Down Expand Up @@ -52,9 +52,10 @@ def get_route_test_function_dict(route_ids, test_fn):
def vehicle_is_new(route_name, car):
return vehicle_is_new_func[route_name](car)


def vehicle_array_is_new(route_name, arr):
return any(map(vehicle_is_new_func[route_name], arr))


def vehicle_array_has_eyes(route_name, arr):
return any(map(vehicle_has_eyes_func[route_name], arr))

3 changes: 2 additions & 1 deletion src/components/Line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import { prerenderLine } from '../prerender';
import { renderTextTrainlabel } from '../labels';

import { TrainDisplay } from './Train';
import { TrainDisplay } from './TrainDisplay';
import { PopoverContainerContext, getTrainRoutePairsForLine, setCssVariable } from './util';
import { Line as TLine, Pair, StationPositions, VehicleCategory } from '../types';
import { MBTAApi } from '../hooks/useMbtaApi';
Expand All @@ -15,6 +15,7 @@ import relativeTime from 'dayjs/plugin/relativeTime';
const AGE_WORD_MAP = new Map<VehicleCategory, string>([
['new_vehicles', ' new '],
['old_vehicles', ' old '],
['googly_eyes_vehicles', ' googly-eyed '],
['vehicles', ' '],
]);

Expand Down
13 changes: 11 additions & 2 deletions src/components/Train.tsx → src/components/TrainDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,21 @@ export const TrainDisplay = ({
stroke={isTracked ? 'white' : undefined}
textAnchor="middle"
/>
<polygon points={drawEquilateralTriangle(2)} fill={'white'} />
<circle
cx={2}
cy={3}
r={2}
fill={'black'}
stroke={isTracked ? 'white' : undefined}
textAnchor="middle"
/>
{hasGooglyEyes ? (
<text fontSize={5} x={-3.2} y={1} transform="rotate(90)">
<text fontSize={3} x={1} y={-1} transform="rotate(90)">
👀
</text>
) : (
<polygon points={drawEquilateralTriangle(2)} fill={'white'} />
<></>
)}
</g>
);
Expand Down

0 comments on commit e086ad1

Please sign in to comment.