Repository navigation
Conversation
Replaces the raw turn angle format with enum-typed steps that map directly to the instructions the frontend shows. Types only; mock data comes in a follow-up PR. Part of #97.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a new turn by turn directions format to replace the raw turn angle. Each step has an enum
typethat maps directly to an instruction the frontend shows, so the FE doesn't have to interpret angles without knowing what other branches exist. Types only; mock data comes in a follow-up PR.Format
Directionsis an ordered array ofDirectionStep, a discriminated union ontype:typedepartturndirection:slight_left|left|sharp_left|slight_right|right|sharp_rightcontinuecrossstreet: string | nullarriveEvery step also has
path_index(index intopath_coords),distance(meters until the next step),onto(street/path name after the step, or null), andlandmark(nearby landmark, or null).The enums can be extended as the algorithm improves; the FE should fall back to a generic instruction for values it doesn't recognize.
Type of Change
feat)Changed Files
src/walking/directions.ts(new)TurnDirection,DirectionStep,DirectionStepType,Directionstest/directions.test.ts(new)Related Issues
Part of #97 (step 1: types)
Does your code rely on another PR
No
Testing Done
Vitest:
test/directions.test.ts(13 tests, all passing)tsc --noEmitandtypedoc --treatWarningsAsErrorspass locallyChecklist
<type>(scope): short descriptionmainand is our current working update branch (e.g.maizebus2.1,dev)print()/debugPrint()/console.log()left in production code