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

fix: some small things #1860

Merged
merged 5 commits into from
Jan 23, 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
2 changes: 1 addition & 1 deletion assets/js/cr-timetable-train-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class CRTimetableTrainIcons {
return stop;
}
// For vehicles in transit with prior stop data, put the vehicle in the prior stop container
const stopSequence = this.schedules[stop].stop_sequence || 1;
const stopSequence = this.schedules[stop]?.stop_sequence || 1;
return this.priorStops[`${vehicle.trip_id}-${stopSequence - 1}`];
}
}
6 changes: 2 additions & 4 deletions assets/js/cr-timetable-trains.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ export class CRTimetableTrains {
}

onVehicles(ev) {
const { data } = ev.detail;
data.forEach(vehicle => this.icons.addOrUpdateTrain(vehicle));
ev.detail?.data?.forEach(vehicle => this.icons.addOrUpdateTrain(vehicle));
}

onRemoveVehicles(ev) {
const { data } = ev.detail;
data.forEach(d => removeTrain(d.toString().split("-")[1]));
ev.detail?.data?.forEach(d => removeTrain(d.toString().split("-")[1]));
}

teardown() {
Expand Down
1 change: 1 addition & 0 deletions assets/ts/stop/components/StopMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const StopMap = ({
selectedRoute
}: Props): ReactElement<HTMLElement> => {
const mapConfig = useMapConfig();
if (!mapConfig) return <></>;
const iconName = routeToModeIconName(selectedRoute);
const mapData = {
// TODO: Default center on the selected vehicle
Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/controllers/event_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defmodule DotcomWeb.EventController do
|> async_assign_default(
:events,
fn ->
Map.get(events_by_year, conn.assigns.year)
Map.get(events_by_year, conn.assigns.year, [])
end,
[]
)
Expand Down
13 changes: 6 additions & 7 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -147,27 +147,26 @@ defmodule DotCom.Mixfile do
end

defp compile_assets(_) do
# starts the Phoenix framework mix phx.digest command, that takes content
# from assets/static and processes it into priv/static
print("(1/3) mix phx.digest")
Mix.Task.run("phx.digest", [])

# builds the node script that lets us render some react components
# server-side, compiling assets/react_app.js,
# outputting react_renderer/dist/app.js
print("(2/3) webpack --config webpack.config.react_app.js --env.production")
print("(1/3) webpack --config webpack.config.react_app.js --env.production")

{_, 0} =
System.cmd("npm", ["run", "--prefix", "assets", "webpack:build:react"],
stderr_to_stdout: true
)

# 3 - transpiles/builds our typescript/CSS/everything else for production
print("(3/3) webpack --config webpack.config.prod.js --env.production (long)")
print("2/3) webpack --config webpack.config.prod.js --env.production (long)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like step 3/3 is missing


{_, 0} =
System.cmd("npm", ["run", "--prefix", "assets", "webpack:build"], stderr_to_stdout: true)

# starts the Phoenix framework mix phx.digest command, that takes content
# from assets/static and processes it into priv/static
print("(3/3) mix phx.digest")

Mix.Task.run("phx.digest", [])
end

Expand Down
Loading