Skip to content

Planner search panel: control-style chips, results with a distance column and day groups, hover that scrolls #3288

Closed

Description

@timohueser

Status: done
Size: M
Part of #3286. Depends on #3287.
Systems: route-planning, search

TL;DR

Goal: The search chips look pressable, the results list is easy to scan, a hovered marker always shows its row, and the block under the search field is gone.
Problem: The chips are pale pills with 12 px text. Each result row repeats its kind and a long distance sentence. A hovered marker highlights a row that is often outside the visible part of the list. Under the search field sit the region name, a location button, a test route and a coverage sentence.
Decision: The chips take the look of the other controls of the planner: white, a thin border, 13 px semibold. The results show their distances in a right column and, on a trip, are grouped by day. A hovered marker scrolls its row into view. The block under the search field goes; a search that needs the position of the rider asks the browser for it. (Review page, findings 01 option A, 02 and 03.)

Plan

  1. builder/web/src/components/planner/PlannerApp.svelte: add the global class .planner-chip with the values of "Shared look" in EPIC — Planner UX: less text, clear controls, nights that follow the stay kinds, no route alternatives #3286.
  2. builder/web/src/components/planner/QueryChip.svelte: the trigger button takes the class planner-chip and sets --chip-ink: var(--filter-ink). Delete the pill rules of .chip (tint, radius 999 px, 12 px). The end icon is up while the chip is open. A removed chip keeps its line-through.
  3. builder/web/src/components/planner/PlannerQuery.svelte: delete the .meaning-label line, the .data-button, the .settings block, the state settings and the constant online. Delete the prop onLocation as a button target (step 4 uses it). Keep onSample, and show its button only when import.meta.env.DEV is true.
  4. Location on demand. planner/search/resolver.mjs: the two errors that start with "Set your location" get the property code = 'location'. planner/search/server.mjs: an error answer includes code when the error has one. searchPlaces in builder/web/src/lib/planner/search/types.ts: the thrown Error carries code. PlannerQuery.svelte run: on code === 'location', call await onLocation() once and run the search again with the new position. If no position comes, show "Allow location access to search near you." onLocation is locate in PlannerApp.svelte, which reads the position from the browser (navigator.geolocation.getCurrentPosition). It returns Promise<Coordinate | undefined> and no longer writes "Location set for search" to the status line.
  5. builder/web/src/components/planner/PlaceRow.svelte: add the optional prop distance?: { main: string; sub?: string }. With it, the row shows the two lines right-aligned with tabular-nums in place of the chevron and of the detail line. Add the optional prop showKind = true; with false the second line is the locality only.
  6. builder/web/src/components/planner/QueryResults.svelte:
    • A result with position gets main = "km " + along.toFixed(1) and sub = "on route" when position.distance < 0.05, else distance.toFixed(1) + " km off". A result without position gets main = distance.toFixed(1) + " km" and no sub. The text "Street location only" stays in the second line of its row.
    • showKind is false when every result has the same kind.
    • New props days: { number: number; from: number; to: number }[] and theme. PlannerApp.svelte passes queryPlan.days.filter(day => !day.rest): the riding days in km, each with the day number that the day list shows. When days has more than one entry and every result has position, a heading "Day {number}" (.day-head, sticky inside .pane-scroll) stands before the first result of each day. Its dot has the colour dayColor(index + 1, theme), where index is the position of the day in days.
    • Rows are divided by a 1 px line in var(--line).
  7. Hover. In PlaceRow.svelte, when hovered turns true and the row does not match :hover, call scrollIntoView({ block: 'nearest' }); use behavior: 'smooth' unless the user prefers reduced motion. A hovered or selected row draws box-shadow: 0 0 0 2px var(--amber) on its .place-icon, the same ring as the highlighted marker.
  8. Tests: update PlannerQuery.svelte.test.ts for the deleted block and the dev-only button. Add cases to a QueryResults component test: day headings, "on route", the kind hidden when all kinds are equal. Add one resolver test for code.

Done when

  • From builder/web: npx vitest run src/components/planner/ and npm run check
  • The search suite of planner/search/README.md passes.
  • In the running planner: "hotel along the route" on a two-day trip shows day headings; hovering a marker far down the list scrolls its row into view.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions