Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/extension-cli-bundled-navigation-cleanup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openmapx/extension-cli": patch
---

Refresh bundled workspace code after retiring experimental navigation previews and preserving conservative lane-guidance semantics. Extension scaffolding, validation and packaging commands and their shipped templates are unchanged.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function features(): GeoJSON.Feature[] {
}

afterEach(() => {
navState.route = route;
navState.progress = {
currentStepIndex: 0,
distanceToNextManeuver: 300,
Expand Down Expand Up @@ -100,6 +101,25 @@ describe("NavManeuverArrowLayer", () => {
expect(typeof point?.properties?.bearing).toBe("number");
});

it("centres the map arrow on the same physical maneuver as the countdown", () => {
navState.route = {
...route,
steps: route.steps.map((step, i) => ({
...step,
coordinates:
i === 0
? [geometry[0], geometry[1]]
: i === 1
? [geometry[1], geometry[2]]
: [geometry[2]],
})),
};
render(<NavManeuverArrowLayer />);
const line = features().find(
(feature) => feature.geometry.type === "LineString",
) as GeoJSON.Feature<GeoJSON.LineString>;
expect(line.geometry.coordinates.some(([lng, lat]) => lng === 8 && lat === 50.01)).toBe(true);
});
it("empties the source outside the approach window", () => {
navState.progress = {
currentStepIndex: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
maneuverArrowLine,
maneuverArrowSpans,
maneuverArrowTipBearing,
stepStartMeters,
maneuverStartMeters,
upcomingManeuverIndex,
useNavigationStore,
} from "@openmapx/core";
Expand Down Expand Up @@ -62,7 +62,7 @@ export function NavManeuverArrowLayer() {
if (!step?.maneuver || NON_JUNCTION_TYPES.has(step.maneuver.type))
return EMPTY_FEATURE_COLLECTION;
const cum = cumulativeDistances(route.geometry);
const alongMeters = stepStartMeters(route.steps, upcomingIndex);
const alongMeters = maneuverStartMeters(route, upcomingIndex);
const spans: ManeuverArrowSpans = maneuverArrowSpans(mode);
const line = maneuverArrowLine(route.geometry, cum, alongMeters, spans);
if (!line || line.length < 2) return EMPTY_FEATURE_COLLECTION;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ vi.mock("./NavBottomBarSlot", () => ({
NavBottomBarSlot: ({ menuToggle }: { menuToggle?: ReactNode }) => <div>{menuToggle}</div>,
}));
vi.mock("./NavManeuverSlot", () => ({ NavManeuverSlot: () => null }));
vi.mock("./JunctionViewSlot", () => ({ JunctionViewSlot: () => null }));
vi.mock("./NavOfflineBannerSlot", () => ({ NavOfflineBannerSlot: () => null }));
vi.mock("./NavAlertSlot", () => ({ NavAlertSlot: () => null }));
vi.mock("./NavStatusSlot", () => ({ NavStatusSlot: () => null }));
Expand Down
45 changes: 4 additions & 41 deletions apps/web/src/components/navigation/GroundNavigationChrome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,13 @@ import { NavigationSettingsDialog } from "@/components/settings/NavigationSettin
import { useMapOptional } from "@/integration-api/map/MapContext";
import { NAV_CHROME_TOP, NAV_LANDSCAPE_PANEL_WIDTH } from "@/lib/layout";
import { useNavigationMutations } from "@/lib/mobile/useNavigationMutations";
import {
useMobilePanelClearance,
useMobilePanelOccupiedHeight,
useWindowHeight,
} from "@/lib/mobilePanelHeight";
import { useMobilePanelClearance, useWindowHeight } from "@/lib/mobilePanelHeight";
import type { OfflineRouteCoverage } from "@/lib/navigation/offlineRouteCoverage";
import { useJunctionPreviewBudget } from "@/lib/navigation/useJunctionPreviewBudget";
import { useNavChromeObstructions } from "@/lib/navigation/useNavChromeObstructions";
import { useSheetFollowTrack } from "@/lib/sheetFollow";
import { ArrivalCard } from "./ArrivalCard";
import { ARRIVAL_WAYPOINT_MATCH_TOLERANCE_METERS } from "./arrivalHandoffState";
import { FasterRouteBanner } from "./FasterRouteBanner";
import { JunctionViewSlot } from "./JunctionViewSlot";
import { NavAlertSlot } from "./NavAlertSlot";
import { NavBottomBarSlot } from "./NavBottomBarSlot";
import { NavDirectionsDialog } from "./NavDirectionsDialog";
Expand Down Expand Up @@ -83,11 +77,6 @@ export function GroundNavigationChrome({ coverage }: Props) {
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));

const [shellEl, setShellEl] = useState<HTMLDivElement | null>(null);
const [bottomEl, setBottomEl] = useState<HTMLDivElement | null>(null);
const [junctionEl, setJunctionEl] = useState<HTMLDivElement | null>(null);
const [speedLimitEl, setSpeedLimitEl] = useState<HTMLDivElement | null>(null);
const [bottomHeaderEl, setBottomHeaderEl] = useState<HTMLDivElement | null>(null);
const [bannerEl, setBannerEl] = useState<HTMLDivElement | null>(null);
useNavChromeObstructions("ground", { isMobile, arrived: status === "arrived", bannerEl });

Expand All @@ -106,21 +95,6 @@ export function GroundNavigationChrome({ coverage }: Props) {
const vh = useWindowHeight();
const sheetClearance = useMobilePanelClearance(vh);
const followTrack = useSheetFollowTrack();
const sheetOccupiedHeight = useMobilePanelOccupiedHeight();
const junctionAvailableHeight = useJunctionPreviewBudget({
shell: shellEl,
banner: bannerEl,
junction: junctionEl,
bottom: bottomEl,
speedLimit: speedLimitEl,
bottomHeader: bottomHeaderEl,
isMobile,
sheetClearance,
// Matches NavSpeedLimitSlot: the badge rides a driving sheet by translation.
speedLimitRidesSheet: isMobile && followTrack !== null,
sheetOccupiedHeight,
mobilePanelPending: isMobile && !!route && sheetOccupiedHeight === 0,
});

const rerouting = status === "rerouting";

Expand Down Expand Up @@ -173,7 +147,6 @@ export function GroundNavigationChrome({ coverage }: Props) {

return (
<Box
ref={setShellEl}
data-testid="ground-nav-chrome"
sx={{
position: "fixed",
Expand Down Expand Up @@ -236,7 +209,6 @@ export function GroundNavigationChrome({ coverage }: Props) {
}}
>
<NavManeuverSlot />
<JunctionViewSlot availableHeight={junctionAvailableHeight} panelRef={setJunctionEl} />
<NavOfflineBannerSlot coverage={coverage} />
<NavAlertSlot />
{rerouting && (
Expand All @@ -263,7 +235,6 @@ export function GroundNavigationChrome({ coverage }: Props) {

{/* Bottom region: speed limit sits just above the panel, on the left. */}
<Box
ref={setBottomEl}
data-testid="ground-nav-bottom"
sx={{
display: "flex",
Expand All @@ -273,18 +244,14 @@ export function GroundNavigationChrome({ coverage }: Props) {
...(isMobile ? {} : { minHeight: 0 }),
}}
>
<NavSpeedLimitSlot
isMobile={isMobile}
sheetClearance={sheetClearance}
elementRef={setSpeedLimitEl}
/>
<NavSpeedLimitSlot isMobile={isMobile} sheetClearance={sheetClearance} />
{route &&
(isMobile ? (
<NavSwipeSheet
expanded={menuOpen}
onExpandedChange={setMenuOpen}
header={
<Box ref={setBottomHeaderEl} data-testid="ground-nav-bottom-header">
<Box data-testid="ground-nav-bottom-header">
<NavBottomBarSlot />
</Box>
}
Expand Down Expand Up @@ -313,11 +280,7 @@ export function GroundNavigationChrome({ coverage }: Props) {
overflow: "hidden",
}}
>
<Box
ref={setBottomHeaderEl}
data-testid="ground-nav-bottom-header"
sx={{ flexShrink: 0 }}
>
<Box data-testid="ground-nav-bottom-header" sx={{ flexShrink: 0 }}>
<NavBottomBarSlot menuToggle={desktopMenuToggle} />
</Box>
{/* Header stays pinned; the expanded menu scrolls. */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ vi.mock("@/lib/navigation/useNavCamera", () => ({
calls.camera += 1;
},
}));
vi.mock("@/lib/navigation/useNavJunctions", () => ({
useNavJunctions: () => {},
vi.mock("@/lib/navigation/useNavLaneGuidance", () => ({
useNavLaneGuidance: () => {},
}));
vi.mock("@/lib/useWakeLock", () => ({
useWakeLock: (enabled: boolean) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useNavIncidentResource } from "@openmapx/integration-framework/react";
import { useMobileRuntime } from "@/lib/mobile/useMobileRuntime";
import { useNavCamera } from "@/lib/navigation/useNavCamera";
import { useNavigationEngine } from "@/lib/navigation/useNavigationEngine";
import { useNavJunctions } from "@/lib/navigation/useNavJunctions";
import { useNavLaneGuidance } from "@/lib/navigation/useNavLaneGuidance";
import { useWakeLock } from "@/lib/useWakeLock";

/**
Expand Down Expand Up @@ -33,7 +33,7 @@ export function GroundNavigationRuntime() {
// store says what the shell says. Rendering is the one thing both authorities
// share, so it stays here rather than inside the browser-only child.
useNavCamera();
useNavJunctions();
useNavLaneGuidance();

return browserAuthority ? <BrowserGroundRuntime /> : null;
}
Expand Down
Loading
Loading