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

Remove old search mode code #2350

Merged
merged 12 commits into from
Jan 5, 2024
8 changes: 1 addition & 7 deletions assets/src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ import ShuttleMapPage from "./shuttleMapPage"
import { allOpenRouteIds } from "../models/routeTab"
import Nav from "./nav"
import RightPanel from "./rightPanel"
import { mapModeForUser } from "../util/mapMode"
import { Ghost, Vehicle, VehicleInScheduledService } from "../realtime"
import MapPage from "./mapPage"
import SearchPage from "./searchPage"
import { OpenView, isPagePath } from "../state/pagePanelState"
import { usePanelStateFromStateDispatchContext } from "../hooks/usePanelState"
import PropertiesPanel from "./propertiesPanel"
Expand Down Expand Up @@ -61,10 +59,6 @@ export const AppRoutes = () => {
vehiclesByRouteIdNeeded ? allOpenRouteIds(routeTabs) : []
)

const mapMode = mapModeForUser()

const mapElement = mapMode.path === "/map" ? <MapPage /> : <SearchPage />

return (
<div className="l-app">
<div className="l-app__banner">
Expand Down Expand Up @@ -106,7 +100,7 @@ export const AppRoutes = () => {
/>
}
>
<BrowserRoute path={mapMode.path} element={mapElement} />
<BrowserRoute path="/map" element={<MapPage />} />
</Route>
</Routes>
</Nav>
Expand Down
5 changes: 1 addition & 4 deletions assets/src/components/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { createControlComponent } from "@react-leaflet/core"
import { joinClasses } from "../helpers/dom"
import { TrainVehicle, Vehicle, VehicleId } from "../realtime.d"
import { Shape, Stop } from "../schedule"
import inTestGroup, { TestGroups } from "../userInTestGroup"
import {
GarageMarkers,
RouteShape,
Expand Down Expand Up @@ -198,9 +197,7 @@ const Map = (props: Props): ReactElement<HTMLDivElement> => {
<RouteStopMarkers
stops={stops}
zoomLevel={zoomLevel}
includeStopCard={
props.includeStopCard && inTestGroup(TestGroups.MapBeta)
}
includeStopCard={props.includeStopCard}
/>
</Pane>
)}
Expand Down
8 changes: 2 additions & 6 deletions assets/src/components/mapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { LocationSearchResult } from "../models/locationSearchResult"
import LocationCard from "./mapPage/locationCard"
import { useLocationSearchResultById } from "../hooks/useLocationSearchResultById"
import { fullStoryEvent } from "../helpers/fullStory"
import inTestGroup, { TestGroups } from "../userInTestGroup"
import { usePanelStateFromStateDispatchContext } from "../hooks/usePanelState"

const SearchMode = ({
Expand Down Expand Up @@ -314,11 +313,8 @@ const MapPage = (): ReactElement<HTMLDivElement> => {
setVehicleSelection(...args)
}}
fetchedSelectedLocation={fetchedSelectedLocation}
onVehicleRunClicked={
inTestGroup(TestGroups.SearchMapsOnMobile)
? (vehicleOrGhost: Vehicle | Ghost) =>
openVehiclePropertiesPanel(vehicleOrGhost, "run")
: undefined
onVehicleRunClicked={(vehicleOrGhost: Vehicle | Ghost) =>
openVehiclePropertiesPanel(vehicleOrGhost, "run")
}
/>
) : (
Expand Down
3 changes: 1 addition & 2 deletions assets/src/components/nav/topNavMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import NotificationBellIcon from "../notificationBellIcon"
import { currentTabName, RouteTab } from "../../models/routeTab"
import NavMenu from "./navMenu"
import { tagManagerEvent } from "../../helpers/googleTagManager"
import { searchMapConfig } from "../../util/mapMode"

export const toTitleCase = (str: string): string => {
return str.replace(
Expand All @@ -20,7 +19,7 @@ export const pageOrTabName = (
routeTabs: RouteTab[]
): string => {
if (pathname === "/") return currentTabName(routeTabs)
if (pathname === searchMapConfig.path) return searchMapConfig.title
if (pathname === "/map") return "Search Map"
else return toTitleCase(pathname.replace("/", "").replace("-", " "))
}

Expand Down
133 changes: 0 additions & 133 deletions assets/src/components/oldSearchForm.tsx

This file was deleted.

14 changes: 3 additions & 11 deletions assets/src/components/propertiesPanel/miniMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
SelectedEntityType,
newSearchSession,
} from "../../state/searchPageState"
import inTestGroup, { TestGroups } from "../../userInTestGroup"
import { mapModeForUser } from "../../util/mapMode"
import { MapFollowingPrimaryVehicles } from "../map"
import { fullStoryEvent } from "../../helpers/fullStory"

Expand All @@ -27,7 +25,7 @@ const SearchMapLink = ({ vehicleId }: { vehicleId: VehicleId }) => {
<Link
ref={openMapLinkRef}
className="c-vehicle-properties-panel__map-open-link leaflet-bar"
to={mapModeForUser().path}
to="/map"
onClick={() => {
fullStoryEvent("Map opened from VPP mini map", {})
dispatch(
Expand Down Expand Up @@ -56,22 +54,16 @@ const MiniMap = ({
}) => {
const stations: Stop[] | null = useStations()

const inMapBetaGroup = inTestGroup(TestGroups.MapBeta)

return (
<MapFollowingPrimaryVehicles
selectedVehicleId={vehicle.id}
vehicles={[vehicle]}
shapes={shapes}
secondaryVehicles={routeVehicles}
stations={stations}
allowFullscreen={!inMapBetaGroup}
allowFullscreen={false}
>
<>
{inMapBetaGroup && openMapEnabled && (
<SearchMapLink vehicleId={vehicle.id} />
)}
</>
<>{openMapEnabled && <SearchMapLink vehicleId={vehicle.id} />}</>
</MapFollowingPrimaryVehicles>
)
}
Expand Down
Loading
Loading